summaryrefslogtreecommitdiff
path: root/js/src/vm/EqualityOperations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/vm/EqualityOperations.cpp')
-rw-r--r--js/src/vm/EqualityOperations.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/js/src/vm/EqualityOperations.cpp b/js/src/vm/EqualityOperations.cpp
index 6f90450b49..91a9ca06c7 100644
--- a/js/src/vm/EqualityOperations.cpp
+++ b/js/src/vm/EqualityOperations.cpp
@@ -31,6 +31,10 @@ EqualGivenSameType(JSContext* cx, JS::HandleValue lval, JS::HandleValue rval, bo
*equal = (lval.toDouble() == rval.toDouble());
return true;
}
+ if (lval.isBigInt()) {
+ *equal = JS::BigInt::equal(lval.toBigInt(), rval.toBigInt());
+ return true;
+ }
if (lval.isGCThing()) { // objects or symbols
*equal = (lval.toGCThing() == rval.toGCThing());
return true;
@@ -134,6 +138,22 @@ js::LooselyEqual(JSContext* cx, JS::HandleValue lval, JS::HandleValue rval, bool
return js::LooselyEqual(cx, lvalue, rval, result);
}
+ if (lval.isBigInt()) {
+ RootedBigInt lbi(cx, lval.toBigInt());
+ bool tmpResult;
+ JS_TRY_VAR_OR_RETURN_FALSE(cx, tmpResult, BigInt::looselyEqual(cx, lbi, rval));
+ *result = tmpResult;
+ return true;
+ }
+
+ if (rval.isBigInt()) {
+ RootedBigInt rbi(cx, rval.toBigInt());
+ bool tmpResult;
+ JS_TRY_VAR_OR_RETURN_FALSE(cx, tmpResult, BigInt::looselyEqual(cx, rbi, lval));
+ *result = tmpResult;
+ return true;
+ }
+
// Step 12.
*result = false;
return true;