summaryrefslogtreecommitdiff
path: root/deps/v8/src/runtime/runtime-bigint.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/runtime/runtime-bigint.cc')
-rw-r--r--deps/v8/src/runtime/runtime-bigint.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/deps/v8/src/runtime/runtime-bigint.cc b/deps/v8/src/runtime/runtime-bigint.cc
index b4d3ff84e3..f64d9e5b1a 100644
--- a/deps/v8/src/runtime/runtime-bigint.cc
+++ b/deps/v8/src/runtime/runtime-bigint.cc
@@ -94,6 +94,25 @@ RUNTIME_FUNCTION(Runtime_ToBigInt) {
RETURN_RESULT_OR_FAILURE(isolate, BigInt::FromObject(isolate, x));
}
+RUNTIME_FUNCTION(Runtime_ToBigIntConvertNumber) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(1, args.length());
+ Handle<Object> x = args.at(0);
+
+ if (x->IsJSReceiver()) {
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, x,
+ JSReceiver::ToPrimitive(isolate, Handle<JSReceiver>::cast(x),
+ ToPrimitiveHint::kNumber));
+ }
+
+ if (x->IsNumber()) {
+ RETURN_RESULT_OR_FAILURE(isolate, BigInt::FromNumber(isolate, x));
+ } else {
+ RETURN_RESULT_OR_FAILURE(isolate, BigInt::FromObject(isolate, x));
+ }
+}
+
RUNTIME_FUNCTION(Runtime_BigIntBinaryOp) {
HandleScope scope(isolate);
DCHECK_EQ(3, args.length());