Commit 13802c8b authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[bigint] Adapt test/mjsunit/mjsunit.js.

R=jkummerow@chromium.org

Bug: v8:6791
Change-Id: I9eb5b9aeeb060d660ec41b7a3287089edd833197
Reviewed-on: https://chromium-review.googlesource.com/737796Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48992}
parent 3942370c
......@@ -192,6 +192,12 @@ var failWithMessage;
var ArrayPrototypeMap = Array.prototype.map;
var ArrayPrototypePush = Array.prototype.push;
var BigIntPrototypeValueOf;
// TODO(neis): Remove try-catch once BigInts are enabled by default.
try {
BigIntPrototypeValueOf = BigInt.prototype.valueOf;
} catch(e) {}
function classOf(object) {
// Argument must not be null or undefined.
var string = ObjectPrototypeToString.call(object);
......@@ -204,6 +210,8 @@ var failWithMessage;
switch (classOf(value)) {
case "Number":
return NumberPrototypeValueOf.call(value);
case "BigInt":
return BigIntPrototypeValueOf.call(value);
case "String":
return StringPrototypeValueOf.call(value);
case "Boolean":
......@@ -223,6 +231,8 @@ var failWithMessage;
case "number":
if (value === 0 && (1 / value) < 0) return "-0";
// FALLTHROUGH.
case "bigint":
return String(value) + "n";
case "boolean":
case "undefined":
case "function":
......@@ -233,6 +243,7 @@ var failWithMessage;
var objectClass = classOf(value);
switch (objectClass) {
case "Number":
case "BigInt":
case "String":
case "Boolean":
case "Date":
......@@ -346,7 +357,8 @@ var failWithMessage;
return true;
}
if (objectClass === "String" || objectClass === "Number" ||
objectClass === "Boolean" || objectClass === "Date") {
objectClass === "BigInt" || objectClass === "Boolean" ||
objectClass === "Date") {
if (ValueOf(a) !== ValueOf(b)) return false;
}
return deepObjectEquals(a, b);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment