From 6036726eb981b6c4b42047513b9d3f4ac865daac Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 24 Oct 2018 11:30:15 +0200 Subject: BASELINE: Update Chromium to 70.0.3538.78 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie634710bf039e26c1957f4ae45e101bd4c434ae7 Reviewed-by: Michael BrĂ¼ning --- chromium/v8/src/debug/arm/OWNERS | 1 - chromium/v8/src/debug/arm64/OWNERS | 1 - chromium/v8/src/debug/debug-coverage.cc | 49 ++++- chromium/v8/src/debug/debug-evaluate.cc | 227 +++++++++++---------- chromium/v8/src/debug/debug-scope-iterator.cc | 3 +- chromium/v8/src/debug/debug-scopes.cc | 1 + .../v8/src/debug/debug-stack-trace-iterator.cc | 5 +- chromium/v8/src/debug/debug.cc | 77 ++++--- chromium/v8/src/debug/debug.h | 29 +-- chromium/v8/src/debug/liveedit.cc | 197 +++++++++++------- chromium/v8/src/debug/mips/OWNERS | 5 +- chromium/v8/src/debug/mips64/OWNERS | 5 +- 12 files changed, 335 insertions(+), 265 deletions(-) delete mode 100644 chromium/v8/src/debug/arm/OWNERS delete mode 100644 chromium/v8/src/debug/arm64/OWNERS (limited to 'chromium/v8/src/debug') diff --git a/chromium/v8/src/debug/arm/OWNERS b/chromium/v8/src/debug/arm/OWNERS deleted file mode 100644 index 906a5ce6418..00000000000 --- a/chromium/v8/src/debug/arm/OWNERS +++ /dev/null @@ -1 +0,0 @@ -rmcilroy@chromium.org diff --git a/chromium/v8/src/debug/arm64/OWNERS b/chromium/v8/src/debug/arm64/OWNERS deleted file mode 100644 index 906a5ce6418..00000000000 --- a/chromium/v8/src/debug/arm64/OWNERS +++ /dev/null @@ -1 +0,0 @@ -rmcilroy@chromium.org diff --git a/chromium/v8/src/debug/debug-coverage.cc b/chromium/v8/src/debug/debug-coverage.cc index 9e7195b1f3e..f8b716f7c91 100644 --- a/chromium/v8/src/debug/debug-coverage.cc +++ b/chromium/v8/src/debug/debug-coverage.cc @@ -72,8 +72,7 @@ void SortBlockData(std::vector& v) { std::sort(v.begin(), v.end(), CompareCoverageBlock); } -std::vector GetSortedBlockData(Isolate* isolate, - SharedFunctionInfo* shared) { +std::vector GetSortedBlockData(SharedFunctionInfo* shared) { DCHECK(shared->HasCoverageInfo()); CoverageInfo* coverage_info = @@ -172,6 +171,12 @@ class CoverageBlockIterator final { return function_->blocks[read_index_ + 1]; } + CoverageBlock& GetPreviousBlock() { + DCHECK(IsActive()); + DCHECK_GT(read_index_, 0); + return function_->blocks[read_index_ - 1]; + } + CoverageBlock& GetParent() { DCHECK(IsActive()); return nesting_stack_.back(); @@ -326,6 +331,30 @@ void MergeNestedRanges(CoverageFunction* function) { } } +void FilterAliasedSingletons(CoverageFunction* function) { + CoverageBlockIterator iter(function); + + iter.Next(); // Advance once since we reference the previous block later. + + while (iter.Next()) { + CoverageBlock& previous_block = iter.GetPreviousBlock(); + CoverageBlock& block = iter.GetBlock(); + + bool is_singleton = block.end == kNoSourcePosition; + bool aliases_start = block.start == previous_block.start; + + if (is_singleton && aliases_start) { + // The previous block must have a full range since duplicate singletons + // have already been merged. + DCHECK_NE(previous_block.end, kNoSourcePosition); + // Likewise, the next block must have another start position since + // singletons are sorted to the end. + DCHECK_IMPLIES(iter.HasNext(), iter.GetNextBlock().start != block.start); + iter.DeleteBlock(); + } + } +} + void FilterUncoveredRanges(CoverageFunction* function) { CoverageBlockIterator iter(function); @@ -385,13 +414,12 @@ bool IsBinaryMode(debug::Coverage::Mode mode) { } } -void CollectBlockCoverage(Isolate* isolate, CoverageFunction* function, - SharedFunctionInfo* info, +void CollectBlockCoverage(CoverageFunction* function, SharedFunctionInfo* info, debug::Coverage::Mode mode) { DCHECK(IsBlockMode(mode)); function->has_block_coverage = true; - function->blocks = GetSortedBlockData(isolate, info); + function->blocks = GetSortedBlockData(info); // If in binary mode, only report counts of 0/1. if (mode == debug::Coverage::kBlockBinary) ClampToBinary(function); @@ -399,6 +427,15 @@ void CollectBlockCoverage(Isolate* isolate, CoverageFunction* function, // Remove duplicate singleton ranges, keeping the max count. MergeDuplicateSingletons(function); + // Remove singleton ranges with the same start position as a full range and + // throw away their counts. + // Singleton ranges are only intended to split existing full ranges and should + // never expand into a full range. Consider 'if (cond) { ... } else { ... }' + // as a problematic example; if the then-block produces a continuation + // singleton, it would incorrectly expand into the else range. + // For more context, see https://crbug.com/v8/8237. + FilterAliasedSingletons(function); + // Rewrite all singletons (created e.g. by continuations and unconditional // control flow) to ranges. RewritePositionSingletonsToRanges(function); @@ -544,7 +581,7 @@ std::unique_ptr Coverage::Collect( CoverageFunction function(start, end, count, name); if (IsBlockMode(collectionMode) && info->HasCoverageInfo()) { - CollectBlockCoverage(isolate, &function, info, collectionMode); + CollectBlockCoverage(&function, info, collectionMode); } // Only include a function range if itself or its parent function is diff --git a/chromium/v8/src/debug/debug-evaluate.cc b/chromium/v8/src/debug/debug-evaluate.cc index 0dd23037723..583b41f1b28 100644 --- a/chromium/v8/src/debug/debug-evaluate.cc +++ b/chromium/v8/src/debug/debug-evaluate.cc @@ -32,7 +32,8 @@ MaybeHandle DebugEvaluate::Global(Isolate* isolate, ScriptOriginOptions origin_options(false, true); MaybeHandle maybe_function_info = Compiler::GetSharedFunctionInfoForScript( - source, Compiler::ScriptDetails(isolate->factory()->empty_string()), + isolate, source, + Compiler::ScriptDetails(isolate->factory()->empty_string()), origin_options, nullptr, nullptr, ScriptCompiler::kNoCompileOptions, ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE); @@ -254,111 +255,112 @@ namespace { bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) { // Use macro to include both inlined and non-inlined version of an intrinsic. -#define INTRINSIC_WHITELIST(V) \ - /* Conversions */ \ - V(NumberToStringSkipCache) \ - V(ToBigInt) \ - V(ToInteger) \ - V(ToLength) \ - V(ToNumber) \ - V(ToObject) \ - V(ToString) \ - /* Type checks */ \ - V(IsArray) \ - V(IsDate) \ - V(IsFunction) \ - V(IsJSProxy) \ - V(IsJSReceiver) \ - V(IsJSWeakMap) \ - V(IsJSWeakSet) \ - V(IsRegExp) \ - V(IsSmi) \ - V(IsTypedArray) \ - /* Loads */ \ - V(LoadLookupSlotForCall) \ - /* Arrays */ \ - V(ArraySpeciesConstructor) \ - V(EstimateNumberOfElements) \ - V(GetArrayKeys) \ - V(HasComplexElements) \ - V(HasFastPackedElements) \ - V(NewArray) \ - V(NormalizeElements) \ - V(PrepareElementsForSort) \ - V(TrySliceSimpleNonFastElements) \ - V(TypedArrayGetBuffer) \ - /* Errors */ \ - V(NewTypeError) \ - V(ReThrow) \ - V(ThrowCalledNonCallable) \ - V(ThrowInvalidStringLength) \ - V(ThrowIteratorResultNotAnObject) \ - V(ThrowReferenceError) \ - V(ThrowSymbolIteratorInvalid) \ - /* Strings */ \ - V(RegExpInternalReplace) \ - V(StringIncludes) \ - V(StringIndexOf) \ - V(StringReplaceOneCharWithString) \ - V(StringSubstring) \ - V(StringToNumber) \ - V(StringTrim) \ - /* BigInts */ \ - V(BigIntEqualToBigInt) \ - V(BigIntToBoolean) \ - V(BigIntToNumber) \ - /* Literals */ \ - V(CreateArrayLiteral) \ - V(CreateObjectLiteral) \ - V(CreateRegExpLiteral) \ - /* Called from builtins */ \ - V(AllocateInNewSpace) \ - V(AllocateInTargetSpace) \ - V(AllocateSeqOneByteString) \ - V(AllocateSeqTwoByteString) \ - V(ArrayIncludes_Slow) \ - V(ArrayIndexOf) \ - V(ArrayIsArray) \ - V(ClassOf) \ - V(GenerateRandomNumbers) \ - V(GetFunctionName) \ - V(GetOwnPropertyDescriptor) \ - V(GlobalPrint) \ - V(HasProperty) \ - V(ObjectCreate) \ - V(ObjectEntries) \ - V(ObjectEntriesSkipFastPath) \ - V(ObjectHasOwnProperty) \ - V(ObjectValues) \ - V(ObjectValuesSkipFastPath) \ - V(ObjectGetOwnPropertyNames) \ - V(ObjectGetOwnPropertyNamesTryFast) \ - V(RegExpInitializeAndCompile) \ - V(StackGuard) \ - V(StringAdd) \ - V(StringCharCodeAt) \ - V(StringEqual) \ - V(StringIndexOfUnchecked) \ - V(StringParseFloat) \ - V(StringParseInt) \ - V(SymbolDescriptiveString) \ - V(ThrowRangeError) \ - V(ThrowTypeError) \ - V(ToName) \ - V(TransitionElementsKind) \ - /* Misc. */ \ - V(Call) \ - V(CompleteInobjectSlackTrackingForMap) \ - V(HasInPrototypeChain) \ - V(MaxSmi) \ - V(NewObject) \ - V(SmiLexicographicCompare) \ - V(StringMaxLength) \ - V(StringToArray) \ - /* Test */ \ - V(GetOptimizationStatus) \ - V(OptimizeFunctionOnNextCall) \ - V(OptimizeOsr) \ +#define INTRINSIC_WHITELIST(V) \ + /* Conversions */ \ + V(NumberToString) \ + V(ToBigInt) \ + V(ToInteger) \ + V(ToLength) \ + V(ToNumber) \ + V(ToObject) \ + V(ToString) \ + /* Type checks */ \ + V(IsArray) \ + V(IsDate) \ + V(IsFunction) \ + V(IsJSProxy) \ + V(IsJSReceiver) \ + V(IsRegExp) \ + V(IsSmi) \ + V(IsTypedArray) \ + /* Loads */ \ + V(LoadLookupSlotForCall) \ + V(GetProperty) \ + /* Arrays */ \ + V(ArraySpeciesConstructor) \ + V(EstimateNumberOfElements) \ + V(GetArrayKeys) \ + V(HasComplexElements) \ + V(HasFastPackedElements) \ + V(NewArray) \ + V(NormalizeElements) \ + V(PrepareElementsForSort) \ + V(TrySliceSimpleNonFastElements) \ + V(TypedArrayGetBuffer) \ + /* Errors */ \ + V(NewTypeError) \ + V(ReThrow) \ + V(ThrowCalledNonCallable) \ + V(ThrowInvalidStringLength) \ + V(ThrowIteratorResultNotAnObject) \ + V(ThrowReferenceError) \ + V(ThrowSymbolIteratorInvalid) \ + /* Strings */ \ + V(RegExpInternalReplace) \ + V(StringIncludes) \ + V(StringIndexOf) \ + V(StringReplaceOneCharWithString) \ + V(StringSubstring) \ + V(StringToNumber) \ + V(StringTrim) \ + /* BigInts */ \ + V(BigIntEqualToBigInt) \ + V(BigIntToBoolean) \ + V(BigIntToNumber) \ + /* Literals */ \ + V(CreateArrayLiteral) \ + V(CreateArrayLiteralWithoutAllocationSite) \ + V(CreateObjectLiteral) \ + V(CreateObjectLiteralWithoutAllocationSite) \ + V(CreateRegExpLiteral) \ + /* Called from builtins */ \ + V(AllocateInNewSpace) \ + V(AllocateInTargetSpace) \ + V(AllocateSeqOneByteString) \ + V(AllocateSeqTwoByteString) \ + V(ArrayIncludes_Slow) \ + V(ArrayIndexOf) \ + V(ArrayIsArray) \ + V(ClassOf) \ + V(GenerateRandomNumbers) \ + V(GetFunctionName) \ + V(GetOwnPropertyDescriptor) \ + V(GlobalPrint) \ + V(HasProperty) \ + V(ObjectCreate) \ + V(ObjectEntries) \ + V(ObjectEntriesSkipFastPath) \ + V(ObjectHasOwnProperty) \ + V(ObjectValues) \ + V(ObjectValuesSkipFastPath) \ + V(ObjectGetOwnPropertyNames) \ + V(ObjectGetOwnPropertyNamesTryFast) \ + V(RegExpInitializeAndCompile) \ + V(StackGuard) \ + V(StringAdd) \ + V(StringCharCodeAt) \ + V(StringEqual) \ + V(StringIndexOfUnchecked) \ + V(StringParseFloat) \ + V(StringParseInt) \ + V(SymbolDescriptiveString) \ + V(ThrowRangeError) \ + V(ThrowTypeError) \ + V(ToName) \ + V(TransitionElementsKind) \ + /* Misc. */ \ + V(Call) \ + V(CompleteInobjectSlackTrackingForMap) \ + V(HasInPrototypeChain) \ + V(MaxSmi) \ + V(NewObject) \ + V(SmiLexicographicCompare) \ + V(StringMaxLength) \ + V(StringToArray) \ + /* Test */ \ + V(GetOptimizationStatus) \ + V(OptimizeFunctionOnNextCall) \ + V(OptimizeOsr) \ V(UnblockConcurrentRecompilation) #define CASE(Name) \ @@ -553,12 +555,14 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtins::Name id) { case Builtins::kArrayPrototypeValues: case Builtins::kArrayIncludes: case Builtins::kArrayPrototypeEntries: + case Builtins::kArrayPrototypeFill: case Builtins::kArrayPrototypeFind: case Builtins::kArrayPrototypeFindIndex: case Builtins::kArrayPrototypeFlat: case Builtins::kArrayPrototypeFlatMap: case Builtins::kArrayPrototypeKeys: case Builtins::kArrayPrototypeSlice: + case Builtins::kArrayPrototypeSort: case Builtins::kArrayForEach: case Builtins::kArrayEvery: case Builtins::kArraySome: @@ -567,6 +571,9 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtins::Name id) { case Builtins::kArrayMap: case Builtins::kArrayReduce: case Builtins::kArrayReduceRight: + // Trace builtins. + case Builtins::kIsTraceCategoryEnabled: + case Builtins::kTrace: // TypedArray builtins. case Builtins::kTypedArrayConstructor: case Builtins::kTypedArrayPrototypeBuffer: @@ -810,6 +817,7 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtins::Name id) { case Builtins::kArrayIteratorPrototypeNext: case Builtins::kArrayPrototypePop: case Builtins::kArrayPrototypePush: + case Builtins::kArrayPrototypeReverse: case Builtins::kArrayPrototypeShift: case Builtins::kArraySplice: case Builtins::kArrayUnshift: @@ -987,12 +995,7 @@ void DebugEvaluate::ApplySideEffectChecks( for (interpreter::BytecodeArrayIterator it(bytecode_array); !it.done(); it.Advance()) { interpreter::Bytecode bytecode = it.current_bytecode(); - if (BytecodeRequiresRuntimeCheck(bytecode)) { - interpreter::Bytecode debugbreak = - interpreter::Bytecodes::GetDebugBreak(bytecode); - bytecode_array->set(it.current_offset(), - interpreter::Bytecodes::ToByte(debugbreak)); - } + if (BytecodeRequiresRuntimeCheck(bytecode)) it.ApplyDebugBreak(); } } diff --git a/chromium/v8/src/debug/debug-scope-iterator.cc b/chromium/v8/src/debug/debug-scope-iterator.cc index dbade081cbb..e71c1c07b3c 100644 --- a/chromium/v8/src/debug/debug-scope-iterator.cc +++ b/chromium/v8/src/debug/debug-scope-iterator.cc @@ -4,11 +4,12 @@ #include "src/debug/debug-scope-iterator.h" -#include "src/api.h" +#include "src/api-inl.h" #include "src/debug/debug.h" #include "src/debug/liveedit.h" #include "src/frames-inl.h" #include "src/isolate.h" +#include "src/objects/js-generator-inl.h" #include "src/wasm/wasm-objects-inl.h" namespace v8 { diff --git a/chromium/v8/src/debug/debug-scopes.cc b/chromium/v8/src/debug/debug-scopes.cc index 8c6fae1d9fc..01cd017eb22 100644 --- a/chromium/v8/src/debug/debug-scopes.cc +++ b/chromium/v8/src/debug/debug-scopes.cc @@ -12,6 +12,7 @@ #include "src/frames-inl.h" #include "src/globals.h" #include "src/isolate-inl.h" +#include "src/objects/js-generator-inl.h" #include "src/objects/module.h" #include "src/parsing/parse-info.h" #include "src/parsing/parsing.h" diff --git a/chromium/v8/src/debug/debug-stack-trace-iterator.cc b/chromium/v8/src/debug/debug-stack-trace-iterator.cc index bf1e1b623b4..14d2850b69c 100644 --- a/chromium/v8/src/debug/debug-stack-trace-iterator.cc +++ b/chromium/v8/src/debug/debug-stack-trace-iterator.cc @@ -4,7 +4,7 @@ #include "src/debug/debug-stack-trace-iterator.h" -#include "src/api.h" +#include "src/api-inl.h" #include "src/debug/debug-evaluate.h" #include "src/debug/debug-scope-iterator.h" #include "src/debug/debug.h" @@ -173,8 +173,7 @@ v8::MaybeLocal DebugStackTraceIterator::Evaluate( v8::Local source, bool throw_on_side_effect) { DCHECK(!Done()); Handle value; - i::SafeForInterruptsScope safe_for_interrupt_scope( - isolate_, i::StackGuard::TERMINATE_EXECUTION); + i::SafeForInterruptsScope safe_for_interrupt_scope(isolate_); if (!DebugEvaluate::Local(isolate_, iterator_.frame()->id(), inlined_frame_index_, Utils::OpenHandle(*source), throw_on_side_effect) diff --git a/chromium/v8/src/debug/debug.cc b/chromium/v8/src/debug/debug.cc index 47de9523a50..3a3a48b699a 100644 --- a/chromium/v8/src/debug/debug.cc +++ b/chromium/v8/src/debug/debug.cc @@ -7,7 +7,7 @@ #include #include -#include "src/api.h" +#include "src/api-inl.h" #include "src/arguments.h" #include "src/assembler-inl.h" #include "src/base/platform/mutex.h" @@ -30,6 +30,7 @@ #include "src/log.h" #include "src/messages.h" #include "src/objects/debug-objects-inl.h" +#include "src/objects/js-generator-inl.h" #include "src/objects/js-promise-inl.h" #include "src/snapshot/natives.h" #include "src/snapshot/snapshot.h" @@ -278,15 +279,12 @@ void BreakIterator::SkipToPosition(int position) { void BreakIterator::SetDebugBreak() { DebugBreakType debug_break_type = GetDebugBreakType(); if (debug_break_type == DEBUGGER_STATEMENT) return; + HandleScope scope(isolate()); DCHECK(debug_break_type >= DEBUG_BREAK_SLOT); - BytecodeArray* bytecode_array = debug_info_->DebugBytecodeArray(); - interpreter::Bytecode bytecode = - interpreter::Bytecodes::FromByte(bytecode_array->get(code_offset())); - if (interpreter::Bytecodes::IsDebugBreak(bytecode)) return; - interpreter::Bytecode debugbreak = - interpreter::Bytecodes::GetDebugBreak(bytecode); - bytecode_array->set(code_offset(), - interpreter::Bytecodes::ToByte(debugbreak)); + Handle bytecode_array(debug_info_->DebugBytecodeArray(), + isolate()); + interpreter::BytecodeArrayAccessor(bytecode_array, code_offset()) + .ApplyDebugBreak(); } void BreakIterator::ClearDebugBreak() { @@ -322,6 +320,7 @@ BreakLocation BreakIterator::GetBreakLocation() { generator_object_reg_index); } +Isolate* BreakIterator::isolate() { return debug_info_->GetIsolate(); } void DebugFeatureTracker::Track(DebugFeatureTracker::Feature feature) { uint32_t mask = 1 << feature; @@ -334,8 +333,6 @@ void DebugFeatureTracker::Track(DebugFeatureTracker::Feature feature) { // Threading support. void Debug::ThreadInit() { - thread_local_.break_count_ = 0; - thread_local_.break_id_ = 0; thread_local_.break_frame_id_ = StackFrame::NO_ID; thread_local_.last_step_action_ = StepNone; thread_local_.last_statement_position_ = kNoSourcePosition; @@ -355,19 +352,31 @@ void Debug::ThreadInit() { char* Debug::ArchiveDebug(char* storage) { - // Simply reset state. Don't archive anything. - ThreadInit(); + MemCopy(storage, reinterpret_cast(&thread_local_), + ArchiveSpacePerThread()); return storage + ArchiveSpacePerThread(); } - char* Debug::RestoreDebug(char* storage) { - // Simply reset state. Don't restore anything. - ThreadInit(); + MemCopy(reinterpret_cast(&thread_local_), storage, + ArchiveSpacePerThread()); + + // Enter the debugger. + DebugScope debug_scope(this); + + // Clear any one-shot breakpoints that may have been set by the other + // thread, and reapply breakpoints for this thread. + ClearOneShot(); + + if (thread_local_.last_step_action_ != StepNone) { + // Reset the previous step action for this thread. + PrepareStep(thread_local_.last_step_action_); + } + return storage + ArchiveSpacePerThread(); } -int Debug::ArchiveSpacePerThread() { return 0; } +int Debug::ArchiveSpacePerThread() { return sizeof(ThreadLocal); } void Debug::Iterate(RootVisitor* v) { v->VisitRootPointer(Root::kDebug, nullptr, &thread_local_.return_value_); @@ -1571,11 +1580,10 @@ void Debug::FreeDebugInfoListNode(DebugInfoListNode* prev, prev->set_next(node->next()); } - // Pack function_identifier back into the - // SFI::function_identifier_or_debug_info field. + // Pack script back into the + // SFI::script_or_debug_info field. Handle debug_info(node->debug_info()); - debug_info->shared()->set_function_identifier_or_debug_info( - debug_info->function_identifier()); + debug_info->shared()->set_script_or_debug_info(debug_info->script()); delete node; } @@ -1620,12 +1628,12 @@ Handle Debug::GetLoadedScripts() { isolate_->heap()->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, GarbageCollectionReason::kDebugger); Factory* factory = isolate_->factory(); - if (!factory->script_list()->IsFixedArrayOfWeakCells()) { + if (!factory->script_list()->IsWeakArrayList()) { return factory->empty_fixed_array(); } - Handle array = - Handle::cast(factory->script_list()); - Handle results = factory->NewFixedArray(array->Length()); + Handle array = + Handle::cast(factory->script_list()); + Handle results = factory->NewFixedArray(array->length()); int length = 0; { Script::Iterator iterator(isolate_); @@ -1730,7 +1738,6 @@ void Debug::OnException(Handle exception, Handle promise) { DebugScope debug_scope(this); HandleScope scope(isolate_); - PostponeInterruptsScope postpone(isolate_); DisableBreak no_recursive_break(this); Handle native_context(isolate_->native_context()); @@ -1858,7 +1865,6 @@ void Debug::ProcessCompileEvent(bool has_compile_error, Handle