diff options
Diffstat (limited to 'deps/v8/src/runtime/runtime-internal.cc')
-rw-r--r-- | deps/v8/src/runtime/runtime-internal.cc | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/deps/v8/src/runtime/runtime-internal.cc b/deps/v8/src/runtime/runtime-internal.cc index 4806922a970..bdb2931e200 100644 --- a/deps/v8/src/runtime/runtime-internal.cc +++ b/deps/v8/src/runtime/runtime-internal.cc @@ -209,11 +209,29 @@ RUNTIME_FUNCTION(Runtime_NewError) { RUNTIME_FUNCTION(Runtime_NewTypeError) { HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); + DCHECK_LE(args.length(), 4); + DCHECK_GE(args.length(), 1); CONVERT_INT32_ARG_CHECKED(template_index, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1); MessageTemplate message_template = MessageTemplateFromInt(template_index); - return *isolate->factory()->NewTypeError(message_template, arg0); + + Handle<Object> arg0; + if (args.length() >= 2) { + CHECK(args[1].IsObject()); + arg0 = args.at<Object>(1); + } + + Handle<Object> arg1; + if (args.length() >= 3) { + CHECK(args[2].IsObject()); + arg1 = args.at<Object>(2); + } + Handle<Object> arg2; + if (args.length() >= 4) { + CHECK(args[3].IsObject()); + arg2 = args.at<Object>(3); + } + + return *isolate->factory()->NewTypeError(message_template, arg0, arg1, arg2); } RUNTIME_FUNCTION(Runtime_NewReferenceError) { @@ -409,11 +427,13 @@ RUNTIME_FUNCTION(Runtime_ThrowIteratorError) { return isolate->Throw(*ErrorUtils::NewIteratorError(isolate, object)); } -RUNTIME_FUNCTION(Runtime_ThrowSpreadArgIsNullOrUndefined) { +RUNTIME_FUNCTION(Runtime_ThrowSpreadArgError) { HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); - return ErrorUtils::ThrowSpreadArgIsNullOrUndefinedError(isolate, object); + DCHECK_EQ(2, args.length()); + CONVERT_SMI_ARG_CHECKED(message_id_smi, 0); + MessageTemplate message_id = MessageTemplateFromInt(message_id_smi); + CONVERT_ARG_HANDLE_CHECKED(Object, object, 1); + return ErrorUtils::ThrowSpreadArgError(isolate, message_id, object); } RUNTIME_FUNCTION(Runtime_ThrowCalledNonCallable) { |