diff --git a/implementation-contributed/javascriptcore/stress/big-int-type-of.js b/implementation-contributed/javascriptcore/stress/big-int-type-of.js new file mode 100644 index 0000000000..37f3ab6fd3 --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/big-int-type-of.js @@ -0,0 +1,34 @@ +//@ runBigIntEnabled + +function assert(a) { + if (!a) + throw new Error("Bad assertion"); +} + +assert(typeof 0n === "bigint"); +assert(typeof 1n !== "object"); + +function typeOf(value) +{ + return typeof value; +} +noInline(typeOf); + +var object = {}; +var func = function () { }; +var bigInt = 1n; +var number = 0; +var string = "String"; +var symbol = Symbol("Symbol"); + +for (var i = 0; i < 1e6; ++i) { + assert(typeOf(object) === "object"); + assert(typeOf(func) === "function"); + assert(typeOf(bigInt) === "bigint"); + assert(typeOf(number) === "number"); + assert(typeOf(string) === "string"); + assert(typeOf(symbol) === "symbol"); + assert(typeOf(null) === "object"); + assert(typeOf(undefined) === "undefined"); + assert(typeOf(true) === "boolean"); +}