1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: set ts=8 sts=2 et sw=2 tw=80: 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 /* 8 * The equality comparisons of js/Equality.h, but with extra efficiency for 9 * SpiderMonkey-internal callers. 10 * 11 * These functions, assuming they're passed C++-valid arguments, are identical 12 * to the same-named JS::-namespaced functions -- just with hidden linkage (so 13 * they're more efficient to call), and without various external-caller-focused 14 * JSAPI-usage assertions performed that SpiderMonkey users never come close to 15 * failing. 16 */ 17 18 #ifndef vm_EqualityOperations_h 19 #define vm_EqualityOperations_h 20 21 #include "jstypes.h" // JS_PUBLIC_API 22 #include "js/RootingAPI.h" // JS::Handle 23 #include "js/Value.h" // JS::Value 24 25 struct JS_PUBLIC_API JSContext; 26 27 namespace js { 28 29 /** Computes |lval === rval|. */ 30 extern bool StrictlyEqual(JSContext* cx, JS::Handle<JS::Value> lval, 31 JS::Handle<JS::Value> rval, bool* equal); 32 33 /** Computes |lval == rval|. */ 34 extern bool LooselyEqual(JSContext* cx, JS::Handle<JS::Value> lval, 35 JS::Handle<JS::Value> rval, bool* equal); 36 37 /** 38 * Computes |SameValue(v1, v2)| -- strict equality except that NaNs are 39 * considered equal and opposite-signed zeroes are considered unequal. 40 */ 41 extern bool SameValue(JSContext* cx, JS::Handle<JS::Value> v1, 42 JS::Handle<JS::Value> v2, bool* same); 43 44 } // namespace js 45 46 #endif // vm_EqualityOperations_h 47