diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-03 13:42:47 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-15 10:27:51 +0000 |
commit | 8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (patch) | |
tree | d29d987c4d7b173cf853279b79a51598f104b403 /chromium/v8/src/runtime | |
parent | 830c9e163d31a9180fadca926b3e1d7dfffb5021 (diff) | |
download | qtwebengine-chromium-8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec.tar.gz |
BASELINE: Update Chromium to 66.0.3359.156
Change-Id: I0c9831ad39911a086b6377b16f995ad75a51e441
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/v8/src/runtime')
23 files changed, 419 insertions, 1049 deletions
diff --git a/chromium/v8/src/runtime/runtime-array.cc b/chromium/v8/src/runtime/runtime-array.cc index f07c842baec..648606a2746 100644 --- a/chromium/v8/src/runtime/runtime-array.cc +++ b/chromium/v8/src/runtime/runtime-array.cc @@ -149,7 +149,8 @@ Object* PrepareElementsForSort(Handle<JSObject> object, uint32_t limit) { JSObject::ValidateElements(*object); } else if (object->HasFixedTypedArrayElements()) { // Typed arrays cannot have holes or undefined elements. - return Smi::FromInt(FixedArrayBase::cast(object->elements())->length()); + int array_length = FixedArrayBase::cast(object->elements())->length(); + return Smi::FromInt(Min(limit, static_cast<uint32_t>(array_length))); } else if (!object->HasDoubleElements()) { JSObject::EnsureWritableFastElements(object); } @@ -390,7 +391,7 @@ RUNTIME_FUNCTION(Runtime_TrySliceSimpleNonFastElements) { // implementation. if (receiver->IsJSArray()) { // This "fastish" path must make sure the destination array is a JSArray. - if (!isolate->IsArraySpeciesLookupChainIntact() || + if (!isolate->IsSpeciesLookupChainIntact() || !JSArray::cast(*receiver)->HasArrayPrototype(isolate)) { return Smi::FromInt(0); } @@ -532,17 +533,15 @@ RUNTIME_FUNCTION(Runtime_NormalizeElements) { return *array; } - -// GrowArrayElements returns a sentinel Smi if the object was normalized. +// GrowArrayElements returns a sentinel Smi if the object was normalized or if +// the key is negative. RUNTIME_FUNCTION(Runtime_GrowArrayElements) { HandleScope scope(isolate); DCHECK_EQ(2, args.length()); CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); CONVERT_NUMBER_CHECKED(int, key, Int32, args[1]); - if (key < 0) { - return object->elements(); - } + if (key < 0) return Smi::kZero; uint32_t capacity = static_cast<uint32_t>(object->elements()->length()); uint32_t index = static_cast<uint32_t>(key); @@ -553,7 +552,6 @@ RUNTIME_FUNCTION(Runtime_GrowArrayElements) { } } - // On success, return the fixed array elements. return object->elements(); } diff --git a/chromium/v8/src/runtime/runtime-atomics.cc b/chromium/v8/src/runtime/runtime-atomics.cc index 68a7b413b5a..9849c694dc4 100644 --- a/chromium/v8/src/runtime/runtime-atomics.cc +++ b/chromium/v8/src/runtime/runtime-atomics.cc @@ -249,30 +249,6 @@ inline Object* DoXor(Isolate* isolate, void* buffer, size_t index, V(Uint32, uint32, UINT32, uint32_t, 4) \ V(Int32, int32, INT32, int32_t, 4) -RUNTIME_FUNCTION(Runtime_ThrowNotIntegerSharedTypedArrayError) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); - THROW_NEW_ERROR_RETURN_FAILURE( - isolate, - NewTypeError(MessageTemplate::kNotIntegerSharedTypedArray, value)); -} - -RUNTIME_FUNCTION(Runtime_ThrowNotInt32SharedTypedArrayError) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); - THROW_NEW_ERROR_RETURN_FAILURE( - isolate, NewTypeError(MessageTemplate::kNotInt32SharedTypedArray, value)); -} - -RUNTIME_FUNCTION(Runtime_ThrowInvalidAtomicAccessIndexError) { - HandleScope scope(isolate); - DCHECK_EQ(0, args.length()); - THROW_NEW_ERROR_RETURN_FAILURE( - isolate, NewRangeError(MessageTemplate::kInvalidAtomicAccessIndex)); -} - RUNTIME_FUNCTION(Runtime_AtomicsExchange) { HandleScope scope(isolate); DCHECK_EQ(3, args.length()); diff --git a/chromium/v8/src/runtime/runtime-bigint.cc b/chromium/v8/src/runtime/runtime-bigint.cc index 47f644f6195..ce0d8990a18 100644 --- a/chromium/v8/src/runtime/runtime-bigint.cc +++ b/chromium/v8/src/runtime/runtime-bigint.cc @@ -75,6 +75,13 @@ RUNTIME_FUNCTION(Runtime_BigIntToNumber) { return *BigInt::ToNumber(x); } +RUNTIME_FUNCTION(Runtime_ToBigInt) { + HandleScope scope(isolate); + DCHECK_EQ(1, args.length()); + CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); + RETURN_RESULT_OR_FAILURE(isolate, BigInt::FromObject(isolate, x)); +} + RUNTIME_FUNCTION(Runtime_BigIntBinaryOp) { HandleScope scope(isolate); DCHECK_EQ(3, args.length()); diff --git a/chromium/v8/src/runtime/runtime-collections.cc b/chromium/v8/src/runtime/runtime-collections.cc index 44e947aafee..efe4f455b17 100644 --- a/chromium/v8/src/runtime/runtime-collections.cc +++ b/chromium/v8/src/runtime/runtime-collections.cc @@ -11,24 +11,22 @@ namespace v8 { namespace internal { -RUNTIME_FUNCTION(Runtime_TheHole) { +RUNTIME_FUNCTION(Runtime_IsJSMapIterator) { SealHandleScope shs(isolate); - DCHECK_EQ(0, args.length()); - return isolate->heap()->the_hole_value(); + DCHECK_EQ(1, args.length()); + return isolate->heap()->ToBoolean(args[0]->IsJSMapIterator()); } -RUNTIME_FUNCTION(Runtime_GetExistingHash) { +RUNTIME_FUNCTION(Runtime_IsJSSetIterator) { SealHandleScope shs(isolate); DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); - return object->GetHash(); + return isolate->heap()->ToBoolean(args[0]->IsJSSetIterator()); } -RUNTIME_FUNCTION(Runtime_GenericHash) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); - return object->GetOrCreateHash(isolate); +RUNTIME_FUNCTION(Runtime_TheHole) { + SealHandleScope shs(isolate); + DCHECK_EQ(0, args.length()); + return isolate->heap()->the_hole_value(); } RUNTIME_FUNCTION(Runtime_SetGrow) { @@ -101,15 +99,6 @@ RUNTIME_FUNCTION(Runtime_GetWeakMapEntries) { return *JSWeakCollection::GetEntries(holder, max_entries); } -RUNTIME_FUNCTION(Runtime_WeakCollectionInitialize) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); - JSWeakCollection::Initialize(weak_collection, isolate); - return *weak_collection; -} - - RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) { HandleScope scope(isolate); DCHECK_EQ(3, args.length()); diff --git a/chromium/v8/src/runtime/runtime-date.cc b/chromium/v8/src/runtime/runtime-date.cc index 96292ad1c5f..d149af652b5 100644 --- a/chromium/v8/src/runtime/runtime-date.cc +++ b/chromium/v8/src/runtime/runtime-date.cc @@ -21,15 +21,6 @@ RUNTIME_FUNCTION(Runtime_IsDate) { return isolate->heap()->ToBoolean(obj->IsJSDate()); } - -RUNTIME_FUNCTION(Runtime_ThrowNotDateError) { - HandleScope scope(isolate); - DCHECK_EQ(0, args.length()); - THROW_NEW_ERROR_RETURN_FAILURE(isolate, - NewTypeError(MessageTemplate::kNotDateObject)); -} - - RUNTIME_FUNCTION(Runtime_DateCurrentTime) { HandleScope scope(isolate); DCHECK_EQ(0, args.length()); diff --git a/chromium/v8/src/runtime/runtime-debug.cc b/chromium/v8/src/runtime/runtime-debug.cc index d6e028b41e0..daef53280e7 100644 --- a/chromium/v8/src/runtime/runtime-debug.cc +++ b/chromium/v8/src/runtime/runtime-debug.cc @@ -43,7 +43,7 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) { // Get the top-most JavaScript frame. JavaScriptFrameIterator it(isolate); - isolate->debug()->Break(it.frame()); + isolate->debug()->Break(it.frame(), handle(it.frame()->function())); // Return the handler from the original bytecode array. DCHECK(it.frame()->is_interpreted()); @@ -53,21 +53,25 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) { BytecodeArray* bytecode_array = shared->bytecode_array(); int bytecode_offset = interpreted_frame->GetBytecodeOffset(); Bytecode bytecode = Bytecodes::FromByte(bytecode_array->get(bytecode_offset)); - if (bytecode == Bytecode::kReturn) { - // If we are returning, reset the bytecode array on the interpreted stack - // frame to the non-debug variant so that the interpreter entry trampoline - // sees the return bytecode rather than the DebugBreak. + if (Bytecodes::Returns(bytecode)) { + // If we are returning (or suspending), reset the bytecode array on the + // interpreted stack frame to the non-debug variant so that the interpreter + // entry trampoline sees the return/suspend bytecode rather than the + // DebugBreak. interpreted_frame->PatchBytecodeArray(bytecode_array); } // We do not have to deal with operand scale here. If the bytecode at the // break is prefixed by operand scaling, we would have patched over the // scaling prefix. We now simply dispatch to the handler for the prefix. + // We need to deserialize now to ensure we don't hit the debug break again + // after deserializing. OperandScale operand_scale = OperandScale::kSingle; - Code* code = isolate->interpreter()->GetAndMaybeDeserializeBytecodeHandler( - bytecode, operand_scale); + isolate->interpreter()->GetAndMaybeDeserializeBytecodeHandler(bytecode, + operand_scale); - return MakePair(isolate->debug()->return_value(), code); + return MakePair(isolate->debug()->return_value(), + Smi::FromInt(static_cast<uint8_t>(bytecode))); } @@ -81,27 +85,6 @@ RUNTIME_FUNCTION(Runtime_HandleDebuggerStatement) { } -// Adds a JavaScript function as a debug event listener. -// args[0]: debug event listener function to set or null or undefined for -// clearing the event listener function -// args[1]: object supplied during callback -RUNTIME_FUNCTION(Runtime_SetDebugEventListener) { - SealHandleScope shs(isolate); - DCHECK_EQ(2, args.length()); - CHECK(args[0]->IsJSFunction() || args[0]->IsNullOrUndefined(isolate)); - CONVERT_ARG_HANDLE_CHECKED(Object, callback, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, data, 1); - if (callback->IsJSFunction()) { - JavaScriptDebugDelegate* delegate = new JavaScriptDebugDelegate( - isolate, Handle<JSFunction>::cast(callback), data); - isolate->debug()->SetDebugDelegate(delegate, true); - } else { - isolate->debug()->SetDebugDelegate(nullptr, false); - } - return isolate->heap()->undefined_value(); -} - - RUNTIME_FUNCTION(Runtime_ScheduleBreak) { SealHandleScope shs(isolate); DCHECK_EQ(0, args.length()); @@ -261,7 +244,10 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate, Handle<String> status_str = factory->NewStringFromAsciiChecked(status); result->set(1, *status_str); - Handle<Object> value_obj(promise->result(), isolate); + Handle<Object> value_obj(promise->status() == Promise::kPending + ? isolate->heap()->undefined_value() + : promise->result(), + isolate); Handle<String> promise_value = factory->NewStringFromAsciiChecked("[[PromiseValue]]"); result->set(2, *promise_value); @@ -855,8 +841,7 @@ RUNTIME_FUNCTION(Runtime_GetAllScopesDetails) { // local). if (frame->is_wasm_interpreter_entry()) { Handle<WasmDebugInfo> debug_info( - WasmInterpreterEntryFrame::cast(frame)->wasm_instance()->debug_info(), - isolate); + WasmInterpreterEntryFrame::cast(frame)->debug_info(), isolate); return *WasmDebugInfo::GetScopeDetails(debug_info, frame->fp(), inlined_frame_index); } @@ -1036,36 +1021,6 @@ RUNTIME_FUNCTION(Runtime_SetScopeVariableValue) { } -RUNTIME_FUNCTION(Runtime_DebugPrintScopes) { - HandleScope scope(isolate); - DCHECK_EQ(0, args.length()); - -#ifdef DEBUG - // Print the scopes for the top frame. - JavaScriptFrameIterator it(isolate); - if (!it.done()) { - JavaScriptFrame* frame = it.frame(); - FrameInspector frame_inspector(frame, 0, isolate); - for (ScopeIterator si(isolate, &frame_inspector); !si.Done(); si.Next()) { - si.DebugPrint(); - } - } -#endif - return isolate->heap()->undefined_value(); -} - - -// Sets the disable break state -// args[0]: disable break state -RUNTIME_FUNCTION(Runtime_SetBreakPointsActive) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_BOOLEAN_ARG_CHECKED(active, 0); - isolate->debug()->set_break_points_active(active); - return isolate->heap()->undefined_value(); -} - - RUNTIME_FUNCTION(Runtime_GetBreakLocations) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); @@ -1084,71 +1039,6 @@ RUNTIME_FUNCTION(Runtime_GetBreakLocations) { } -// Set a break point in a function. -// args[0]: function -// args[1]: number: break source position (within the function source) -// args[2]: number: break point object -RUNTIME_FUNCTION(Runtime_SetFunctionBreakPoint) { - HandleScope scope(isolate); - DCHECK_EQ(3, args.length()); - CHECK(isolate->debug()->is_active()); - CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); - CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); - CHECK(source_position >= function->shared()->start_position() && - source_position <= function->shared()->end_position()); - CONVERT_ARG_HANDLE_CHECKED(Object, break_point_object_arg, 2); - - // Set break point. - CHECK(isolate->debug()->SetBreakPoint(function, break_point_object_arg, - &source_position)); - - return Smi::FromInt(source_position); -} - -// Changes the state of a break point in a script and returns source position -// where break point was set. NOTE: Regarding performance see the NOTE for -// GetScriptFromScriptData. -// args[0]: script to set break point in -// args[1]: number: break source position (within the script source) -// args[2]: number: break point object -RUNTIME_FUNCTION(Runtime_SetScriptBreakPoint) { - HandleScope scope(isolate); - DCHECK_EQ(3, args.length()); - CHECK(isolate->debug()->is_active()); - CONVERT_ARG_HANDLE_CHECKED(JSValue, wrapper, 0); - CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); - CHECK_GE(source_position, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, break_point_object_arg, 2); - - // Get the script from the script wrapper. - CHECK(wrapper->value()->IsScript()); - Handle<Script> script(Script::cast(wrapper->value())); - - // Set break point. - if (!isolate->debug()->SetBreakPointForScript(script, break_point_object_arg, - &source_position)) { - return isolate->heap()->undefined_value(); - } - - return Smi::FromInt(source_position); -} - - -// Clear a break point -// args[0]: number: break point object -RUNTIME_FUNCTION(Runtime_ClearBreakPoint) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CHECK(isolate->debug()->is_active()); - CONVERT_ARG_HANDLE_CHECKED(Object, break_point_object_arg, 0); - - // Clear break point. - isolate->debug()->ClearBreakPoint(break_point_object_arg); - - return isolate->heap()->undefined_value(); -} - - // Change the state of break on exceptions. // args[0]: Enum value indicating whether to affect caught/uncaught exceptions. // args[1]: Boolean indicating on/off. @@ -1572,46 +1462,6 @@ int ScriptLinePosition(Handle<Script> script, int line) { } // namespace -// TODO(5530): Remove once uses in debug.js are gone. -RUNTIME_FUNCTION(Runtime_ScriptLineStartPosition) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_CHECKED(JSValue, script, 0); - CONVERT_NUMBER_CHECKED(int32_t, line, Int32, args[1]); - - CHECK(script->value()->IsScript()); - Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); - - return Smi::FromInt(ScriptLinePosition(script_handle, line)); -} - -// TODO(5530): Remove once uses in debug.js are gone. -RUNTIME_FUNCTION(Runtime_ScriptLineEndPosition) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_CHECKED(JSValue, script, 0); - CONVERT_NUMBER_CHECKED(int32_t, line, Int32, args[1]); - - CHECK(script->value()->IsScript()); - Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); - - if (script_handle->type() == Script::TYPE_WASM) { - // Return zero for now; this function will disappear soon anyway. - return Smi::FromInt(0); - } - - Script::InitLineEnds(script_handle); - - FixedArray* line_ends_array = FixedArray::cast(script_handle->line_ends()); - const int line_count = line_ends_array->length(); - - if (line < 0 || line >= line_count) { - return Smi::FromInt(-1); - } else { - return Smi::cast(line_ends_array->get(line)); - } -} - static Handle<Object> GetJSPositionInfo(Handle<Script> script, int position, Script::OffsetFlag offset_flag, Isolate* isolate) { @@ -1774,56 +1624,26 @@ RUNTIME_FUNCTION(Runtime_ScriptPositionInfo2) { return *GetJSPositionInfo(script, position, offset_flag, isolate); } -// Returns the given line as a string, or null if line is out of bounds. -// The parameter line is expected to include the script's line offset. -// TODO(5530): Remove once uses in debug.js are gone. -RUNTIME_FUNCTION(Runtime_ScriptSourceLine) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_CHECKED(JSValue, script, 0); - CONVERT_NUMBER_CHECKED(int32_t, line, Int32, args[1]); - - CHECK(script->value()->IsScript()); - Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); - - if (script_handle->type() == Script::TYPE_WASM) { - // Return null for now; this function will disappear soon anyway. - return isolate->heap()->null_value(); - } - - Script::InitLineEnds(script_handle); - - FixedArray* line_ends_array = FixedArray::cast(script_handle->line_ends()); - const int line_count = line_ends_array->length(); - - line -= script_handle->line_offset(); - if (line < 0 || line_count <= line) { - return isolate->heap()->null_value(); - } - - const int start = - (line == 0) ? 0 : Smi::ToInt(line_ends_array->get(line - 1)) + 1; - const int end = Smi::ToInt(line_ends_array->get(line)); - - Handle<String> source = - handle(String::cast(script_handle->source()), isolate); - Handle<String> str = isolate->factory()->NewSubString(source, start, end); - - return *str; -} - // On function call, depending on circumstances, prepare for stepping in, // or perform a side effect check. RUNTIME_FUNCTION(Runtime_DebugOnFunctionCall) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); - if (isolate->debug()->last_step_action() >= StepIn) { - isolate->debug()->PrepareStepIn(fun); + if (isolate->debug()->needs_check_on_function_call()) { + // Ensure that the callee will perform debug check on function call too. + Deoptimizer::DeoptimizeFunction(*fun); + if (isolate->debug()->last_step_action() >= StepIn) { + isolate->debug()->PrepareStepIn(fun); + } + if (isolate->needs_side_effect_check() && + !isolate->debug()->PerformSideEffectCheck(fun)) { + return isolate->heap()->exception(); + } } - if (isolate->needs_side_effect_check() && - !isolate->debug()->PerformSideEffectCheck(fun)) { - return isolate->heap()->exception(); + if (fun->shared()->HasDebugInfo() && + fun->shared()->GetDebugInfo()->BreakAtEntry()) { + isolate->debug()->Break(nullptr, fun); } return isolate->heap()->undefined_value(); } @@ -1836,15 +1656,6 @@ RUNTIME_FUNCTION(Runtime_DebugPrepareStepInSuspendedGenerator) { return isolate->heap()->undefined_value(); } -RUNTIME_FUNCTION(Runtime_DebugRecordGenerator) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); - CHECK(isolate->debug()->last_step_action() >= StepNext); - isolate->debug()->RecordGenerator(generator); - return isolate->heap()->undefined_value(); -} - RUNTIME_FUNCTION(Runtime_DebugPushPromise) { DCHECK_EQ(1, args.length()); HandleScope scope(isolate); @@ -1876,26 +1687,11 @@ RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionPromiseCreated) { return isolate->heap()->undefined_value(); } -RUNTIME_FUNCTION(Runtime_DebugPromiseReject) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(JSPromise, rejected_promise, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); - - isolate->debug()->OnPromiseReject(rejected_promise, value); - return isolate->heap()->undefined_value(); -} - RUNTIME_FUNCTION(Runtime_DebugIsActive) { SealHandleScope shs(isolate); return Smi::FromInt(isolate->debug()->is_active()); } -RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { - UNIMPLEMENTED(); - return nullptr; -} - namespace { Handle<JSObject> MakeRangeObject(Isolate* isolate, const CoverageBlock& range) { Factory* factory = isolate->factory(); diff --git a/chromium/v8/src/runtime/runtime-error.cc b/chromium/v8/src/runtime/runtime-error.cc index 6ded550d04c..7cd98f223b9 100644 --- a/chromium/v8/src/runtime/runtime-error.cc +++ b/chromium/v8/src/runtime/runtime-error.cc @@ -20,5 +20,11 @@ RUNTIME_FUNCTION(Runtime_ErrorToString) { RETURN_RESULT_OR_FAILURE(isolate, ErrorUtils::ToString(isolate, recv)); } +RUNTIME_FUNCTION(Runtime_IsJSError) { + SealHandleScope shs(isolate); + DCHECK_EQ(1, args.length()); + return isolate->heap()->ToBoolean(args[0]->IsJSError()); +} + } // namespace internal } // namespace v8 diff --git a/chromium/v8/src/runtime/runtime-function.cc b/chromium/v8/src/runtime/runtime-function.cc index e9433d2041a..a9eddef644b 100644 --- a/chromium/v8/src/runtime/runtime-function.cc +++ b/chromium/v8/src/runtime/runtime-function.cc @@ -88,17 +88,6 @@ RUNTIME_FUNCTION(Runtime_FunctionGetContextData) { return fun->native_context()->debug_context_id(); } -RUNTIME_FUNCTION(Runtime_FunctionSetLength) { - SealHandleScope shs(isolate); - DCHECK_EQ(2, args.length()); - - CONVERT_ARG_CHECKED(JSFunction, fun, 0); - CONVERT_SMI_ARG_CHECKED(length, 1); - fun->shared()->set_length(length); - return isolate->heap()->undefined_value(); -} - - RUNTIME_FUNCTION(Runtime_FunctionIsAPIFunction) { SealHandleScope shs(isolate); DCHECK_EQ(1, args.length()); @@ -156,10 +145,10 @@ RUNTIME_FUNCTION(Runtime_SetCode) { Handle<Context> context(source->context()); target->set_context(*context); - // Make sure we get a fresh copy of the literal vector to avoid cross - // context contamination, and that the literal vector makes it's way into + // Make sure we get a fresh copy of the feedback vector to avoid cross + // context contamination, and that the feedback vector makes it's way into // the target_shared optimized code map. - JSFunction::EnsureLiterals(target); + JSFunction::EnsureFeedbackVector(target); if (isolate->logger()->is_logging_code_events() || isolate->is_profiling()) { isolate->logger()->LogExistingFunction( diff --git a/chromium/v8/src/runtime/runtime-generator.cc b/chromium/v8/src/runtime/runtime-generator.cc index 9323d236bc2..a7d14b839e2 100644 --- a/chromium/v8/src/runtime/runtime-generator.cc +++ b/chromium/v8/src/runtime/runtime-generator.cc @@ -11,6 +11,12 @@ namespace v8 { namespace internal { +RUNTIME_FUNCTION(Runtime_IsJSGeneratorObject) { + SealHandleScope shs(isolate); + DCHECK_EQ(1, args.length()); + return isolate->heap()->ToBoolean(args[0]->IsJSGeneratorObject()); +} + RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) { HandleScope scope(isolate); DCHECK_EQ(2, args.length()); @@ -30,6 +36,9 @@ RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) { generator->set_receiver(*receiver); generator->set_register_file(*register_file); generator->set_continuation(JSGeneratorObject::kGeneratorExecuting); + if (generator->IsJSAsyncGeneratorObject()) { + Handle<JSAsyncGeneratorObject>::cast(generator)->set_is_awaiting(0); + } return *generator; } @@ -55,13 +64,31 @@ RUNTIME_FUNCTION(Runtime_GeneratorGetReceiver) { return generator->receiver(); } -RUNTIME_FUNCTION(Runtime_GeneratorGetContext) { +RUNTIME_FUNCTION(Runtime_GeneratorGetInputOrDebugPos) { // Runtime call is implemented in InterpreterIntrinsics and lowered in // JSIntrinsicLowering UNREACHABLE(); } -RUNTIME_FUNCTION(Runtime_GeneratorGetInputOrDebugPos) { +RUNTIME_FUNCTION(Runtime_AsyncFunctionAwaitCaught) { + // Runtime call is implemented in InterpreterIntrinsics and lowered in + // JSIntrinsicLowering + UNREACHABLE(); +} + +RUNTIME_FUNCTION(Runtime_AsyncFunctionAwaitUncaught) { + // Runtime call is implemented in InterpreterIntrinsics and lowered in + // JSIntrinsicLowering + UNREACHABLE(); +} + +RUNTIME_FUNCTION(Runtime_AsyncGeneratorAwaitCaught) { + // Runtime call is implemented in InterpreterIntrinsics and lowered in + // JSIntrinsicLowering + UNREACHABLE(); +} + +RUNTIME_FUNCTION(Runtime_AsyncGeneratorAwaitUncaught) { // Runtime call is implemented in InterpreterIntrinsics and lowered in // JSIntrinsicLowering UNREACHABLE(); @@ -126,12 +153,11 @@ RUNTIME_FUNCTION(Runtime_AsyncGeneratorHasCatchHandlerForPC) { SharedFunctionInfo* shared = generator->function()->shared(); DCHECK(shared->HasBytecodeArray()); - HandlerTable* handler_table = - HandlerTable::cast(shared->bytecode_array()->handler_table()); + HandlerTable handler_table(shared->bytecode_array()); int pc = Smi::cast(generator->input_or_debug_pos())->value(); HandlerTable::CatchPrediction catch_prediction = HandlerTable::ASYNC_AWAIT; - handler_table->LookupRange(pc, nullptr, &catch_prediction); + handler_table.LookupRange(pc, nullptr, &catch_prediction); return isolate->heap()->ToBoolean(catch_prediction == HandlerTable::CAUGHT); } diff --git a/chromium/v8/src/runtime/runtime-internal.cc b/chromium/v8/src/runtime/runtime-internal.cc index f9e93755430..a24ded7e217 100644 --- a/chromium/v8/src/runtime/runtime-internal.cc +++ b/chromium/v8/src/runtime/runtime-internal.cc @@ -30,6 +30,12 @@ RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) { return isolate->heap()->undefined_value(); } +RUNTIME_FUNCTION(Runtime_IsScriptWrapper) { + SealHandleScope shs(isolate); + DCHECK_EQ(1, args.length()); + return isolate->heap()->ToBoolean(args[0]->IsScriptWrapper()); +} + RUNTIME_FUNCTION(Runtime_ExportFromRuntime) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); @@ -206,30 +212,6 @@ RUNTIME_FUNCTION(Runtime_NewSyntaxError) { return *isolate->factory()->NewSyntaxError(message_template, arg0); } -RUNTIME_FUNCTION(Runtime_ThrowCannotConvertToPrimitive) { - HandleScope scope(isolate); - THROW_NEW_ERROR_RETURN_FAILURE( - isolate, NewTypeError(MessageTemplate::kCannotConvertToPrimitive)); -} - -RUNTIME_FUNCTION(Runtime_ThrowIncompatibleMethodReceiver) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, arg1, 1); - THROW_NEW_ERROR_RETURN_FAILURE( - isolate, - NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, arg0, arg1)); -} - -RUNTIME_FUNCTION(Runtime_ThrowInvalidHint) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, hint, 0); - THROW_NEW_ERROR_RETURN_FAILURE( - isolate, NewTypeError(MessageTemplate::kInvalidHint, hint)); -} - RUNTIME_FUNCTION(Runtime_ThrowInvalidStringLength) { HandleScope scope(isolate); THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewInvalidStringLengthError()); @@ -258,18 +240,6 @@ RUNTIME_FUNCTION(Runtime_ThrowSymbolIteratorInvalid) { isolate, NewTypeError(MessageTemplate::kSymbolIteratorInvalid)); } -RUNTIME_FUNCTION(Runtime_ThrowNonCallableInInstanceOfCheck) { - HandleScope scope(isolate); - THROW_NEW_ERROR_RETURN_FAILURE( - isolate, NewTypeError(MessageTemplate::kNonCallableInInstanceOfCheck)); -} - -RUNTIME_FUNCTION(Runtime_ThrowNonObjectInInstanceOfCheck) { - HandleScope scope(isolate); - THROW_NEW_ERROR_RETURN_FAILURE( - isolate, NewTypeError(MessageTemplate::kNonObjectInInstanceOfCheck)); -} - RUNTIME_FUNCTION(Runtime_ThrowNotConstructor) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); @@ -278,13 +248,6 @@ RUNTIME_FUNCTION(Runtime_ThrowNotConstructor) { isolate, NewTypeError(MessageTemplate::kNotConstructor, object)); } -RUNTIME_FUNCTION(Runtime_ThrowGeneratorRunning) { - HandleScope scope(isolate); - DCHECK_EQ(0, args.length()); - THROW_NEW_ERROR_RETURN_FAILURE( - isolate, NewTypeError(MessageTemplate::kGeneratorRunning)); -} - RUNTIME_FUNCTION(Runtime_ThrowApplyNonFunction) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); @@ -454,14 +417,6 @@ RUNTIME_FUNCTION(Runtime_ThrowCalledNonCallable) { THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewTypeError(id, callsite)); } -RUNTIME_FUNCTION(Runtime_ThrowCalledOnNullOrUndefined) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(String, name, 0); - THROW_NEW_ERROR_RETURN_FAILURE( - isolate, NewTypeError(MessageTemplate::kCalledOnNullOrUndefined, name)); -} - RUNTIME_FUNCTION(Runtime_ThrowConstructedNonConstructable) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); @@ -486,14 +441,6 @@ RUNTIME_FUNCTION(Runtime_ThrowConstructorReturnedNonObject) { NewTypeError(MessageTemplate::kDerivedConstructorReturnedNonObject)); } -RUNTIME_FUNCTION(Runtime_ThrowUndefinedOrNullToObject) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(String, name, 0); - THROW_NEW_ERROR_RETURN_FAILURE( - isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject, name)); -} - // ES6 section 7.3.17 CreateListFromArrayLike (obj) RUNTIME_FUNCTION(Runtime_CreateListFromArrayLike) { HandleScope scope(isolate); @@ -526,10 +473,6 @@ RUNTIME_FUNCTION(Runtime_DeserializeLazy) { DCHECK(Builtins::IsLazy(builtin_id)); DCHECK_EQ(Builtins::TFJ, Builtins::KindOf(builtin_id)); - if (FLAG_trace_lazy_deserialization) { - PrintF("Lazy-deserializing builtin %s\n", Builtins::name(builtin_id)); - } - Code* code = Snapshot::DeserializeBuiltin(isolate, builtin_id); DCHECK_EQ(builtin_id, code->builtin_index()); DCHECK_EQ(code, isolate->builtins()->builtin(builtin_id)); @@ -638,17 +581,21 @@ RUNTIME_FUNCTION(Runtime_CreateAsyncFromSyncIterator) { isolate, NewTypeError(MessageTemplate::kSymbolIteratorInvalid)); } + Handle<Object> next; + ASSIGN_RETURN_FAILURE_ON_EXCEPTION( + isolate, next, + Object::GetProperty(sync_iterator, isolate->factory()->next_string())); + return *isolate->factory()->NewJSAsyncFromSyncIterator( - Handle<JSReceiver>::cast(sync_iterator)); + Handle<JSReceiver>::cast(sync_iterator), next); } -RUNTIME_FUNCTION(Runtime_GetTemplateObject) { +RUNTIME_FUNCTION(Runtime_CreateTemplateObject) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); CONVERT_ARG_HANDLE_CHECKED(TemplateObjectDescription, description, 0); - return *TemplateObjectDescription::GetTemplateObject( - description, isolate->native_context()); + return *TemplateObjectDescription::CreateTemplateObject(description); } RUNTIME_FUNCTION(Runtime_ReportMessage) { diff --git a/chromium/v8/src/runtime/runtime-interpreter.cc b/chromium/v8/src/runtime/runtime-interpreter.cc index b65a2327a35..836bf4d5f6b 100644 --- a/chromium/v8/src/runtime/runtime-interpreter.cc +++ b/chromium/v8/src/runtime/runtime-interpreter.cc @@ -41,21 +41,6 @@ RUNTIME_FUNCTION(Runtime_InterpreterDeserializeLazy) { bytecode, operand_scale); } -RUNTIME_FUNCTION(Runtime_InterpreterNewClosure) { - HandleScope scope(isolate); - DCHECK_EQ(4, args.length()); - CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); - CONVERT_ARG_HANDLE_CHECKED(FeedbackVector, vector, 1); - CONVERT_SMI_ARG_CHECKED(index, 2); - CONVERT_SMI_ARG_CHECKED(pretenured_flag, 3); - Handle<Context> context(isolate->context(), isolate); - FeedbackSlot slot = FeedbackVector::ToSlot(index); - Handle<Cell> vector_cell(Cell::cast(vector->Get(slot)), isolate); - return *isolate->factory()->NewFunctionFromSharedFunctionInfo( - shared, context, vector_cell, - static_cast<PretenureFlag>(pretenured_flag)); -} - #ifdef V8_TRACE_IGNITION namespace { diff --git a/chromium/v8/src/runtime/runtime-intl.cc b/chromium/v8/src/runtime/runtime-intl.cc index c4f132b1340..a0e0db8cd04 100644 --- a/chromium/v8/src/runtime/runtime-intl.cc +++ b/chromium/v8/src/runtime/runtime-intl.cc @@ -15,6 +15,7 @@ #include "src/api.h" #include "src/arguments.h" #include "src/factory.h" +#include "src/global-handles.h" #include "src/intl.h" #include "src/isolate-inl.h" #include "src/messages.h" diff --git a/chromium/v8/src/runtime/runtime-module.cc b/chromium/v8/src/runtime/runtime-module.cc index a9fb48f8872..a7580503061 100644 --- a/chromium/v8/src/runtime/runtime-module.cc +++ b/chromium/v8/src/runtime/runtime-module.cc @@ -37,24 +37,6 @@ RUNTIME_FUNCTION(Runtime_GetModuleNamespace) { return *Module::GetModuleNamespace(module, module_request); } -RUNTIME_FUNCTION(Runtime_LoadModuleVariable) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_SMI_ARG_CHECKED(index, 0); - Handle<Module> module(isolate->context()->module()); - return *Module::LoadVariable(module, index); -} - -RUNTIME_FUNCTION(Runtime_StoreModuleVariable) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_SMI_ARG_CHECKED(index, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); - Handle<Module> module(isolate->context()->module()); - Module::StoreVariable(module, index, value); - return isolate->heap()->undefined_value(); -} - RUNTIME_FUNCTION(Runtime_GetImportMetaObject) { HandleScope scope(isolate); DCHECK_EQ(0, args.length()); diff --git a/chromium/v8/src/runtime/runtime-object.cc b/chromium/v8/src/runtime/runtime-object.cc index 057ead94078..90dddab2117 100644 --- a/chromium/v8/src/runtime/runtime-object.cc +++ b/chromium/v8/src/runtime/runtime-object.cc @@ -34,6 +34,14 @@ MaybeHandle<Object> Runtime::GetObjectProperty(Isolate* isolate, MaybeHandle<Object> result = Object::GetProperty(&it); if (is_found_out) *is_found_out = it.IsFound(); + + if (!it.IsFound() && key->IsSymbol() && + Symbol::cast(*key)->is_private_field()) { + THROW_NEW_ERROR( + isolate, + NewTypeError(MessageTemplate::kInvalidPrivateFieldAccess, key, object), + Object); + } return result; } @@ -390,6 +398,14 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate, LookupIterator::PropertyOrElement(isolate, object, key, &success); if (!success) return MaybeHandle<Object>(); + if (!it.IsFound() && key->IsSymbol() && + Symbol::cast(*key)->is_private_field()) { + THROW_NEW_ERROR( + isolate, + NewTypeError(MessageTemplate::kInvalidPrivateFieldAccess, key, object), + Object); + } + MAYBE_RETURN_NULL(Object::SetProperty(&it, value, language_mode, Object::MAY_BE_STORE_FROM_KEYED)); return value; @@ -439,6 +455,61 @@ RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) { return *object; } +RUNTIME_FUNCTION(Runtime_ObjectValues) { + HandleScope scope(isolate); + DCHECK_EQ(1, args.length()); + + CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); + + Handle<FixedArray> values; + ASSIGN_RETURN_FAILURE_ON_EXCEPTION( + isolate, values, + JSReceiver::GetOwnValues(receiver, PropertyFilter::ENUMERABLE_STRINGS, + true)); + return *isolate->factory()->NewJSArrayWithElements(values); +} + +RUNTIME_FUNCTION(Runtime_ObjectValuesSkipFastPath) { + HandleScope scope(isolate); + DCHECK_EQ(1, args.length()); + + CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); + + Handle<FixedArray> value; + ASSIGN_RETURN_FAILURE_ON_EXCEPTION( + isolate, value, + JSReceiver::GetOwnValues(receiver, PropertyFilter::ENUMERABLE_STRINGS, + false)); + return *isolate->factory()->NewJSArrayWithElements(value); +} + +RUNTIME_FUNCTION(Runtime_ObjectEntries) { + HandleScope scope(isolate); + DCHECK_EQ(1, args.length()); + + CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); + + Handle<FixedArray> entries; + ASSIGN_RETURN_FAILURE_ON_EXCEPTION( + isolate, entries, + JSReceiver::GetOwnEntries(receiver, PropertyFilter::ENUMERABLE_STRINGS, + true)); + return *isolate->factory()->NewJSArrayWithElements(entries); +} + +RUNTIME_FUNCTION(Runtime_ObjectEntriesSkipFastPath) { + HandleScope scope(isolate); + DCHECK_EQ(1, args.length()); + + CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); + + Handle<FixedArray> entries; + ASSIGN_RETURN_FAILURE_ON_EXCEPTION( + isolate, entries, + JSReceiver::GetOwnEntries(receiver, PropertyFilter::ENUMERABLE_STRINGS, + false)); + return *isolate->factory()->NewJSArrayWithElements(entries); +} RUNTIME_FUNCTION(Runtime_GetProperty) { HandleScope scope(isolate); @@ -687,26 +758,6 @@ RUNTIME_FUNCTION(Runtime_CompleteInobjectSlackTrackingForMap) { } -RUNTIME_FUNCTION(Runtime_LoadMutableDouble) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); - CONVERT_ARG_HANDLE_CHECKED(Smi, index, 1); - CHECK_EQ(index->value() & 1, 1); - FieldIndex field_index = - FieldIndex::ForLoadByFieldIndex(object->map(), index->value()); - if (field_index.is_inobject()) { - CHECK(field_index.property_index() < - object->map()->GetInObjectProperties()); - } else { - CHECK(field_index.outobject_array_index() < - object->property_dictionary()->length()); - } - return *JSObject::FastPropertyAt(object, Representation::Double(), - field_index); -} - - RUNTIME_FUNCTION(Runtime_TryMigrateInstance) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); @@ -724,13 +775,6 @@ RUNTIME_FUNCTION(Runtime_TryMigrateInstance) { } -RUNTIME_FUNCTION(Runtime_IsJSGlobalProxy) { - SealHandleScope shs(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_CHECKED(Object, obj, 0); - return isolate->heap()->ToBoolean(obj->IsJSGlobalProxy()); -} - static bool IsValidAccessor(Isolate* isolate, Handle<Object> obj) { return obj->IsNullOrUndefined(isolate) || obj->IsCallable(); } @@ -770,10 +814,11 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) { CONVERT_ARG_HANDLE_CHECKED(FeedbackVector, vector, 4); CONVERT_SMI_ARG_CHECKED(index, 5); - StoreDataPropertyInLiteralICNexus nexus(vector, vector->ToSlot(index)); + FeedbackNexus nexus(vector, FeedbackVector::ToSlot(index)); if (nexus.ic_state() == UNINITIALIZED) { if (name->IsUniqueName()) { - nexus.ConfigureMonomorphic(name, handle(object->map())); + nexus.ConfigureMonomorphic(name, handle(object->map()), + Handle<Code>::null()); } else { nexus.ConfigureMegamorphic(PROPERTY); } @@ -833,31 +878,12 @@ RUNTIME_FUNCTION(Runtime_CollectTypeProfile) { } DCHECK(vector->metadata()->HasTypeProfileSlot()); - CollectTypeProfileNexus nexus(vector, vector->GetTypeProfileSlot()); + FeedbackNexus nexus(vector, vector->GetTypeProfileSlot()); nexus.Collect(type, position->value()); return isolate->heap()->undefined_value(); } -// Return property without being observable by accessors or interceptors. -RUNTIME_FUNCTION(Runtime_GetDataProperty) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); - CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); - return *JSReceiver::GetDataProperty(object, name); -} - -RUNTIME_FUNCTION(Runtime_GetConstructorName) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); - - CHECK(!object->IsNullOrUndefined(isolate)); - Handle<JSReceiver> recv = Object::ToObject(isolate, object).ToHandleChecked(); - return *JSReceiver::GetConstructorName(recv); -} - RUNTIME_FUNCTION(Runtime_HasFastPackedElements) { SealHandleScope shs(isolate); DCHECK_EQ(1, args.length()); @@ -1175,9 +1201,13 @@ RUNTIME_FUNCTION(Runtime_CreateDataProperty) { RUNTIME_FUNCTION(Runtime_IterableToListCanBeElided) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); + CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0); - if (!obj->IsJSObject()) return isolate->heap()->ToBoolean(false); + // If an iterator symbol is added to the Number prototype, we could see a Smi. + if (obj->IsSmi()) return isolate->heap()->ToBoolean(false); + if (!HeapObject::cast(*obj)->IsJSObject()) { + return isolate->heap()->ToBoolean(false); + } // While iteration alone may not have observable side-effects, calling // toNumber on an object will. Make sure the arg is not an array of objects. @@ -1203,5 +1233,27 @@ RUNTIME_FUNCTION(Runtime_GetOwnPropertyDescriptor) { return *desc.ToPropertyDescriptorObject(isolate); } +RUNTIME_FUNCTION(Runtime_AddPrivateField) { + HandleScope scope(isolate); + DCHECK_EQ(3, args.length()); + CONVERT_ARG_HANDLE_CHECKED(JSReceiver, o, 0); + CONVERT_ARG_HANDLE_CHECKED(Symbol, key, 1); + CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); + DCHECK(key->is_private_field()); + + LookupIterator it = + LookupIterator::PropertyOrElement(isolate, o, key, LookupIterator::OWN); + + if (it.IsFound()) { + THROW_NEW_ERROR_RETURN_FAILURE( + isolate, NewTypeError(MessageTemplate::kVarRedeclaration, key)); + } + + CHECK(Object::AddDataProperty(&it, value, NONE, kDontThrow, + Object::MAY_BE_STORE_FROM_KEYED) + .FromJust()); + return isolate->heap()->undefined_value(); +} + } // namespace internal } // namespace v8 diff --git a/chromium/v8/src/runtime/runtime-operators.cc b/chromium/v8/src/runtime/runtime-operators.cc index 42a7e21b828..d01d1158924 100644 --- a/chromium/v8/src/runtime/runtime-operators.cc +++ b/chromium/v8/src/runtime/runtime-operators.cc @@ -9,33 +9,6 @@ namespace v8 { namespace internal { -RUNTIME_FUNCTION(Runtime_Multiply) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); - RETURN_RESULT_OR_FAILURE(isolate, Object::Multiply(isolate, lhs, rhs)); -} - - -RUNTIME_FUNCTION(Runtime_Divide) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); - RETURN_RESULT_OR_FAILURE(isolate, Object::Divide(isolate, lhs, rhs)); -} - - -RUNTIME_FUNCTION(Runtime_Modulus) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); - RETURN_RESULT_OR_FAILURE(isolate, Object::Modulus(isolate, lhs, rhs)); -} - - RUNTIME_FUNCTION(Runtime_Add) { HandleScope scope(isolate); DCHECK_EQ(2, args.length()); @@ -45,69 +18,6 @@ RUNTIME_FUNCTION(Runtime_Add) { } -RUNTIME_FUNCTION(Runtime_Subtract) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); - RETURN_RESULT_OR_FAILURE(isolate, Object::Subtract(isolate, lhs, rhs)); -} - - -RUNTIME_FUNCTION(Runtime_ShiftLeft) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); - RETURN_RESULT_OR_FAILURE(isolate, Object::ShiftLeft(isolate, lhs, rhs)); -} - - -RUNTIME_FUNCTION(Runtime_ShiftRight) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); - RETURN_RESULT_OR_FAILURE(isolate, Object::ShiftRight(isolate, lhs, rhs)); -} - - -RUNTIME_FUNCTION(Runtime_ShiftRightLogical) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); - RETURN_RESULT_OR_FAILURE(isolate, - Object::ShiftRightLogical(isolate, lhs, rhs)); -} - - -RUNTIME_FUNCTION(Runtime_BitwiseAnd) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); - RETURN_RESULT_OR_FAILURE(isolate, Object::BitwiseAnd(isolate, lhs, rhs)); -} - - -RUNTIME_FUNCTION(Runtime_BitwiseOr) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); - RETURN_RESULT_OR_FAILURE(isolate, Object::BitwiseOr(isolate, lhs, rhs)); -} - - -RUNTIME_FUNCTION(Runtime_BitwiseXor) { - HandleScope scope(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1); - RETURN_RESULT_OR_FAILURE(isolate, Object::BitwiseXor(isolate, lhs, rhs)); -} - RUNTIME_FUNCTION(Runtime_Equal) { HandleScope scope(isolate); DCHECK_EQ(2, args.length()); @@ -184,14 +94,5 @@ RUNTIME_FUNCTION(Runtime_GreaterThanOrEqual) { return isolate->heap()->ToBoolean(result.FromJust()); } -RUNTIME_FUNCTION(Runtime_InstanceOf) { - HandleScope shs(isolate); - DCHECK_EQ(2, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, callable, 1); - RETURN_RESULT_OR_FAILURE(isolate, - Object::InstanceOf(isolate, object, callable)); -} - } // namespace internal } // namespace v8 diff --git a/chromium/v8/src/runtime/runtime-promise.cc b/chromium/v8/src/runtime/runtime-promise.cc index 2c28cd3c983..2d3a4fda50d 100644 --- a/chromium/v8/src/runtime/runtime-promise.cc +++ b/chromium/v8/src/runtime/runtime-promise.cc @@ -1,8 +1,10 @@ // Copyright 2016 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. + #include "src/runtime/runtime-utils.h" +#include "src/api.h" #include "src/arguments.h" #include "src/counters.h" #include "src/debug/debug.h" @@ -12,27 +14,6 @@ namespace v8 { namespace internal { -namespace { - -void PromiseRejectEvent(Isolate* isolate, Handle<JSPromise> promise, - Handle<Object> rejected_promise, Handle<Object> value, - bool debug_event) { - isolate->RunPromiseHook(PromiseHookType::kResolve, promise, - isolate->factory()->undefined_value()); - - if (isolate->debug()->is_active() && debug_event) { - isolate->debug()->OnPromiseReject(rejected_promise, value); - } - - // Report only if we don't actually have a handler. - if (!promise->has_handler()) { - isolate->ReportPromiseReject(promise, value, - v8::kPromiseRejectWithNoHandler); - } -} - -} // namespace - RUNTIME_FUNCTION(Runtime_PromiseRejectEventFromStack) { DCHECK_EQ(2, args.length()); HandleScope scope(isolate); @@ -41,21 +22,19 @@ RUNTIME_FUNCTION(Runtime_PromiseRejectEventFromStack) { Handle<Object> rejected_promise = promise; if (isolate->debug()->is_active()) { - // If the Promise.reject call is caught, then this will return - // undefined, which will be interpreted by PromiseRejectEvent - // as being a caught exception event. + // If the Promise.reject() call is caught, then this will return + // undefined, which we interpret as being a caught exception event. rejected_promise = isolate->GetPromiseOnStackOnThrow(); } - PromiseRejectEvent(isolate, promise, rejected_promise, value, true); - return isolate->heap()->undefined_value(); -} + isolate->RunPromiseHook(PromiseHookType::kResolve, promise, + isolate->factory()->undefined_value()); + isolate->debug()->OnPromiseReject(rejected_promise, value); -RUNTIME_FUNCTION(Runtime_ReportPromiseReject) { - DCHECK_EQ(2, args.length()); - HandleScope scope(isolate); - CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); - CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); - isolate->ReportPromiseReject(promise, value, v8::kPromiseRejectWithNoHandler); + // Report only if we don't actually have a handler. + if (!promise->has_handler()) { + isolate->ReportPromiseReject(promise, value, + v8::kPromiseRejectWithNoHandler); + } return isolate->heap()->undefined_value(); } @@ -73,7 +52,9 @@ RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) { RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(JSFunction, microtask, 0); + CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); + Handle<CallableTask> microtask = + isolate->factory()->NewCallableTask(function, isolate->native_context()); isolate->EnqueueMicrotask(microtask); return isolate->heap()->undefined_value(); } @@ -85,6 +66,17 @@ RUNTIME_FUNCTION(Runtime_RunMicrotasks) { return isolate->heap()->undefined_value(); } +RUNTIME_FUNCTION(Runtime_RunMicrotaskCallback) { + HandleScope scope(isolate); + DCHECK_EQ(2, args.length()); + CONVERT_ARG_CHECKED(Object, microtask_callback, 0); + CONVERT_ARG_CHECKED(Object, microtask_data, 1); + MicrotaskCallback callback = ToCData<MicrotaskCallback>(microtask_callback); + void* data = ToCData<void*>(microtask_data); + callback(data); + return isolate->heap()->undefined_value(); +} + RUNTIME_FUNCTION(Runtime_PromiseStatus) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); @@ -118,23 +110,17 @@ RUNTIME_FUNCTION(Runtime_PromiseHookInit) { return isolate->heap()->undefined_value(); } -RUNTIME_FUNCTION(Runtime_PromiseHookResolve) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); - isolate->RunPromiseHook(PromiseHookType::kResolve, promise, - isolate->factory()->undefined_value()); - return isolate->heap()->undefined_value(); -} - RUNTIME_FUNCTION(Runtime_PromiseHookBefore) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); - if (promise->IsJSPromise()) { - isolate->RunPromiseHook(PromiseHookType::kBefore, - Handle<JSPromise>::cast(promise), - isolate->factory()->undefined_value()); + CONVERT_ARG_HANDLE_CHECKED(HeapObject, payload, 0); + Handle<JSPromise> promise; + if (JSPromise::From(payload).ToHandle(&promise)) { + if (isolate->debug()->is_active()) isolate->PushPromise(promise); + if (promise->IsJSPromise()) { + isolate->RunPromiseHook(PromiseHookType::kBefore, promise, + isolate->factory()->undefined_value()); + } } return isolate->heap()->undefined_value(); } @@ -142,14 +128,37 @@ RUNTIME_FUNCTION(Runtime_PromiseHookBefore) { RUNTIME_FUNCTION(Runtime_PromiseHookAfter) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); - if (promise->IsJSPromise()) { - isolate->RunPromiseHook(PromiseHookType::kAfter, - Handle<JSPromise>::cast(promise), - isolate->factory()->undefined_value()); + CONVERT_ARG_HANDLE_CHECKED(HeapObject, payload, 0); + Handle<JSPromise> promise; + if (JSPromise::From(payload).ToHandle(&promise)) { + if (isolate->debug()->is_active()) isolate->PopPromise(); + if (promise->IsJSPromise()) { + isolate->RunPromiseHook(PromiseHookType::kAfter, promise, + isolate->factory()->undefined_value()); + } } return isolate->heap()->undefined_value(); } +RUNTIME_FUNCTION(Runtime_RejectPromise) { + HandleScope scope(isolate); + DCHECK_EQ(3, args.length()); + CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); + CONVERT_ARG_HANDLE_CHECKED(Object, reason, 1); + CONVERT_ARG_HANDLE_CHECKED(Oddball, debug_event, 2); + return *JSPromise::Reject(promise, reason, debug_event->BooleanValue()); +} + +RUNTIME_FUNCTION(Runtime_ResolvePromise) { + HandleScope scope(isolate); + DCHECK_EQ(2, args.length()); + CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); + CONVERT_ARG_HANDLE_CHECKED(Object, resolution, 1); + Handle<Object> result; + ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, + JSPromise::Resolve(promise, resolution)); + return *result; +} + } // namespace internal } // namespace v8 diff --git a/chromium/v8/src/runtime/runtime-regexp.cc b/chromium/v8/src/runtime/runtime-regexp.cc index d0afcd26360..920f37cf98d 100644 --- a/chromium/v8/src/runtime/runtime-regexp.cc +++ b/chromium/v8/src/runtime/runtime-regexp.cc @@ -1920,14 +1920,6 @@ RUNTIME_FUNCTION(Runtime_RegExpReplace) { RETURN_RESULT_OR_FAILURE(isolate, builder.Finish()); } -RUNTIME_FUNCTION(Runtime_RegExpExecReThrow) { - SealHandleScope shs(isolate); - DCHECK_EQ(0, args.length()); - Object* exception = isolate->pending_exception(); - isolate->clear_pending_exception(); - return isolate->ReThrow(exception); -} - RUNTIME_FUNCTION(Runtime_RegExpInitializeAndCompile) { HandleScope scope(isolate); DCHECK_EQ(3, args.length()); diff --git a/chromium/v8/src/runtime/runtime-scopes.cc b/chromium/v8/src/runtime/runtime-scopes.cc index 76f291f90f8..3d2d7940a43 100644 --- a/chromium/v8/src/runtime/runtime-scopes.cc +++ b/chromium/v8/src/runtime/runtime-scopes.cc @@ -123,7 +123,7 @@ Object* DeclareGlobal( // named interceptor or the interceptor is not masking. if (!global->HasNamedInterceptor() || global->GetNamedInterceptor()->non_masking()) { - LoadGlobalICNexus nexus(feedback_vector, slot); + FeedbackNexus nexus(feedback_vector, slot); nexus.ConfigurePropertyCellMode(it.GetPropertyCell()); } } @@ -141,7 +141,8 @@ Object* DeclareGlobals(Isolate* isolate, Handle<FixedArray> declarations, FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < length, i += 4, { Handle<String> name(String::cast(declarations->get(i)), isolate); FeedbackSlot slot(Smi::ToInt(declarations->get(i + 1))); - Handle<Object> possibly_literal_slot(declarations->get(i + 2), isolate); + Handle<Object> possibly_feedback_cell_slot(declarations->get(i + 2), + isolate); Handle<Object> initial_value(declarations->get(i + 3), isolate); bool is_var = initial_value->IsUndefined(isolate); @@ -150,16 +151,18 @@ Object* DeclareGlobals(Isolate* isolate, Handle<FixedArray> declarations, Handle<Object> value; if (is_function) { - DCHECK(possibly_literal_slot->IsSmi()); + DCHECK(possibly_feedback_cell_slot->IsSmi()); // Copy the function and update its context. Use it as value. Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo>::cast(initial_value); - FeedbackSlot literals_slot(Smi::ToInt(*possibly_literal_slot)); - Handle<Cell> literals(Cell::cast(feedback_vector->Get(literals_slot)), - isolate); + FeedbackSlot feedback_cells_slot( + Smi::ToInt(*possibly_feedback_cell_slot)); + Handle<FeedbackCell> feedback_cell( + FeedbackCell::cast(feedback_vector->Get(feedback_cells_slot)), + isolate); Handle<JSFunction> function = isolate->factory()->NewFunctionFromSharedFunctionInfo( - shared, context, literals, TENURED); + shared, context, feedback_cell, TENURED); value = function; } else { value = isolate->factory()->undefined_value(); @@ -635,34 +638,27 @@ RUNTIME_FUNCTION(Runtime_NewArgumentsElements) { RUNTIME_FUNCTION(Runtime_NewClosure) { HandleScope scope(isolate); - DCHECK_EQ(3, args.length()); + DCHECK_EQ(2, args.length()); CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); - CONVERT_ARG_HANDLE_CHECKED(FeedbackVector, vector, 1); - CONVERT_SMI_ARG_CHECKED(index, 2); + CONVERT_ARG_HANDLE_CHECKED(FeedbackCell, feedback_cell, 1); Handle<Context> context(isolate->context(), isolate); - FeedbackSlot slot = FeedbackVector::ToSlot(index); - Handle<Cell> vector_cell(Cell::cast(vector->Get(slot)), isolate); Handle<JSFunction> function = isolate->factory()->NewFunctionFromSharedFunctionInfo( - shared, context, vector_cell, NOT_TENURED); + shared, context, feedback_cell, NOT_TENURED); return *function; } - RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) { HandleScope scope(isolate); - DCHECK_EQ(3, args.length()); + DCHECK_EQ(2, args.length()); CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); - CONVERT_ARG_HANDLE_CHECKED(FeedbackVector, vector, 1); - CONVERT_SMI_ARG_CHECKED(index, 2); + CONVERT_ARG_HANDLE_CHECKED(FeedbackCell, feedback_cell, 1); Handle<Context> context(isolate->context(), isolate); - FeedbackSlot slot = FeedbackVector::ToSlot(index); - Handle<Cell> vector_cell(Cell::cast(vector->Get(slot)), isolate); // The caller ensures that we pretenure closures that are assigned // directly to properties. Handle<JSFunction> function = isolate->factory()->NewFunctionFromSharedFunctionInfo( - shared, context, vector_cell, TENURED); + shared, context, feedback_cell, TENURED); return *function; } diff --git a/chromium/v8/src/runtime/runtime-strings.cc b/chromium/v8/src/runtime/runtime-strings.cc index 8f6b887f62b..6f203b3d012 100644 --- a/chromium/v8/src/runtime/runtime-strings.cc +++ b/chromium/v8/src/runtime/runtime-strings.cc @@ -216,35 +216,16 @@ RUNTIME_FUNCTION(Runtime_StringLastIndexOf) { isolate->factory()->undefined_value()); } -RUNTIME_FUNCTION(Runtime_SubString) { +RUNTIME_FUNCTION(Runtime_StringSubstring) { HandleScope scope(isolate); DCHECK_EQ(3, args.length()); - CONVERT_ARG_HANDLE_CHECKED(String, string, 0); - int start, end; - // We have a fast integer-only case here to avoid a conversion to double in - // the common case where from and to are Smis. - if (args[1]->IsSmi() && args[2]->IsSmi()) { - CONVERT_SMI_ARG_CHECKED(from_number, 1); - CONVERT_SMI_ARG_CHECKED(to_number, 2); - start = from_number; - end = to_number; - } else if (args[1]->IsNumber() && args[2]->IsNumber()) { - CONVERT_DOUBLE_ARG_CHECKED(from_number, 1); - CONVERT_DOUBLE_ARG_CHECKED(to_number, 2); - start = FastD2IChecked(from_number); - end = FastD2IChecked(to_number); - } else { - return isolate->ThrowIllegalOperation(); - } - // The following condition is intentionally robust because the SubString - // builtin delegates here and we test this in - // cctest/test-strings/RobustSubStringStub. - if (end < start || start < 0 || end > string->length()) { - return isolate->ThrowIllegalOperation(); - } + CONVERT_INT32_ARG_CHECKED(start, 1); + CONVERT_INT32_ARG_CHECKED(end, 2); + DCHECK_LE(0, start); + DCHECK_LE(start, end); + DCHECK_LE(end, string->length()); isolate->counters()->sub_string_runtime()->Increment(); - return *isolate->factory()->NewSubString(string, start, end); } diff --git a/chromium/v8/src/runtime/runtime-symbol.cc b/chromium/v8/src/runtime/runtime-symbol.cc index 2eaef63bbf2..488aa756c6e 100644 --- a/chromium/v8/src/runtime/runtime-symbol.cc +++ b/chromium/v8/src/runtime/runtime-symbol.cc @@ -12,28 +12,25 @@ namespace v8 { namespace internal { -RUNTIME_FUNCTION(Runtime_CreateSymbol) { +RUNTIME_FUNCTION(Runtime_CreatePrivateSymbol) { HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); - CHECK(name->IsString() || name->IsUndefined(isolate)); - Handle<Symbol> symbol = isolate->factory()->NewSymbol(); - if (name->IsString()) symbol->set_name(*name); + DCHECK_GE(1, args.length()); + Handle<Symbol> symbol = isolate->factory()->NewPrivateSymbol(); + if (args.length() == 1) { + CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); + CHECK(name->IsString() || name->IsUndefined(isolate)); + if (name->IsString()) symbol->set_name(*name); + } return *symbol; } - -RUNTIME_FUNCTION(Runtime_CreatePrivateSymbol) { +RUNTIME_FUNCTION(Runtime_CreatePrivateFieldSymbol) { HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); - CHECK(name->IsString() || name->IsUndefined(isolate)); - Handle<Symbol> symbol = isolate->factory()->NewPrivateSymbol(); - if (name->IsString()) symbol->set_name(*name); + DCHECK_EQ(0, args.length()); + Handle<Symbol> symbol = isolate->factory()->NewPrivateFieldSymbol(); return *symbol; } - RUNTIME_FUNCTION(Runtime_SymbolDescription) { SealHandleScope shs(isolate); DCHECK_EQ(1, args.length()); diff --git a/chromium/v8/src/runtime/runtime-test.cc b/chromium/v8/src/runtime/runtime-test.cc index 01e2b198a64..6b2f3467fc1 100644 --- a/chromium/v8/src/runtime/runtime-test.cc +++ b/chromium/v8/src/runtime/runtime-test.cc @@ -175,22 +175,6 @@ RUNTIME_FUNCTION(Runtime_IsConcurrentRecompilationSupported) { isolate->concurrent_recompilation_enabled()); } -RUNTIME_FUNCTION(Runtime_TypeProfile) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - - CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); - if (function->has_feedback_vector()) { - FeedbackVector* vector = function->feedback_vector(); - if (vector->metadata()->HasTypeProfileSlot()) { - FeedbackSlot slot = vector->GetTypeProfileSlot(); - CollectTypeProfileNexus nexus(vector, slot); - return nexus.GetTypeProfile(); - } - } - return *isolate->factory()->NewJSObject(isolate->object_function()); -} - RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { HandleScope scope(isolate); @@ -252,8 +236,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { : "non-concurrent"); } - // TODO(mvstanton): pass pretenure flag to EnsureLiterals. - JSFunction::EnsureLiterals(function); + JSFunction::EnsureFeedbackVector(function); function->MarkForOptimization(concurrency_mode); @@ -470,121 +453,6 @@ RUNTIME_FUNCTION(Runtime_ClearFunctionFeedback) { return isolate->heap()->undefined_value(); } -RUNTIME_FUNCTION(Runtime_CheckWasmWrapperElision) { - // This only supports the case where the function being exported - // calls an intermediate function, and the intermediate function - // calls exactly one imported function - HandleScope scope(isolate); - CHECK_EQ(args.length(), 2); - // It takes two parameters, the first one is the JSFunction, - // The second one is the type - CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); - // If type is 0, it means that it is supposed to be a direct call into a wasm - // function. - // If type is 1, it means that it is supposed to have wrappers. - CONVERT_ARG_HANDLE_CHECKED(Smi, type, 1); - Handle<Code> export_code = handle(function->code()); - CHECK(export_code->kind() == Code::JS_TO_WASM_FUNCTION); - int const mask = - RelocInfo::ModeMask(FLAG_wasm_jit_to_native ? RelocInfo::JS_TO_WASM_CALL - : RelocInfo::CODE_TARGET); - // check the type of the $export_fct - wasm::WasmCode* export_fct = nullptr; - Handle<Code> export_fct_handle; - wasm::WasmCode* intermediate_fct = nullptr; - Handle<Code> intermediate_fct_handle; - - int count = 0; - for (RelocIterator it(*export_code, mask); !it.done(); it.next()) { - RelocInfo* rinfo = it.rinfo(); - Address target_address = FLAG_wasm_jit_to_native - ? rinfo->js_to_wasm_address() - : rinfo->target_address(); - if (FLAG_wasm_jit_to_native) { - wasm::WasmCode* target = - isolate->wasm_engine()->code_manager()->LookupCode(target_address); - if (target->kind() == wasm::WasmCode::kFunction) { - ++count; - export_fct = target; - } - } else { - Code* target = Code::GetCodeFromTargetAddress(target_address); - if (target->kind() == Code::WASM_FUNCTION) { - ++count; - export_fct_handle = handle(target); - } - } - } - CHECK_EQ(count, 1); - // check the type of the intermediate_fct - count = 0; - if (FLAG_wasm_jit_to_native) { - for (RelocIterator it(export_fct->instructions(), export_fct->reloc_info(), - export_fct->constant_pool(), - RelocInfo::ModeMask(RelocInfo::WASM_CALL)); - !it.done(); it.next()) { - RelocInfo* rinfo = it.rinfo(); - Address target_address = rinfo->target_address(); - wasm::WasmCode* target = - isolate->wasm_engine()->code_manager()->LookupCode(target_address); - if (target->kind() == wasm::WasmCode::kFunction) { - ++count; - intermediate_fct = target; - } - } - } else { - count = 0; - for (RelocIterator it(*export_fct_handle, mask); !it.done(); it.next()) { - RelocInfo* rinfo = it.rinfo(); - Address target_address = rinfo->target_address(); - Code* target = Code::GetCodeFromTargetAddress(target_address); - if (target->kind() == Code::WASM_FUNCTION) { - ++count; - intermediate_fct_handle = handle(target); - } - } - } - CHECK_EQ(count, 1); - // Check the type of the imported exported function, it should be also a wasm - // function in our case. - CHECK(type->value() == 0 || type->value() == 1); - - count = 0; - if (FLAG_wasm_jit_to_native) { - wasm::WasmCode::Kind target_kind = type->value() == 0 - ? wasm::WasmCode::kWasmToWasmWrapper - : wasm::WasmCode::kWasmToJsWrapper; - for (RelocIterator it(intermediate_fct->instructions(), - intermediate_fct->reloc_info(), - intermediate_fct->constant_pool(), - RelocInfo::ModeMask(RelocInfo::WASM_CALL)); - !it.done(); it.next()) { - RelocInfo* rinfo = it.rinfo(); - Address target_address = rinfo->target_address(); - wasm::WasmCode* target = - isolate->wasm_engine()->code_manager()->LookupCode(target_address); - if (target->kind() == target_kind) { - ++count; - } - } - } else { - Code::Kind target_kind = type->value() == 0 ? Code::WASM_TO_WASM_FUNCTION - : Code::WASM_TO_JS_FUNCTION; - count = 0; - for (RelocIterator it(*intermediate_fct_handle, mask); !it.done(); - it.next()) { - RelocInfo* rinfo = it.rinfo(); - Address target_address = rinfo->target_address(); - Code* target = Code::GetCodeFromTargetAddress(target_address); - if (target->kind() == target_kind) { - ++count; - } - } - } - CHECK_LE(count, 1); - return isolate->heap()->ToBoolean(count == 1); -} - RUNTIME_FUNCTION(Runtime_SetWasmCompileControls) { HandleScope scope(isolate); v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); @@ -757,6 +625,18 @@ RUNTIME_FUNCTION(Runtime_SetFlags) { return isolate->heap()->undefined_value(); } +RUNTIME_FUNCTION(Runtime_SetForceSlowPath) { + SealHandleScope shs(isolate); + DCHECK_EQ(1, args.length()); + CONVERT_ARG_CHECKED(Object, arg, 0); + if (arg->IsTrue(isolate)) { + isolate->set_force_slow_path(true); + } else { + DCHECK(arg->IsFalse(isolate)); + isolate->set_force_slow_path(false); + } + return isolate->heap()->undefined_value(); +} RUNTIME_FUNCTION(Runtime_Abort) { SealHandleScope shs(isolate); @@ -774,6 +654,10 @@ RUNTIME_FUNCTION(Runtime_AbortJS) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); CONVERT_ARG_HANDLE_CHECKED(String, message, 0); + if (FLAG_disable_abortjs) { + base::OS::PrintError("[disabled] abort: %s\n", message->ToCString().get()); + return nullptr; + } base::OS::PrintError("abort: %s\n", message->ToCString().get()); isolate->PrintStack(stderr); base::OS::Abort(); @@ -845,31 +729,6 @@ RUNTIME_FUNCTION(Runtime_TraceExit) { return obj; // return TOS } -RUNTIME_FUNCTION(Runtime_GetExceptionDetails) { - HandleScope shs(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_HANDLE_CHECKED(JSObject, exception_obj, 0); - - Factory* factory = isolate->factory(); - Handle<JSMessageObject> message_obj = - isolate->CreateMessage(exception_obj, nullptr); - - Handle<JSObject> message = factory->NewJSObject(isolate->object_function()); - - Handle<String> key; - Handle<Object> value; - - key = factory->NewStringFromAsciiChecked("start_pos"); - value = handle(Smi::FromInt(message_obj->start_position()), isolate); - JSObject::SetProperty(message, key, value, LanguageMode::kStrict).Assert(); - - key = factory->NewStringFromAsciiChecked("end_pos"); - value = handle(Smi::FromInt(message_obj->end_position()), isolate); - JSObject::SetProperty(message, key, value, LanguageMode::kStrict).Assert(); - - return *message; -} - RUNTIME_FUNCTION(Runtime_HaveSameMap) { SealHandleScope shs(isolate); DCHECK_EQ(2, args.length()); @@ -964,7 +823,6 @@ ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(DoubleElements) ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(HoleyElements) ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(DictionaryElements) ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(SloppyArgumentsElements) -ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FixedTypedArrayElements) // Properties test sitting with elements tests - not fooling anyone. ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastProperties) @@ -985,7 +843,7 @@ TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) RUNTIME_FUNCTION(Runtime_SpeciesProtector) { SealHandleScope shs(isolate); DCHECK_EQ(0, args.length()); - return isolate->heap()->ToBoolean(isolate->IsArraySpeciesLookupChainIntact()); + return isolate->heap()->ToBoolean(isolate->IsSpeciesLookupChainIntact()); } // Take a compiled wasm module, serialize it and copy the buffer into an array diff --git a/chromium/v8/src/runtime/runtime-typedarray.cc b/chromium/v8/src/runtime/runtime-typedarray.cc index 85fb2d21739..f8fd3cc6220 100644 --- a/chromium/v8/src/runtime/runtime-typedarray.cc +++ b/chromium/v8/src/runtime/runtime-typedarray.cc @@ -14,14 +14,6 @@ namespace v8 { namespace internal { -RUNTIME_FUNCTION(Runtime_ArrayBufferGetByteLength) { - SealHandleScope shs(isolate); - DCHECK_EQ(1, args.length()); - CONVERT_ARG_CHECKED(JSArrayBuffer, holder, 0); - return holder->byte_length(); -} - - RUNTIME_FUNCTION(Runtime_ArrayBufferNeuter) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); @@ -56,7 +48,7 @@ RUNTIME_FUNCTION(Runtime_TypedArrayCopyElements) { HandleScope scope(isolate); DCHECK_EQ(3, args.length()); CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, target, 0); - CONVERT_ARG_HANDLE_CHECKED(JSReceiver, source, 1); + CONVERT_ARG_HANDLE_CHECKED(Object, source, 1); CONVERT_NUMBER_ARG_HANDLE_CHECKED(length_obj, 2); size_t length; @@ -66,19 +58,12 @@ RUNTIME_FUNCTION(Runtime_TypedArrayCopyElements) { return accessor->CopyElements(source, target, length); } -#define BUFFER_VIEW_GETTER(Type, getter, accessor) \ - RUNTIME_FUNCTION(Runtime_##Type##Get##getter) { \ - HandleScope scope(isolate); \ - DCHECK_EQ(1, args.length()); \ - CONVERT_ARG_HANDLE_CHECKED(JS##Type, holder, 0); \ - return holder->accessor(); \ - } - -BUFFER_VIEW_GETTER(ArrayBufferView, ByteLength, byte_length) -BUFFER_VIEW_GETTER(ArrayBufferView, ByteOffset, byte_offset) -BUFFER_VIEW_GETTER(TypedArray, Length, length) - -#undef BUFFER_VIEW_GETTER +RUNTIME_FUNCTION(Runtime_TypedArrayGetLength) { + HandleScope scope(isolate); + DCHECK_EQ(1, args.length()); + CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0); + return holder->length(); +} RUNTIME_FUNCTION(Runtime_ArrayBufferViewWasNeutered) { HandleScope scope(isolate); @@ -162,58 +147,6 @@ RUNTIME_FUNCTION(Runtime_IsTypedArray) { return isolate->heap()->ToBoolean(args[0]->IsJSTypedArray()); } -RUNTIME_FUNCTION(Runtime_IsSharedTypedArray) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - return isolate->heap()->ToBoolean( - args[0]->IsJSTypedArray() && - JSTypedArray::cast(args[0])->GetBuffer()->is_shared()); -} - - -RUNTIME_FUNCTION(Runtime_IsSharedIntegerTypedArray) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - if (!args[0]->IsJSTypedArray()) { - return isolate->heap()->false_value(); - } - - Handle<JSTypedArray> obj(JSTypedArray::cast(args[0])); - return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() && - obj->type() != kExternalFloat32Array && - obj->type() != kExternalFloat64Array && - obj->type() != kExternalUint8ClampedArray); -} - - -RUNTIME_FUNCTION(Runtime_IsSharedInteger32TypedArray) { - HandleScope scope(isolate); - DCHECK_EQ(1, args.length()); - if (!args[0]->IsJSTypedArray()) { - return isolate->heap()->false_value(); - } - - Handle<JSTypedArray> obj(JSTypedArray::cast(args[0])); - return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() && - obj->type() == kExternalInt32Array); -} - -RUNTIME_FUNCTION(Runtime_TypedArraySpeciesCreateByLength) { - HandleScope scope(isolate); - DCHECK_EQ(args.length(), 2); - Handle<JSTypedArray> exemplar = args.at<JSTypedArray>(0); - Handle<Object> length = args.at(1); - int argc = 1; - ScopedVector<Handle<Object>> argv(argc); - argv[0] = length; - Handle<JSTypedArray> result_array; - // TODO(tebbi): Pass correct method name. - ASSIGN_RETURN_FAILURE_ON_EXCEPTION( - isolate, result_array, - JSTypedArray::SpeciesCreate(isolate, exemplar, argc, argv.start(), "")); - return *result_array; -} - // 22.2.3.23 %TypedArray%.prototype.set ( overloaded [ , offset ] ) RUNTIME_FUNCTION(Runtime_TypedArraySet) { HandleScope scope(isolate); diff --git a/chromium/v8/src/runtime/runtime.h b/chromium/v8/src/runtime/runtime.h index d05f4984c6a..2bfd280803e 100644 --- a/chromium/v8/src/runtime/runtime.h +++ b/chromium/v8/src/runtime/runtime.h @@ -44,7 +44,6 @@ namespace internal { F(GetArrayKeys, 2, 1) \ F(TrySliceSimpleNonFastElements, 3, 1) \ F(NewArray, -1 /* >= 3 */, 1) \ - F(FunctionBind, -1, 1) \ F(NormalizeElements, 1, 1) \ F(GrowArrayElements, 2, 1) \ F(HasComplexElements, 1, 1) \ @@ -56,9 +55,6 @@ namespace internal { F(SpreadIterablePrepare, 1, 1) #define FOR_EACH_INTRINSIC_ATOMICS(F) \ - F(ThrowNotIntegerSharedTypedArrayError, 1, 1) \ - F(ThrowNotInt32SharedTypedArrayError, 1, 1) \ - F(ThrowInvalidAtomicAccessIndexError, 0, 1) \ F(AtomicsExchange, 3, 1) \ F(AtomicsCompareExchange, 4, 1) \ F(AtomicsAdd, 3, 1) \ @@ -78,7 +74,8 @@ namespace internal { F(BigIntEqualToString, 2, 1) \ F(BigIntToBoolean, 1, 1) \ F(BigIntToNumber, 1, 1) \ - F(BigIntUnaryOp, 2, 1) + F(BigIntUnaryOp, 2, 1) \ + F(ToBigInt, 1, 1) #define FOR_EACH_INTRINSIC_CLASSES(F) \ F(ThrowUnsupportedSuperError, 0, 1) \ @@ -99,8 +96,6 @@ namespace internal { #define FOR_EACH_INTRINSIC_COLLECTIONS(F) \ F(TheHole, 0, 1) \ - F(GenericHash, 1, 1) \ - F(GetExistingHash, 1, 1) \ F(SetGrow, 1, 1) \ F(SetShrink, 1, 1) \ F(SetIteratorClone, 1, 1) \ @@ -108,7 +103,6 @@ namespace internal { F(MapGrow, 1, 1) \ F(MapIteratorClone, 1, 1) \ F(GetWeakMapEntries, 2, 1) \ - F(WeakCollectionInitialize, 1, 1) \ F(WeakCollectionDelete, 3, 1) \ F(WeakCollectionSet, 4, 1) \ F(GetWeakSetValues, 2, 1) \ @@ -130,12 +124,10 @@ namespace internal { #define FOR_EACH_INTRINSIC_DATE(F) \ F(IsDate, 1, 1) \ - F(DateCurrentTime, 0, 1) \ - F(ThrowNotDateError, 0, 1) + F(DateCurrentTime, 0, 1) #define FOR_EACH_INTRINSIC_DEBUG(F) \ F(HandleDebuggerStatement, 0, 1) \ - F(SetDebugEventListener, 2, 1) \ F(ScheduleBreak, 0, 1) \ F(DebugGetInternalProperties, 1, 1) \ F(DebugGetPropertyDetails, 2, 1) \ @@ -153,12 +145,7 @@ namespace internal { F(GetGeneratorScopeCount, 1, 1) \ F(GetGeneratorScopeDetails, 2, 1) \ F(SetScopeVariableValue, 6, 1) \ - F(DebugPrintScopes, 0, 1) \ - F(SetBreakPointsActive, 1, 1) \ F(GetBreakLocations, 1, 1) \ - F(SetFunctionBreakPoint, 3, 1) \ - F(SetScriptBreakPoint, 3, 1) \ - F(ClearBreakPoint, 1, 1) \ F(ChangeBreakOnException, 2, 1) \ F(IsBreakOnException, 1, 1) \ F(PrepareStep, 2, 1) \ @@ -177,22 +164,16 @@ namespace internal { F(GetHeapUsage, 0, 1) \ F(GetScript, 1, 1) \ F(ScriptLineCount, 1, 1) \ - F(ScriptLineStartPosition, 2, 1) \ - F(ScriptLineEndPosition, 2, 1) \ F(ScriptLocationFromLine, 4, 1) \ F(ScriptLocationFromLine2, 4, 1) \ F(ScriptPositionInfo, 3, 1) \ F(ScriptPositionInfo2, 3, 1) \ - F(ScriptSourceLine, 2, 1) \ F(DebugOnFunctionCall, 1, 1) \ F(DebugPrepareStepInSuspendedGenerator, 0, 1) \ - F(DebugRecordGenerator, 1, 1) \ F(DebugPushPromise, 1, 1) \ F(DebugPopPromise, 0, 1) \ - F(DebugPromiseReject, 2, 1) \ F(DebugAsyncFunctionPromiseCreated, 1, 1) \ F(DebugIsActive, 0, 1) \ - F(DebugBreakInOptimizedCode, 0, 1) \ F(DebugCollectCoverage, 0, 1) \ F(DebugTogglePreciseCoverage, 1, 1) \ F(DebugToggleBlockCoverage, 1, 1) \ @@ -222,8 +203,7 @@ namespace internal { #define FOR_EACH_INTRINSIC_INTERPRETER(F) \ FOR_EACH_INTRINSIC_INTERPRETER_TRACE(F) \ FOR_EACH_INTRINSIC_INTERPRETER_TRACE_FEEDBACK(F) \ - F(InterpreterDeserializeLazy, 2, 1) \ - F(InterpreterNewClosure, 4, 1) + F(InterpreterDeserializeLazy, 2, 1) #define FOR_EACH_INTRINSIC_FUNCTION(F) \ F(FunctionGetName, 1, 1) \ @@ -232,7 +212,6 @@ namespace internal { F(FunctionGetSourceCode, 1, 1) \ F(FunctionGetScriptSourcePosition, 1, 1) \ F(FunctionGetContextData, 1, 1) \ - F(FunctionSetLength, 2, 1) \ F(FunctionIsAPIFunction, 1, 1) \ F(SetCode, 2, 1) \ F(SetNativeFlag, 1, 1) \ @@ -246,11 +225,14 @@ namespace internal { F(GeneratorClose, 1, 1) \ F(GeneratorGetFunction, 1, 1) \ F(GeneratorGetReceiver, 1, 1) \ - F(GeneratorGetContext, 1, 1) \ F(GeneratorGetInputOrDebugPos, 1, 1) \ + F(AsyncFunctionAwaitCaught, 3, 1) \ + F(AsyncFunctionAwaitUncaught, 3, 1) \ F(AsyncGeneratorResolve, 3, 1) \ F(AsyncGeneratorReject, 2, 1) \ F(AsyncGeneratorYield, 3, 1) \ + F(AsyncGeneratorAwaitCaught, 2, 1) \ + F(AsyncGeneratorAwaitUncaught, 2, 1) \ F(GeneratorGetContinuation, 1, 1) \ F(GeneratorGetSourcePosition, 1, 1) \ F(GeneratorGetResumeMode, 1, 1) \ @@ -311,35 +293,28 @@ namespace internal { F(PromoteScheduledException, 0, 1) \ F(ReThrow, 1, 1) \ F(RunMicrotasks, 0, 1) \ + F(RunMicrotaskCallback, 2, 1) \ F(StackGuard, 0, 1) \ F(Throw, 1, 1) \ F(ThrowApplyNonFunction, 1, 1) \ - F(ThrowCannotConvertToPrimitive, 0, 1) \ F(ThrowCalledNonCallable, 1, 1) \ - F(ThrowCalledOnNullOrUndefined, 1, 1) \ F(ThrowConstructedNonConstructable, 1, 1) \ F(ThrowConstructorReturnedNonObject, 0, 1) \ - F(ThrowGeneratorRunning, 0, 1) \ - F(ThrowIncompatibleMethodReceiver, 2, 1) \ - F(ThrowInvalidHint, 1, 1) \ F(ThrowInvalidStringLength, 0, 1) \ F(ThrowInvalidTypedArrayAlignment, 2, 1) \ F(ThrowIteratorResultNotAnObject, 1, 1) \ F(ThrowThrowMethodMissing, 0, 1) \ F(ThrowSymbolIteratorInvalid, 0, 1) \ - F(ThrowNonCallableInInstanceOfCheck, 0, 1) \ - F(ThrowNonObjectInInstanceOfCheck, 0, 1) \ F(ThrowNotConstructor, 1, 1) \ F(ThrowRangeError, -1 /* >= 1 */, 1) \ F(ThrowReferenceError, 1, 1) \ F(ThrowStackOverflow, 0, 1) \ F(ThrowSymbolAsyncIteratorInvalid, 0, 1) \ F(ThrowTypeError, -1 /* >= 1 */, 1) \ - F(ThrowUndefinedOrNullToObject, 1, 1) \ F(Typeof, 1, 1) \ F(UnwindAndFindExceptionHandler, 0, 1) \ F(AllowDynamicFunction, 1, 1) \ - F(GetTemplateObject, 1, 1) \ + F(CreateTemplateObject, 1, 1) \ F(ReportMessage, 1, 1) #define FOR_EACH_INTRINSIC_LITERALS(F) \ @@ -366,9 +341,7 @@ namespace internal { #define FOR_EACH_INTRINSIC_MODULE(F) \ F(DynamicImportCall, 2, 1) \ F(GetImportMetaObject, 0, 1) \ - F(GetModuleNamespace, 1, 1) \ - F(LoadModuleVariable, 1, 1) \ - F(StoreModuleVariable, 2, 1) + F(GetModuleNamespace, 1, 1) #define FOR_EACH_INTRINSIC_NUMBERS(F) \ F(IsValidSmi, 1, 1) \ @@ -391,6 +364,10 @@ namespace internal { F(ObjectCreate, 2, 1) \ F(InternalSetPrototype, 2, 1) \ F(OptimizeObjectForAddingMultipleProperties, 2, 1) \ + F(ObjectValues, 1, 1) \ + F(ObjectValuesSkipFastPath, 1, 1) \ + F(ObjectEntries, 1, 1) \ + F(ObjectEntriesSkipFastPath, 1, 1) \ F(GetProperty, 2, 1) \ F(KeyedGetProperty, 2, 1) \ F(AddNamedProperty, 4, 1) \ @@ -406,14 +383,10 @@ namespace internal { F(AllocateHeapNumber, 0, 1) \ F(NewObject, 2, 1) \ F(CompleteInobjectSlackTrackingForMap, 1, 1) \ - F(LoadMutableDouble, 2, 1) \ F(TryMigrateInstance, 1, 1) \ - F(IsJSGlobalProxy, 1, 1) \ F(DefineAccessorPropertyUnchecked, 5, 1) \ F(DefineDataPropertyInLiteral, 6, 1) \ F(CollectTypeProfile, 3, 1) \ - F(GetDataProperty, 2, 1) \ - F(GetConstructorName, 1, 1) \ F(HasFastPackedElements, 1, 1) \ F(ValueOf, 1, 1) \ F(IsJSReceiver, 1, 1) \ @@ -437,21 +410,12 @@ namespace internal { F(HasInPrototypeChain, 2, 1) \ F(CreateIterResultObject, 2, 1) \ F(CreateDataProperty, 3, 1) \ + F(AddPrivateField, 3, 1) \ F(IterableToListCanBeElided, 1, 1) \ F(GetOwnPropertyDescriptor, 2, 1) #define FOR_EACH_INTRINSIC_OPERATORS(F) \ - F(Multiply, 2, 1) \ - F(Divide, 2, 1) \ - F(Modulus, 2, 1) \ F(Add, 2, 1) \ - F(Subtract, 2, 1) \ - F(ShiftLeft, 2, 1) \ - F(ShiftRight, 2, 1) \ - F(ShiftRightLogical, 2, 1) \ - F(BitwiseAnd, 2, 1) \ - F(BitwiseOr, 2, 1) \ - F(BitwiseXor, 2, 1) \ F(Equal, 2, 1) \ F(NotEqual, 2, 1) \ F(StrictEqual, 2, 1) \ @@ -459,13 +423,11 @@ namespace internal { F(LessThan, 2, 1) \ F(GreaterThan, 2, 1) \ F(LessThanOrEqual, 2, 1) \ - F(GreaterThanOrEqual, 2, 1) \ - F(InstanceOf, 2, 1) + F(GreaterThanOrEqual, 2, 1) #define FOR_EACH_INTRINSIC_PROMISE(F) \ F(EnqueueMicrotask, 1, 1) \ F(PromiseHookInit, 2, 1) \ - F(PromiseHookResolve, 1, 1) \ F(PromiseHookBefore, 1, 1) \ F(PromiseHookAfter, 1, 1) \ F(PromiseMarkAsHandled, 1, 1) \ @@ -473,7 +435,8 @@ namespace internal { F(PromiseRevokeReject, 1, 1) \ F(PromiseResult, 1, 1) \ F(PromiseStatus, 1, 1) \ - F(ReportPromiseReject, 2, 1) + F(RejectPromise, 3, 1) \ + F(ResolvePromise, 2, 1) #define FOR_EACH_INTRINSIC_PROXY(F) \ F(IsJSProxy, 1, 1) \ @@ -488,7 +451,6 @@ namespace internal { F(IsRegExp, 1, 1) \ F(RegExpExec, 4, 1) \ F(RegExpExecMultiple, 4, 1) \ - F(RegExpExecReThrow, 0, 1) \ F(RegExpInitializeAndCompile, 3, 1) \ F(RegExpInternalReplace, 3, 1) \ F(RegExpReplace, 3, 1) \ @@ -507,8 +469,8 @@ namespace internal { F(NewRestParameter, 1, 1) \ F(NewSloppyArguments, 3, 1) \ F(NewArgumentsElements, 3, 1) \ - F(NewClosure, 3, 1) \ - F(NewClosure_Tenured, 3, 1) \ + F(NewClosure, 2, 1) \ + F(NewClosure_Tenured, 2, 1) \ F(NewScriptContext, 2, 1) \ F(NewFunctionContext, 2, 1) \ F(PushModuleContext, 3, 1) \ @@ -530,7 +492,7 @@ namespace internal { F(StringIndexOf, 3, 1) \ F(StringIndexOfUnchecked, 3, 1) \ F(StringLastIndexOf, 2, 1) \ - F(SubString, 3, 1) \ + F(StringSubstring, 3, 1) \ F(StringAdd, 2, 1) \ F(InternalizeString, 1, 1) \ F(StringCharCodeAt, 2, 1) \ @@ -548,106 +510,103 @@ namespace internal { F(StringCharFromCode, 1, 1) \ F(StringMaxLength, 0, 1) -#define FOR_EACH_INTRINSIC_SYMBOL(F) \ - F(CreateSymbol, 1, 1) \ - F(CreatePrivateSymbol, 1, 1) \ - F(SymbolDescription, 1, 1) \ - F(SymbolDescriptiveString, 1, 1) \ +#define FOR_EACH_INTRINSIC_SYMBOL(F) \ + F(CreatePrivateSymbol, -1 /* <= 1 */, 1) \ + F(CreatePrivateFieldSymbol, 0, 1) \ + F(SymbolDescription, 1, 1) \ + F(SymbolDescriptiveString, 1, 1) \ F(SymbolIsPrivate, 1, 1) #define FOR_EACH_INTRINSIC_TEST(F) \ - F(ConstructDouble, 2, 1) \ + F(Abort, 1, 1) \ + F(AbortJS, 1, 1) \ + F(ClearFunctionFeedback, 1, 1) \ + F(CompleteInobjectSlackTracking, 1, 1) \ F(ConstructConsString, 2, 1) \ + F(ConstructDouble, 2, 1) \ + F(DebugPrint, 1, 1) \ + F(DebugTrace, 0, 1) \ + F(DebugTrackRetainingPath, -1, 1) \ F(DeoptimizeFunction, 1, 1) \ F(DeoptimizeNow, 0, 1) \ - F(RunningInSimulator, 0, 1) \ - F(IsConcurrentRecompilationSupported, 0, 1) \ - F(OptimizeFunctionOnNextCall, -1, 1) \ - F(TypeProfile, 1, 1) \ - F(OptimizeOsr, -1, 1) \ - F(NeverOptimizeFunction, 1, 1) \ - F(GetOptimizationStatus, -1, 1) \ - F(UnblockConcurrentRecompilation, 0, 1) \ + F(DeserializeWasmModule, 2, 1) \ + F(DisallowCodegenFromStrings, 1, 1) \ + F(DisallowWasmCodegen, 1, 1) \ + F(DisassembleFunction, 1, 1) \ + F(FreezeWasmLazyCompilation, 1, 1) \ + F(GetCallable, 0, 1) \ F(GetDeoptCount, 1, 1) \ + F(GetOptimizationStatus, -1, 1) \ F(GetUndetectable, 0, 1) \ - F(GetCallable, 0, 1) \ - F(ClearFunctionFeedback, 1, 1) \ - F(CheckWasmWrapperElision, 2, 1) \ - F(NotifyContextDisposed, 0, 1) \ - F(SetAllocationTimeout, -1 /* 2 || 3 */, 1) \ - F(DebugPrint, 1, 1) \ - F(DebugTrace, 0, 1) \ - F(DebugTrackRetainingPath, -1, 1) \ - F(PrintWithNameForAssert, 2, 1) \ - F(GetExceptionDetails, 1, 1) \ + F(GetWasmRecoveredTrapCount, 0, 1) \ F(GlobalPrint, 1, 1) \ - F(SystemBreak, 0, 1) \ - F(SetFlags, 1, 1) \ - F(Abort, 1, 1) \ - F(AbortJS, 1, 1) \ - F(NativeScriptsCount, 0, 1) \ - F(DisassembleFunction, 1, 1) \ - F(TraceEnter, 0, 1) \ - F(TraceExit, 1, 1) \ - F(HaveSameMap, 2, 1) \ - F(InNewSpace, 1, 1) \ - F(HasFastElements, 1, 1) \ - F(HasSmiElements, 1, 1) \ - F(HasObjectElements, 1, 1) \ - F(HasSmiOrObjectElements, 1, 1) \ - F(HasDoubleElements, 1, 1) \ - F(HasHoleyElements, 1, 1) \ F(HasDictionaryElements, 1, 1) \ - F(HasSloppyArgumentsElements, 1, 1) \ - F(HasFixedTypedArrayElements, 1, 1) \ + F(HasDoubleElements, 1, 1) \ + F(HasFastElements, 1, 1) \ F(HasFastProperties, 1, 1) \ - F(HasFixedUint8Elements, 1, 1) \ + F(HasFixedBigInt64Elements, 1, 1) \ + F(HasFixedBigUint64Elements, 1, 1) \ + F(HasFixedFloat32Elements, 1, 1) \ + F(HasFixedFloat64Elements, 1, 1) \ + F(HasFixedInt16Elements, 1, 1) \ + F(HasFixedInt32Elements, 1, 1) \ F(HasFixedInt8Elements, 1, 1) \ F(HasFixedUint16Elements, 1, 1) \ - F(HasFixedInt16Elements, 1, 1) \ F(HasFixedUint32Elements, 1, 1) \ - F(HasFixedInt32Elements, 1, 1) \ - F(HasFixedFloat32Elements, 1, 1) \ - F(HasFixedFloat64Elements, 1, 1) \ F(HasFixedUint8ClampedElements, 1, 1) \ - F(SpeciesProtector, 0, 1) \ - F(SerializeWasmModule, 1, 1) \ - F(DeserializeWasmModule, 2, 1) \ + F(HasFixedUint8Elements, 1, 1) \ + F(HasHoleyElements, 1, 1) \ + F(IsJSError, 1, 1) \ + F(IsJSGeneratorObject, 1, 1) \ + F(IsJSMapIterator, 1, 1) \ + F(IsScriptWrapper, 1, 1) \ + F(IsJSSetIterator, 1, 1) \ + F(HasObjectElements, 1, 1) \ + F(HasSloppyArgumentsElements, 1, 1) \ + F(HasSmiElements, 1, 1) \ + F(HasSmiOrObjectElements, 1, 1) \ + F(HaveSameMap, 2, 1) \ + F(HeapObjectVerify, 1, 1) \ + F(InNewSpace, 1, 1) \ F(IsAsmWasmCode, 1, 1) \ + F(IsConcurrentRecompilationSupported, 0, 1) \ + F(IsLiftoffFunction, 1, 1) \ F(IsWasmCode, 1, 1) \ F(IsWasmTrapHandlerEnabled, 0, 1) \ - F(GetWasmRecoveredTrapCount, 0, 1) \ - F(DisallowCodegenFromStrings, 1, 1) \ - F(DisallowWasmCodegen, 1, 1) \ + F(NativeScriptsCount, 0, 1) \ + F(NeverOptimizeFunction, 1, 1) \ + F(NotifyContextDisposed, 0, 1) \ + F(OptimizeFunctionOnNextCall, -1, 1) \ + F(OptimizeOsr, -1, 1) \ + F(PrintWithNameForAssert, 2, 1) \ + F(RedirectToWasmInterpreter, 2, 1) \ + F(RunningInSimulator, 0, 1) \ + F(SerializeWasmModule, 1, 1) \ + F(SetAllocationTimeout, -1 /* 2 || 3 */, 1) \ + F(SetFlags, 1, 1) \ + F(SetForceSlowPath, 1, 1) \ + F(SetWasmCompileControls, 2, 1) \ + F(SetWasmInstantiateControls, 0, 1) \ + F(SpeciesProtector, 0, 1) \ + F(SystemBreak, 0, 1) \ + F(TraceEnter, 0, 1) \ + F(TraceExit, 1, 1) \ + F(UnblockConcurrentRecompilation, 0, 1) \ F(ValidateWasmInstancesChain, 2, 1) \ F(ValidateWasmModuleState, 1, 1) \ F(ValidateWasmOrphanedInstance, 1, 1) \ - F(SetWasmCompileControls, 2, 1) \ - F(SetWasmInstantiateControls, 0, 1) \ - F(HeapObjectVerify, 1, 1) \ F(WasmNumInterpretedCalls, 1, 1) \ - F(RedirectToWasmInterpreter, 2, 1) \ - F(WasmTraceMemory, 1, 1) \ - F(CompleteInobjectSlackTracking, 1, 1) \ - F(IsLiftoffFunction, 1, 1) \ - F(FreezeWasmLazyCompilation, 1, 1) + F(WasmTraceMemory, 1, 1) #define FOR_EACH_INTRINSIC_TYPEDARRAY(F) \ - F(ArrayBufferGetByteLength, 1, 1) \ F(ArrayBufferNeuter, 1, 1) \ F(TypedArrayCopyElements, 3, 1) \ - F(ArrayBufferViewGetByteLength, 1, 1) \ - F(ArrayBufferViewGetByteOffset, 1, 1) \ F(ArrayBufferViewWasNeutered, 1, 1) \ F(TypedArrayGetLength, 1, 1) \ F(TypedArrayGetBuffer, 1, 1) \ F(TypedArraySortFast, 1, 1) \ F(TypedArraySet, 2, 1) \ - F(IsTypedArray, 1, 1) \ - F(IsSharedTypedArray, 1, 1) \ - F(IsSharedIntegerTypedArray, 1, 1) \ - F(IsSharedInteger32TypedArray, 1, 1) \ - F(TypedArraySpeciesCreateByLength, 2, 1) + F(IsTypedArray, 1, 1) #define FOR_EACH_INTRINSIC_WASM(F) \ F(WasmGrowMemory, 1, 1) \ @@ -683,8 +642,7 @@ namespace internal { F(StoreGlobalIC_Miss, 4, 1) \ F(StoreGlobalIC_Slow, 5, 1) \ F(StoreIC_Miss, 5, 1) \ - F(StorePropertyWithInterceptor, 5, 1) \ - F(Unreachable, 0, 1) + F(StorePropertyWithInterceptor, 5, 1) #define FOR_EACH_INTRINSIC_RETURN_OBJECT(F) \ FOR_EACH_INTRINSIC_IC(F) \ |