From 8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 3 May 2018 13:42:47 +0200 Subject: BASELINE: Update Chromium to 66.0.3359.156 Change-Id: I0c9831ad39911a086b6377b16f995ad75a51e441 Reviewed-by: Michal Klocek --- chromium/v8/src/runtime/runtime-array.cc | 14 +- chromium/v8/src/runtime/runtime-atomics.cc | 24 --- chromium/v8/src/runtime/runtime-bigint.cc | 7 + chromium/v8/src/runtime/runtime-collections.cc | 29 +-- chromium/v8/src/runtime/runtime-date.cc | 9 - chromium/v8/src/runtime/runtime-debug.cc | 264 +++---------------------- chromium/v8/src/runtime/runtime-error.cc | 6 + chromium/v8/src/runtime/runtime-function.cc | 17 +- chromium/v8/src/runtime/runtime-generator.cc | 36 +++- chromium/v8/src/runtime/runtime-internal.cc | 81 ++------ chromium/v8/src/runtime/runtime-interpreter.cc | 15 -- chromium/v8/src/runtime/runtime-intl.cc | 1 + chromium/v8/src/runtime/runtime-module.cc | 18 -- chromium/v8/src/runtime/runtime-object.cc | 154 ++++++++++----- chromium/v8/src/runtime/runtime-operators.cc | 99 ---------- chromium/v8/src/runtime/runtime-promise.cc | 115 ++++++----- chromium/v8/src/runtime/runtime-regexp.cc | 8 - chromium/v8/src/runtime/runtime-scopes.cc | 36 ++-- chromium/v8/src/runtime/runtime-strings.cc | 31 +-- chromium/v8/src/runtime/runtime-symbol.cc | 25 ++- chromium/v8/src/runtime/runtime-test.cc | 178 ++--------------- chromium/v8/src/runtime/runtime-typedarray.cc | 81 +------- chromium/v8/src/runtime/runtime.h | 220 +++++++++------------ 23 files changed, 419 insertions(+), 1049 deletions(-) (limited to 'chromium/v8/src/runtime') 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 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(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(object->elements()->length()); uint32_t index = static_cast(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(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::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 Runtime::GetInternalProperties(Isolate* isolate, Handle status_str = factory->NewStringFromAsciiChecked(status); result->set(1, *status_str); - Handle value_obj(promise->result(), isolate); + Handle value_obj(promise->status() == Promise::kPending + ? isolate->heap()->undefined_value() + : promise->result(), + isolate); Handle 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 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