diff options
Diffstat (limited to 'chromium/v8/src/debug')
33 files changed, 449 insertions, 371 deletions
diff --git a/chromium/v8/src/debug/arm/debug-arm.cc b/chromium/v8/src/debug/arm/debug-arm.cc index 6844fe28a90..542ff5c4dff 100644 --- a/chromium/v8/src/debug/arm/debug-arm.cc +++ b/chromium/v8/src/debug/arm/debug-arm.cc @@ -6,11 +6,11 @@ #include "src/debug/debug.h" -#include "src/assembler-inl.h" +#include "src/codegen/assembler-inl.h" +#include "src/codegen/macro-assembler.h" #include "src/debug/liveedit.h" -#include "src/frames-inl.h" -#include "src/macro-assembler.h" -#include "src/objects-inl.h" +#include "src/execution/frames-inl.h" +#include "src/objects/objects-inl.h" namespace v8 { namespace internal { diff --git a/chromium/v8/src/debug/arm64/debug-arm64.cc b/chromium/v8/src/debug/arm64/debug-arm64.cc index e617964e515..de72ce68e84 100644 --- a/chromium/v8/src/debug/arm64/debug-arm64.cc +++ b/chromium/v8/src/debug/arm64/debug-arm64.cc @@ -6,11 +6,11 @@ #include "src/debug/debug.h" -#include "src/arm64/macro-assembler-arm64-inl.h" +#include "src/codegen/arm64/macro-assembler-arm64-inl.h" #include "src/debug/liveedit.h" -#include "src/frame-constants.h" -#include "src/frames-inl.h" -#include "src/objects-inl.h" +#include "src/execution/frame-constants.h" +#include "src/execution/frames-inl.h" +#include "src/objects/objects-inl.h" namespace v8 { namespace internal { diff --git a/chromium/v8/src/debug/debug-coverage.cc b/chromium/v8/src/debug/debug-coverage.cc index f4a7e5ac775..4021cd50389 100644 --- a/chromium/v8/src/debug/debug-coverage.cc +++ b/chromium/v8/src/debug/debug-coverage.cc @@ -4,14 +4,15 @@ #include "src/debug/debug-coverage.h" +#include "src/ast/ast-source-ranges.h" #include "src/ast/ast.h" #include "src/base/hashmap.h" #include "src/debug/debug.h" -#include "src/deoptimizer.h" -#include "src/frames-inl.h" -#include "src/isolate.h" -#include "src/objects.h" +#include "src/deoptimizer/deoptimizer.h" +#include "src/execution/frames-inl.h" +#include "src/execution/isolate.h" #include "src/objects/debug-objects-inl.h" +#include "src/objects/objects.h" namespace v8 { namespace internal { @@ -48,15 +49,15 @@ class SharedToCounterMap namespace { int StartPosition(SharedFunctionInfo info) { - int start = info->function_token_position(); - if (start == kNoSourcePosition) start = info->StartPosition(); + int start = info.function_token_position(); + if (start == kNoSourcePosition) start = info.StartPosition(); return start; } bool CompareSharedFunctionInfo(SharedFunctionInfo a, SharedFunctionInfo b) { int a_start = StartPosition(a); int b_start = StartPosition(b); - if (a_start == b_start) return a->EndPosition() > b->EndPosition(); + if (a_start == b_start) return a.EndPosition() > b.EndPosition(); return a_start < b_start; } @@ -73,18 +74,18 @@ void SortBlockData(std::vector<CoverageBlock>& v) { } std::vector<CoverageBlock> GetSortedBlockData(SharedFunctionInfo shared) { - DCHECK(shared->HasCoverageInfo()); + DCHECK(shared.HasCoverageInfo()); CoverageInfo coverage_info = - CoverageInfo::cast(shared->GetDebugInfo()->coverage_info()); + CoverageInfo::cast(shared.GetDebugInfo().coverage_info()); std::vector<CoverageBlock> result; - if (coverage_info->SlotCount() == 0) return result; + if (coverage_info.SlotCount() == 0) return result; - for (int i = 0; i < coverage_info->SlotCount(); i++) { - const int start_pos = coverage_info->StartSourcePosition(i); - const int until_pos = coverage_info->EndSourcePosition(i); - const int count = coverage_info->BlockCount(i); + for (int i = 0; i < coverage_info.SlotCount(); i++) { + const int start_pos = coverage_info.StartSourcePosition(i); + const int until_pos = coverage_info.EndSourcePosition(i); + const int count = coverage_info.BlockCount(i); DCHECK_NE(kNoSourcePosition, start_pos); result.emplace_back(start_pos, until_pos, count); @@ -103,11 +104,7 @@ std::vector<CoverageBlock> GetSortedBlockData(SharedFunctionInfo shared) { class CoverageBlockIterator final { public: explicit CoverageBlockIterator(CoverageFunction* function) - : function_(function), - ended_(false), - delete_current_(false), - read_index_(-1), - write_index_(-1) { + : function_(function) { DCHECK(std::is_sorted(function_->blocks.begin(), function_->blocks.end(), CompareCoverageBlock)); } @@ -223,10 +220,10 @@ class CoverageBlockIterator final { CoverageFunction* function_; std::vector<CoverageBlock> nesting_stack_; - bool ended_; - bool delete_current_; - int read_index_; - int write_index_; + bool ended_ = false; + bool delete_current_ = false; + int read_index_ = -1; + int write_index_ = -1; }; bool HaveSameSourceRange(const CoverageBlock& lhs, const CoverageBlock& rhs) { @@ -312,6 +309,30 @@ void MergeNestedRanges(CoverageFunction* function) { } } +void RewriteFunctionScopeCounter(CoverageFunction* function) { + // Every function must have at least the top-level function counter. + DCHECK(!function->blocks.empty()); + + CoverageBlockIterator iter(function); + if (iter.Next()) { + DCHECK(iter.IsTopLevel()); + + CoverageBlock& block = iter.GetBlock(); + if (block.start == SourceRange::kFunctionLiteralSourcePosition && + block.end == SourceRange::kFunctionLiteralSourcePosition) { + // If a function-scope block exists, overwrite the function count. It has + // a more reliable count than what we get from the FeedbackVector (which + // is imprecise e.g. for generator functions and optimized code). + function->count = block.count; + + // Then delete it; for compatibility with non-block coverage modes, the + // function-scope block is expected in CoverageFunction, not as a + // CoverageBlock. + iter.DeleteBlock(); + } + } +} + void FilterAliasedSingletons(CoverageFunction* function) { CoverageBlockIterator iter(function); @@ -365,13 +386,13 @@ void ClampToBinary(CoverageFunction* function) { } void ResetAllBlockCounts(SharedFunctionInfo shared) { - DCHECK(shared->HasCoverageInfo()); + DCHECK(shared.HasCoverageInfo()); CoverageInfo coverage_info = - CoverageInfo::cast(shared->GetDebugInfo()->coverage_info()); + CoverageInfo::cast(shared.GetDebugInfo().coverage_info()); - for (int i = 0; i < coverage_info->SlotCount(); i++) { - coverage_info->ResetBlockCount(i); + for (int i = 0; i < coverage_info.SlotCount(); i++) { + coverage_info.ResetBlockCount(i); } } @@ -395,16 +416,32 @@ bool IsBinaryMode(debug::CoverageMode mode) { } } -void CollectBlockCoverage(CoverageFunction* function, SharedFunctionInfo info, - debug::CoverageMode mode) { +void CollectBlockCoverageInternal(CoverageFunction* function, + SharedFunctionInfo info, + debug::CoverageMode mode) { DCHECK(IsBlockMode(mode)); + // Functions with empty source ranges are not interesting to report. This can + // happen e.g. for internally-generated functions like class constructors. + if (!function->HasNonEmptySourceRange()) return; + function->has_block_coverage = true; function->blocks = GetSortedBlockData(info); // If in binary mode, only report counts of 0/1. if (mode == debug::CoverageMode::kBlockBinary) ClampToBinary(function); + // To stay compatible with non-block coverage modes, the function-scope count + // is expected to be in the CoverageFunction, not as part of its blocks. + // This finds the function-scope counter, overwrites CoverageFunction::count, + // and removes it from the block list. + // + // Important: Must be called before other transformation passes. + RewriteFunctionScopeCounter(function); + + // Functions without blocks don't need to be processed further. + if (!function->HasBlocks()) return; + // 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 @@ -435,6 +472,11 @@ void CollectBlockCoverage(CoverageFunction* function, SharedFunctionInfo info, // Filter out ranges of zero length. FilterEmptyRanges(function); +} + +void CollectBlockCoverage(CoverageFunction* function, SharedFunctionInfo info, + debug::CoverageMode mode) { + CollectBlockCoverageInternal(function, info, mode); // Reset all counters on the DebugInfo to zero. ResetAllBlockCounts(info); @@ -479,10 +521,10 @@ std::unique_ptr<Coverage> Coverage::Collect( isolate->factory()->feedback_vectors_for_profiling_tools()); for (int i = 0; i < list->Length(); i++) { FeedbackVector vector = FeedbackVector::cast(list->Get(i)); - SharedFunctionInfo shared = vector->shared_function_info(); - DCHECK(shared->IsSubjectToDebugging()); - uint32_t count = static_cast<uint32_t>(vector->invocation_count()); - if (reset_count) vector->clear_invocation_count(); + SharedFunctionInfo shared = vector.shared_function_info(); + DCHECK(shared.IsSubjectToDebugging()); + uint32_t count = static_cast<uint32_t>(vector.invocation_count()); + if (reset_count) vector.clear_invocation_count(); counter_map.Add(shared, count); } break; @@ -495,13 +537,35 @@ std::unique_ptr<Coverage> Coverage::Collect( HeapIterator heap_iterator(isolate->heap()); for (HeapObject current_obj = heap_iterator.next(); !current_obj.is_null(); current_obj = heap_iterator.next()) { - if (!current_obj->IsFeedbackVector()) continue; - FeedbackVector vector = FeedbackVector::cast(current_obj); - SharedFunctionInfo shared = vector->shared_function_info(); - if (!shared->IsSubjectToDebugging()) continue; - uint32_t count = static_cast<uint32_t>(vector->invocation_count()); + if (!current_obj.IsJSFunction()) continue; + JSFunction func = JSFunction::cast(current_obj); + SharedFunctionInfo shared = func.shared(); + if (!shared.IsSubjectToDebugging()) continue; + if (!(func.has_feedback_vector() || + func.has_closure_feedback_cell_array())) + continue; + uint32_t count = 0; + if (func.has_feedback_vector()) { + count = + static_cast<uint32_t>(func.feedback_vector().invocation_count()); + } else if (func.raw_feedback_cell().interrupt_budget() < + FLAG_budget_for_feedback_vector_allocation) { + // We haven't allocated feedback vector, but executed the function + // atleast once. We don't have precise invocation count here. + count = 1; + } counter_map.Add(shared, count); } + + // Also check functions on the stack to collect the count map. With lazy + // feedback allocation we may miss counting functions if the feedback + // vector wasn't allocated yet and the function's interrupt budget wasn't + // updated (i.e. it didn't execute return / jump). + for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) { + SharedFunctionInfo shared = it.frame()->function().shared(); + if (counter_map.Get(shared) != 0) continue; + counter_map.Add(shared, 1); + } break; } } @@ -512,7 +576,7 @@ std::unique_ptr<Coverage> Coverage::Collect( Script::Iterator scripts(isolate); for (Script script = scripts.Next(); !script.is_null(); script = scripts.Next()) { - if (!script->IsUserJavaScript()) continue; + if (!script.IsUserJavaScript()) continue; // Create and add new script data. Handle<Script> script_handle(script, isolate); @@ -537,7 +601,7 @@ std::unique_ptr<Coverage> Coverage::Collect( // Use sorted list to reconstruct function nesting. for (SharedFunctionInfo info : sorted) { int start = StartPosition(info); - int end = info->EndPosition(); + int end = info.EndPosition(); uint32_t count = counter_map.Get(info); // Find the correct outer function based on start position. while (!nesting.empty() && functions->at(nesting.back()).end <= start) { @@ -550,8 +614,8 @@ std::unique_ptr<Coverage> Coverage::Collect( break; case v8::debug::CoverageMode::kBlockBinary: case v8::debug::CoverageMode::kPreciseBinary: - count = info->has_reported_binary_coverage() ? 0 : 1; - info->set_has_reported_binary_coverage(true); + count = info.has_reported_binary_coverage() ? 0 : 1; + info.set_has_reported_binary_coverage(true); break; case v8::debug::CoverageMode::kBestEffort: count = 1; @@ -559,20 +623,25 @@ std::unique_ptr<Coverage> Coverage::Collect( } } - Handle<String> name(info->DebugName(), isolate); + Handle<String> name(info.DebugName(), isolate); CoverageFunction function(start, end, count, name); - if (IsBlockMode(collectionMode) && info->HasCoverageInfo()) { + if (IsBlockMode(collectionMode) && info.HasCoverageInfo()) { CollectBlockCoverage(&function, info, collectionMode); } // Only include a function range if itself or its parent function is - // covered, or if it contains non-trivial block coverage. + // covered, or if it contains non-trivial block coverage. It must also + // have a non-empty source range (otherwise it is not interesting to + // report). bool is_covered = (count != 0); bool parent_is_covered = (!nesting.empty() && functions->at(nesting.back()).count != 0); bool has_block_coverage = !function.blocks.empty(); - if (is_covered || parent_is_covered || has_block_coverage) { + bool function_is_relevant = + (is_covered || parent_is_covered || has_block_coverage); + + if (function.HasNonEmptySourceRange() && function_is_relevant) { nesting.push_back(functions->size()); functions->emplace_back(function); } @@ -607,24 +676,37 @@ void Coverage::SelectMode(Isolate* isolate, debug::CoverageMode mode) { // increment invocation count. Deoptimizer::DeoptimizeAll(isolate); - // Root all feedback vectors to avoid early collection. - isolate->MaybeInitializeVectorListFromHeap(); - - HeapIterator heap_iterator(isolate->heap()); - for (HeapObject o = heap_iterator.next(); !o.is_null(); - o = heap_iterator.next()) { - if (IsBinaryMode(mode) && o->IsSharedFunctionInfo()) { - // If collecting binary coverage, reset - // SFI::has_reported_binary_coverage to avoid optimizing / inlining - // functions before they have reported coverage. - SharedFunctionInfo shared = SharedFunctionInfo::cast(o); - shared->set_has_reported_binary_coverage(false); - } else if (o->IsFeedbackVector()) { - // In any case, clear any collected invocation counts. - FeedbackVector::cast(o)->clear_invocation_count(); + std::vector<Handle<JSFunction>> funcs_needing_feedback_vector; + { + HeapIterator heap_iterator(isolate->heap()); + for (HeapObject o = heap_iterator.next(); !o.is_null(); + o = heap_iterator.next()) { + if (o.IsJSFunction()) { + JSFunction func = JSFunction::cast(o); + if (func.has_closure_feedback_cell_array()) { + funcs_needing_feedback_vector.push_back( + Handle<JSFunction>(func, isolate)); + } + } else if (IsBinaryMode(mode) && o.IsSharedFunctionInfo()) { + // If collecting binary coverage, reset + // SFI::has_reported_binary_coverage to avoid optimizing / inlining + // functions before they have reported coverage. + SharedFunctionInfo shared = SharedFunctionInfo::cast(o); + shared.set_has_reported_binary_coverage(false); + } else if (o.IsFeedbackVector()) { + // In any case, clear any collected invocation counts. + FeedbackVector::cast(o).clear_invocation_count(); + } } } + for (Handle<JSFunction> func : funcs_needing_feedback_vector) { + JSFunction::EnsureFeedbackVector(func); + } + + // Root all feedback vectors to avoid early collection. + isolate->MaybeInitializeVectorListFromHeap(); + break; } } diff --git a/chromium/v8/src/debug/debug-coverage.h b/chromium/v8/src/debug/debug-coverage.h index e319f01a322..9c1f0bcc2c4 100644 --- a/chromium/v8/src/debug/debug-coverage.h +++ b/chromium/v8/src/debug/debug-coverage.h @@ -8,8 +8,8 @@ #include <vector> #include "src/debug/debug-interface.h" -#include "src/handles.h" -#include "src/objects.h" +#include "src/handles/handles.h" +#include "src/objects/objects.h" namespace v8 { namespace internal { @@ -20,6 +20,7 @@ class Isolate; struct CoverageBlock { CoverageBlock(int s, int e, uint32_t c) : start(s), end(e), count(c) {} CoverageBlock() : CoverageBlock(kNoSourcePosition, kNoSourcePosition, 0) {} + int start; int end; uint32_t count; @@ -28,6 +29,10 @@ struct CoverageBlock { struct CoverageFunction { CoverageFunction(int s, int e, uint32_t c, Handle<String> n) : start(s), end(e), count(c), name(n), has_block_coverage(false) {} + + bool HasNonEmptySourceRange() const { return start < end && start >= 0; } + bool HasBlocks() const { return !blocks.empty(); } + int start; int end; uint32_t count; diff --git a/chromium/v8/src/debug/debug-evaluate.cc b/chromium/v8/src/debug/debug-evaluate.cc index 7bf444231ed..65e62f2aac8 100644 --- a/chromium/v8/src/debug/debug-evaluate.cc +++ b/chromium/v8/src/debug/debug-evaluate.cc @@ -4,18 +4,18 @@ #include "src/debug/debug-evaluate.h" -#include "src/accessors.h" -#include "src/assembler-inl.h" -#include "src/compiler.h" -#include "src/contexts.h" +#include "src/builtins/accessors.h" +#include "src/codegen/assembler-inl.h" +#include "src/codegen/compiler.h" +#include "src/common/globals.h" #include "src/debug/debug-frames.h" #include "src/debug/debug-scopes.h" #include "src/debug/debug.h" -#include "src/frames-inl.h" -#include "src/globals.h" +#include "src/execution/frames-inl.h" +#include "src/execution/isolate-inl.h" #include "src/interpreter/bytecode-array-iterator.h" #include "src/interpreter/bytecodes.h" -#include "src/isolate-inl.h" +#include "src/objects/contexts.h" #include "src/snapshot/snapshot.h" namespace v8 { @@ -90,7 +90,7 @@ MaybeHandle<Object> DebugEvaluate::WithTopmostArguments(Isolate* isolate, // Get context and receiver. Handle<Context> native_context( - Context::cast(it.frame()->context())->native_context(), isolate); + Context::cast(it.frame()->context()).native_context(), isolate); // Materialize arguments as property on an extension object. Handle<JSObject> materialized = factory->NewJSObjectWithNullProto(); @@ -115,7 +115,7 @@ MaybeHandle<Object> DebugEvaluate::WithTopmostArguments(Isolate* isolate, factory->NewDebugEvaluateContext(native_context, scope_info, materialized, Handle<Context>(), Handle<StringSet>()); Handle<SharedFunctionInfo> outer_info( - native_context->empty_function()->shared(), isolate); + native_context->empty_function().shared(), isolate); Handle<JSObject> receiver(native_context->global_proxy(), isolate); const bool throw_on_side_effect = false; MaybeHandle<Object> maybe_result = @@ -226,7 +226,7 @@ void DebugEvaluate::ContextBuilder::UpdateValues() { .ToHandleChecked(); for (int i = 0; i < keys->length(); i++) { - DCHECK(keys->get(i)->IsString()); + DCHECK(keys->get(i).IsString()); Handle<String> key(String::cast(keys->get(i)), isolate_); Handle<Object> value = JSReceiver::GetDataProperty(element.materialized_object, key); @@ -248,28 +248,21 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) { V(ToLength) \ V(ToNumber) \ V(ToObject) \ - V(ToString) \ + V(ToStringRT) \ /* Type checks */ \ V(IsArray) \ 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) \ @@ -339,7 +332,6 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) { V(IncrementUseCounter) \ V(MaxSmi) \ V(NewObject) \ - V(SmiLexicographicCompare) \ V(StringMaxLength) \ V(StringToArray) \ /* Test */ \ @@ -520,7 +512,6 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtins::Name id) { case Builtins::kArrayPrototypeKeys: case Builtins::kArrayPrototypeLastIndexOf: case Builtins::kArrayPrototypeSlice: - case Builtins::kArrayPrototypeSort: case Builtins::kArrayPrototypeToLocaleString: case Builtins::kArrayPrototypeToString: case Builtins::kArrayForEach: @@ -794,6 +785,7 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtins::Name id) { case Builtins::kArrayPrototypeReverse: case Builtins::kArrayPrototypeShift: case Builtins::kArrayPrototypeUnshift: + case Builtins::kArrayPrototypeSort: case Builtins::kArrayPrototypeSplice: case Builtins::kArrayUnshift: // Map builtins. @@ -846,7 +838,7 @@ DebugInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState( Isolate* isolate, Handle<SharedFunctionInfo> info) { if (FLAG_trace_side_effect_free_debug_evaluate) { PrintF("[debug-evaluate] Checking function %s for side effect.\n", - info->DebugName()->ToCString().get()); + info->DebugName().ToCString().get()); } DCHECK(info->is_compiled()); @@ -887,8 +879,8 @@ DebugInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState( return requires_runtime_checks ? DebugInfo::kRequiresRuntimeChecks : DebugInfo::kHasNoSideEffect; } else if (info->IsApiFunction()) { - if (info->GetCode()->is_builtin()) { - return info->GetCode()->builtin_index() == Builtins::kHandleApiCall + if (info->GetCode().is_builtin()) { + return info->GetCode().builtin_index() == Builtins::kHandleApiCall ? DebugInfo::kHasNoSideEffect : DebugInfo::kHasSideEffects; } @@ -1031,9 +1023,9 @@ void DebugEvaluate::VerifyTransitiveBuiltins(Isolate* isolate) { DCHECK(RelocInfo::IsCodeTargetMode(rinfo->rmode())); Code callee_code = isolate->heap()->GcSafeFindCodeForInnerPointer( rinfo->target_address()); - if (!callee_code->is_builtin()) continue; + if (!callee_code.is_builtin()) continue; Builtins::Name callee = - static_cast<Builtins::Name>(callee_code->builtin_index()); + static_cast<Builtins::Name>(callee_code.builtin_index()); if (BuiltinGetSideEffectState(callee) == DebugInfo::kHasNoSideEffect) { continue; } diff --git a/chromium/v8/src/debug/debug-evaluate.h b/chromium/v8/src/debug/debug-evaluate.h index 9aaa959bc27..50817691d72 100644 --- a/chromium/v8/src/debug/debug-evaluate.h +++ b/chromium/v8/src/debug/debug-evaluate.h @@ -9,7 +9,7 @@ #include "src/debug/debug-frames.h" #include "src/debug/debug-scopes.h" -#include "src/objects.h" +#include "src/objects/objects.h" #include "src/objects/shared-function-info.h" #include "src/objects/string-table.h" diff --git a/chromium/v8/src/debug/debug-frames.cc b/chromium/v8/src/debug/debug-frames.cc index 74546232275..a6ee31738dc 100644 --- a/chromium/v8/src/debug/debug-frames.cc +++ b/chromium/v8/src/debug/debug-frames.cc @@ -4,8 +4,8 @@ #include "src/debug/debug-frames.h" -#include "src/accessors.h" -#include "src/frames-inl.h" +#include "src/builtins/accessors.h" +#include "src/execution/frames-inl.h" #include "src/wasm/wasm-interpreter.h" #include "src/wasm/wasm-objects-inl.h" @@ -47,7 +47,7 @@ FrameInspector::FrameInspector(StandardFrame* frame, int inlined_frame_index, wasm_interpreted_frame_ = WasmInterpreterEntryFrame::cast(frame_) ->debug_info() - ->GetInterpretedFrame(frame_->fp(), inlined_frame_index); + .GetInterpretedFrame(frame_->fp(), inlined_frame_index); DCHECK(wasm_interpreted_frame_); } } @@ -97,9 +97,9 @@ bool FrameInspector::ParameterIsShadowedByContextLocal( RedirectActiveFunctions::RedirectActiveFunctions(SharedFunctionInfo shared, Mode mode) : shared_(shared), mode_(mode) { - DCHECK(shared->HasBytecodeArray()); + DCHECK(shared.HasBytecodeArray()); if (mode == Mode::kUseDebugBytecode) { - DCHECK(shared->HasDebugInfo()); + DCHECK(shared.HasDebugInfo()); } } @@ -109,12 +109,12 @@ void RedirectActiveFunctions::VisitThread(Isolate* isolate, JavaScriptFrame* frame = it.frame(); JSFunction function = frame->function(); if (!frame->is_interpreted()) continue; - if (function->shared() != shared_) continue; + if (function.shared() != shared_) continue; InterpretedFrame* interpreted_frame = reinterpret_cast<InterpretedFrame*>(frame); BytecodeArray bytecode = mode_ == Mode::kUseDebugBytecode - ? shared_->GetDebugInfo()->DebugBytecodeArray() - : shared_->GetBytecodeArray(); + ? shared_.GetDebugInfo().DebugBytecodeArray() + : shared_.GetBytecodeArray(); interpreted_frame->PatchBytecodeArray(bytecode); } } diff --git a/chromium/v8/src/debug/debug-frames.h b/chromium/v8/src/debug/debug-frames.h index 9c4fafd4041..5ee4f8b61f4 100644 --- a/chromium/v8/src/debug/debug-frames.h +++ b/chromium/v8/src/debug/debug-frames.h @@ -5,11 +5,11 @@ #ifndef V8_DEBUG_DEBUG_FRAMES_H_ #define V8_DEBUG_DEBUG_FRAMES_H_ -#include "src/deoptimizer.h" -#include "src/frames.h" -#include "src/isolate.h" -#include "src/objects.h" -#include "src/v8threads.h" +#include "src/deoptimizer/deoptimizer.h" +#include "src/execution/frames.h" +#include "src/execution/isolate.h" +#include "src/execution/v8threads.h" +#include "src/objects/objects.h" #include "src/wasm/wasm-interpreter.h" namespace v8 { diff --git a/chromium/v8/src/debug/debug-interface.h b/chromium/v8/src/debug/debug-interface.h index bdefe78225c..79222371f96 100644 --- a/chromium/v8/src/debug/debug-interface.h +++ b/chromium/v8/src/debug/debug-interface.h @@ -9,8 +9,8 @@ #include "include/v8-util.h" #include "include/v8.h" +#include "src/common/globals.h" #include "src/debug/interface-types.h" -#include "src/globals.h" namespace v8 { @@ -57,6 +57,12 @@ MaybeLocal<Array> GetInternalProperties(Isolate* isolate, Local<Value> value); V8_EXPORT_PRIVATE MaybeLocal<Array> GetPrivateFields(Local<Context> context, Local<Object> value); +/** + * Forwards to v8::Object::CreationContext, but with special handling for + * JSGlobalProxy objects. + */ +Local<Context> GetCreationContext(Local<Object> value); + enum ExceptionBreakState { NoBreakOnException = 0, BreakOnUncaughtException = 1, @@ -141,6 +147,7 @@ class V8_EXPORT_PRIVATE Script { LiveEditResult* result) const; bool SetBreakpoint(v8::Local<v8::String> condition, debug::Location* location, BreakpointId* id) const; + bool SetBreakpointOnScriptEntry(BreakpointId* id) const; }; // Specialization for wasm Scripts. @@ -482,13 +489,13 @@ class PostponeInterruptsScope { class WeakMap : public v8::Object { public: - V8_WARN_UNUSED_RESULT v8::MaybeLocal<v8::Value> Get( + V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT v8::MaybeLocal<v8::Value> Get( v8::Local<v8::Context> context, v8::Local<v8::Value> key); - V8_WARN_UNUSED_RESULT v8::MaybeLocal<WeakMap> Set( + V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT v8::MaybeLocal<WeakMap> Set( v8::Local<v8::Context> context, v8::Local<v8::Value> key, v8::Local<v8::Value> value); - static Local<WeakMap> New(v8::Isolate* isolate); + V8_EXPORT_PRIVATE static Local<WeakMap> New(v8::Isolate* isolate); V8_INLINE static WeakMap* Cast(Value* obj); private: diff --git a/chromium/v8/src/debug/debug-property-iterator.cc b/chromium/v8/src/debug/debug-property-iterator.cc index 1bef58192c9..a445f55f6dc 100644 --- a/chromium/v8/src/debug/debug-property-iterator.cc +++ b/chromium/v8/src/debug/debug-property-iterator.cc @@ -4,12 +4,12 @@ #include "src/debug/debug-property-iterator.h" -#include "src/api-inl.h" +#include "src/api/api-inl.h" #include "src/base/flags.h" -#include "src/keys.h" #include "src/objects/js-array-buffer-inl.h" -#include "src/property-descriptor.h" -#include "src/property-details.h" +#include "src/objects/keys.h" +#include "src/objects/property-descriptor.h" +#include "src/objects/property-details.h" namespace v8 { @@ -148,8 +148,13 @@ void DebugPropertyIterator::FillKeysForCurrentPrototypeAndStage() { bool has_exotic_indices = receiver->IsJSTypedArray(); if (stage_ == kExoticIndices) { if (!has_exotic_indices) return; - exotic_length_ = static_cast<uint32_t>( - Handle<JSTypedArray>::cast(receiver)->length_value()); + Handle<JSTypedArray> typed_array = Handle<JSTypedArray>::cast(receiver); + if (typed_array->WasDetached()) { + exotic_length_ = 0; + } else { + // TODO(bmeurer, v8:4153): Change this to size_t later. + exotic_length_ = static_cast<uint32_t>(typed_array->length()); + } return; } bool skip_indices = has_exotic_indices; diff --git a/chromium/v8/src/debug/debug-property-iterator.h b/chromium/v8/src/debug/debug-property-iterator.h index 6a527f5dc75..822260afb64 100644 --- a/chromium/v8/src/debug/debug-property-iterator.h +++ b/chromium/v8/src/debug/debug-property-iterator.h @@ -6,9 +6,9 @@ #define V8_DEBUG_DEBUG_PROPERTY_ITERATOR_H_ #include "src/debug/debug-interface.h" -#include "src/handles.h" -#include "src/isolate.h" -#include "src/prototype.h" +#include "src/execution/isolate.h" +#include "src/handles/handles.h" +#include "src/objects/prototype.h" #include "include/v8.h" diff --git a/chromium/v8/src/debug/debug-scope-iterator.cc b/chromium/v8/src/debug/debug-scope-iterator.cc index e71c1c07b3c..72e7dc2e452 100644 --- a/chromium/v8/src/debug/debug-scope-iterator.cc +++ b/chromium/v8/src/debug/debug-scope-iterator.cc @@ -4,11 +4,11 @@ #include "src/debug/debug-scope-iterator.h" -#include "src/api-inl.h" +#include "src/api/api-inl.h" #include "src/debug/debug.h" #include "src/debug/liveedit.h" -#include "src/frames-inl.h" -#include "src/isolate.h" +#include "src/execution/frames-inl.h" +#include "src/execution/isolate.h" #include "src/objects/js-generator-inl.h" #include "src/wasm/wasm-objects-inl.h" diff --git a/chromium/v8/src/debug/debug-scope-iterator.h b/chromium/v8/src/debug/debug-scope-iterator.h index 912d6858fd6..3859e8cb414 100644 --- a/chromium/v8/src/debug/debug-scope-iterator.h +++ b/chromium/v8/src/debug/debug-scope-iterator.h @@ -8,7 +8,7 @@ #include "src/debug/debug-frames.h" #include "src/debug/debug-interface.h" #include "src/debug/debug-scopes.h" -#include "src/frames.h" +#include "src/execution/frames.h" namespace v8 { namespace internal { diff --git a/chromium/v8/src/debug/debug-scopes.cc b/chromium/v8/src/debug/debug-scopes.cc index 464e0aae333..3a58f0b4589 100644 --- a/chromium/v8/src/debug/debug-scopes.cc +++ b/chromium/v8/src/debug/debug-scopes.cc @@ -8,16 +8,16 @@ #include "src/ast/ast.h" #include "src/ast/scopes.h" +#include "src/common/globals.h" #include "src/debug/debug.h" -#include "src/frames-inl.h" -#include "src/globals.h" -#include "src/isolate-inl.h" +#include "src/execution/frames-inl.h" +#include "src/execution/isolate-inl.h" #include "src/objects/js-generator-inl.h" #include "src/objects/module.h" -#include "src/ostreams.h" #include "src/parsing/parse-info.h" #include "src/parsing/parsing.h" #include "src/parsing/rewriter.h" +#include "src/utils/ostreams.h" namespace v8 { namespace internal { @@ -47,8 +47,8 @@ Handle<Object> ScopeIterator::GetFunctionDebugName() const { if (!context_->IsNativeContext()) { DisallowHeapAllocation no_gc; - ScopeInfo closure_info = context_->closure_context()->scope_info(); - Handle<String> debug_name(closure_info->FunctionDebugName(), isolate_); + ScopeInfo closure_info = context_->closure_context().scope_info(); + Handle<String> debug_name(closure_info.FunctionDebugName(), isolate_); if (debug_name->length() > 0) return debug_name; } return isolate_->factory()->undefined_value(); @@ -56,11 +56,11 @@ Handle<Object> ScopeIterator::GetFunctionDebugName() const { ScopeIterator::ScopeIterator(Isolate* isolate, Handle<JSFunction> function) : isolate_(isolate), context_(function->context(), isolate) { - if (!function->shared()->IsSubjectToDebugging()) { + if (!function->shared().IsSubjectToDebugging()) { context_ = Handle<Context>(); return; } - script_ = handle(Script::cast(function->shared()->script()), isolate); + script_ = handle(Script::cast(function->shared().script()), isolate); UnwrapEvaluationContext(); } @@ -70,8 +70,8 @@ ScopeIterator::ScopeIterator(Isolate* isolate, generator_(generator), function_(generator->function(), isolate), context_(generator->context(), isolate), - script_(Script::cast(function_->shared()->script()), isolate) { - CHECK(function_->shared()->IsSubjectToDebugging()); + script_(Script::cast(function_->shared().script()), isolate) { + CHECK(function_->shared().IsSubjectToDebugging()); TryParseAndRetrieveScopes(DEFAULT); } @@ -88,7 +88,7 @@ void ScopeIterator::TryParseAndRetrieveScopes(ScopeIterator::Option option) { // Catch the case when the debugger stops in an internal function. Handle<SharedFunctionInfo> shared_info(function_->shared(), isolate_); Handle<ScopeInfo> scope_info(shared_info->scope_info(), isolate_); - if (shared_info->script()->IsUndefined(isolate_)) { + if (shared_info->script().IsUndefined(isolate_)) { current_scope_ = closure_scope_ = nullptr; context_ = handle(function_->context(), isolate_); function_ = Handle<JSFunction>(); @@ -191,14 +191,14 @@ void ScopeIterator::UnwrapEvaluationContext() { if (!context_->IsDebugEvaluateContext()) return; Context current = *context_; do { - Object wrapped = current->get(Context::WRAPPED_CONTEXT_INDEX); - if (wrapped->IsContext()) { + Object wrapped = current.get(Context::WRAPPED_CONTEXT_INDEX); + if (wrapped.IsContext()) { current = Context::cast(wrapped); } else { - DCHECK(!current->previous().is_null()); - current = current->previous(); + DCHECK(!current.previous().is_null()); + current = current.previous(); } - } while (current->IsDebugEvaluateContext()); + } while (current.IsDebugEvaluateContext()); context_ = handle(current, isolate_); } @@ -232,13 +232,13 @@ bool ScopeIterator::HasPositionInfo() { int ScopeIterator::start_position() { if (InInnerScope()) return current_scope_->start_position(); if (context_->IsNativeContext()) return 0; - return context_->closure_context()->scope_info()->StartPosition(); + return context_->closure_context().scope_info().StartPosition(); } int ScopeIterator::end_position() { if (InInnerScope()) return current_scope_->end_position(); if (context_->IsNativeContext()) return 0; - return context_->closure_context()->scope_info()->EndPosition(); + return context_->closure_context().scope_info().EndPosition(); } bool ScopeIterator::DeclaresLocals(Mode mode) const { @@ -341,7 +341,7 @@ ScopeIterator::ScopeType ScopeIterator::Type() const { UNREACHABLE(); } if (context_->IsNativeContext()) { - DCHECK(context_->global_object()->IsJSGlobalObject()); + DCHECK(context_->global_object().IsJSGlobalObject()); // If we are at the native context and have not yet seen script scope, // fake it. return seen_script_scope_ ? ScopeTypeGlobal : ScopeTypeScript; @@ -481,13 +481,13 @@ void ScopeIterator::DebugPrint() { case ScopeIterator::ScopeTypeWith: os << "With:\n"; - context_->extension()->Print(os); + context_->extension().Print(os); break; case ScopeIterator::ScopeTypeCatch: os << "Catch:\n"; - context_->extension()->Print(os); - context_->get(Context::THROWN_OBJECT_INDEX)->Print(os); + context_->extension().Print(os); + context_->get(Context::THROWN_OBJECT_INDEX).Print(os); break; case ScopeIterator::ScopeTypeClosure: @@ -502,10 +502,8 @@ void ScopeIterator::DebugPrint() { case ScopeIterator::ScopeTypeScript: os << "Script:\n"; - context_->global_object() - ->native_context() - ->script_context_table() - ->Print(os); + context_->global_object().native_context().script_context_table().Print( + os); break; default: @@ -521,7 +519,7 @@ int ScopeIterator::GetSourcePosition() { } else { DCHECK(!generator_.is_null()); SharedFunctionInfo::EnsureSourcePositionsAvailable( - isolate_, handle(generator_->function()->shared(), isolate_)); + isolate_, handle(generator_->function().shared(), isolate_)); return generator_->source_position(); } } @@ -557,7 +555,7 @@ void ScopeIterator::RetrieveScopeChain(DeclarationScope* scope) { void ScopeIterator::VisitScriptScope(const Visitor& visitor) const { Handle<JSGlobalObject> global(context_->global_object(), isolate_); Handle<ScriptContextTable> script_contexts( - global->native_context()->script_context_table(), isolate_); + global->native_context().script_context_table(), isolate_); // Skip the first script since that just declares 'this'. for (int context_index = 1; context_index < script_contexts->used(); @@ -576,7 +574,7 @@ void ScopeIterator::VisitModuleScope(const Visitor& visitor) const { if (VisitContextLocals(visitor, scope_info, context_)) return; int count_index = scope_info->ModuleVariableCountIndex(); - int module_variable_count = Smi::cast(scope_info->get(count_index))->value(); + int module_variable_count = Smi::cast(scope_info->get(count_index)).value(); Handle<Module> module(context_->module(), isolate_); @@ -645,8 +643,8 @@ bool ScopeIterator::VisitLocals(const Visitor& visitor, Mode mode) const { DCHECK(!generator_.is_null()); FixedArray parameters_and_registers = generator_->parameters_and_registers(); - DCHECK_LT(index, parameters_and_registers->length()); - value = handle(parameters_and_registers->get(index), isolate_); + DCHECK_LT(index, parameters_and_registers.length()); + value = handle(parameters_and_registers.get(index), isolate_); } else { value = frame_inspector_->GetParameter(index); @@ -664,10 +662,10 @@ bool ScopeIterator::VisitLocals(const Visitor& visitor, Mode mode) const { FixedArray parameters_and_registers = generator_->parameters_and_registers(); int parameter_count = - function_->shared()->scope_info()->ParameterCount(); + function_->shared().scope_info().ParameterCount(); index += parameter_count; - DCHECK_LT(index, parameters_and_registers->length()); - value = handle(parameters_and_registers->get(index), isolate_); + DCHECK_LT(index, parameters_and_registers.length()); + value = handle(parameters_and_registers.get(index), isolate_); if (value->IsTheHole(isolate_)) { value = isolate_->factory()->undefined_value(); } @@ -715,7 +713,7 @@ bool ScopeIterator::VisitLocals(const Visitor& visitor, Mode mode) const { // a proxy, return an empty object. Handle<JSObject> ScopeIterator::WithContextExtension() { DCHECK(context_->IsWithContext()); - if (context_->extension_receiver()->IsJSProxy()) { + if (context_->extension_receiver().IsJSProxy()) { return isolate_->factory()->NewJSObjectWithNullProto(); } return handle(JSObject::cast(context_->extension_receiver()), isolate_); @@ -761,7 +759,7 @@ void ScopeIterator::VisitLocalScope(const Visitor& visitor, Mode mode) const { DCHECK(!context_->IsScriptContext()); DCHECK(!context_->IsNativeContext()); DCHECK(!context_->IsWithContext()); - if (!context_->scope_info()->CallsSloppyEval()) return; + if (!context_->scope_info().CallsSloppyEval()) return; if (context_->extension_object().is_null()) return; Handle<JSObject> extension(context_->extension_object(), isolate_); Handle<FixedArray> keys = @@ -771,7 +769,7 @@ void ScopeIterator::VisitLocalScope(const Visitor& visitor, Mode mode) const { for (int i = 0; i < keys->length(); i++) { // Names of variables introduced by eval are strings. - DCHECK(keys->get(i)->IsString()); + DCHECK(keys->get(i).IsString()); Handle<String> key(String::cast(keys->get(i)), isolate_); Handle<Object> value = JSReceiver::GetDataProperty(extension, key); if (visitor(key, value)) return; @@ -817,7 +815,7 @@ bool ScopeIterator::SetLocalVariableValue(Handle<String> variable_name, // Set the variable in the suspended generator. DCHECK(!generator_.is_null()); int parameter_count = - function_->shared()->scope_info()->ParameterCount(); + function_->shared().scope_info().ParameterCount(); index += parameter_count; Handle<FixedArray> parameters_and_registers( generator_->parameters_and_registers(), isolate_); @@ -854,7 +852,7 @@ bool ScopeIterator::SetContextExtensionValue(Handle<String> variable_name, Handle<Object> new_value) { if (!context_->has_extension()) return false; - DCHECK(context_->extension_object()->IsJSContextExtensionObject()); + DCHECK(context_->extension_object().IsJSContextExtensionObject()); Handle<JSObject> ext(context_->extension_object(), isolate_); LookupIterator it(isolate_, ext, variable_name, LookupIterator::OWN); Maybe<bool> maybe = JSReceiver::HasOwnProperty(ext, variable_name); @@ -887,7 +885,7 @@ bool ScopeIterator::SetModuleVariableValue(Handle<String> variable_name, VariableMode mode; InitializationFlag init_flag; MaybeAssignedFlag maybe_assigned_flag; - cell_index = context_->scope_info()->ModuleIndex( + cell_index = context_->scope_info().ModuleIndex( *variable_name, &mode, &init_flag, &maybe_assigned_flag); // Setting imports is currently not supported. @@ -904,7 +902,7 @@ bool ScopeIterator::SetModuleVariableValue(Handle<String> variable_name, bool ScopeIterator::SetScriptVariableValue(Handle<String> variable_name, Handle<Object> new_value) { Handle<ScriptContextTable> script_contexts( - context_->global_object()->native_context()->script_context_table(), + context_->global_object().native_context().script_context_table(), isolate_); ScriptContextTable::LookupResult lookup_result; if (ScriptContextTable::Lookup(isolate_, *script_contexts, *variable_name, diff --git a/chromium/v8/src/debug/debug-scopes.h b/chromium/v8/src/debug/debug-scopes.h index 63a03753f65..6e1c8b27bcf 100644 --- a/chromium/v8/src/debug/debug-scopes.h +++ b/chromium/v8/src/debug/debug-scopes.h @@ -8,7 +8,7 @@ #include <vector> #include "src/debug/debug-frames.h" -#include "src/frames.h" +#include "src/execution/frames.h" namespace v8 { namespace internal { diff --git a/chromium/v8/src/debug/debug-stack-trace-iterator.cc b/chromium/v8/src/debug/debug-stack-trace-iterator.cc index 214ef0d48b9..2c2c4387279 100644 --- a/chromium/v8/src/debug/debug-stack-trace-iterator.cc +++ b/chromium/v8/src/debug/debug-stack-trace-iterator.cc @@ -4,13 +4,13 @@ #include "src/debug/debug-stack-trace-iterator.h" -#include "src/api-inl.h" +#include "src/api/api-inl.h" #include "src/debug/debug-evaluate.h" #include "src/debug/debug-scope-iterator.h" #include "src/debug/debug.h" #include "src/debug/liveedit.h" -#include "src/frames-inl.h" -#include "src/isolate.h" +#include "src/execution/frames-inl.h" +#include "src/execution/isolate.h" namespace v8 { @@ -69,9 +69,8 @@ int DebugStackTraceIterator::GetContextId() const { DCHECK(!Done()); Handle<Object> context = frame_inspector_->GetContext(); if (context->IsContext()) { - Object value = - Context::cast(*context)->native_context()->debug_context_id(); - if (value->IsSmi()) return Smi::ToInt(value); + Object value = Context::cast(*context).native_context().debug_context_id(); + if (value.IsSmi()) return Smi::ToInt(value); } return 0; } @@ -79,7 +78,7 @@ int DebugStackTraceIterator::GetContextId() const { v8::MaybeLocal<v8::Value> DebugStackTraceIterator::GetReceiver() const { DCHECK(!Done()); if (frame_inspector_->IsJavaScript() && - frame_inspector_->GetFunction()->shared()->kind() == kArrowFunction) { + frame_inspector_->GetFunction()->shared().kind() == kArrowFunction) { // FrameInspector is not able to get receiver for arrow function. // So let's try to fetch it using same logic as is used to retrieve 'this' // during DebugEvaluate::Local. diff --git a/chromium/v8/src/debug/debug-stack-trace-iterator.h b/chromium/v8/src/debug/debug-stack-trace-iterator.h index 0c09afa87c3..15b8a85c5e8 100644 --- a/chromium/v8/src/debug/debug-stack-trace-iterator.h +++ b/chromium/v8/src/debug/debug-stack-trace-iterator.h @@ -7,7 +7,7 @@ #include "src/debug/debug-frames.h" #include "src/debug/debug-interface.h" -#include "src/frames.h" +#include "src/execution/frames.h" namespace v8 { namespace internal { diff --git a/chromium/v8/src/debug/debug-type-profile.cc b/chromium/v8/src/debug/debug-type-profile.cc index c1fe3085085..5ed2dfb116f 100644 --- a/chromium/v8/src/debug/debug-type-profile.cc +++ b/chromium/v8/src/debug/debug-type-profile.cc @@ -4,10 +4,10 @@ #include "src/debug/debug-type-profile.h" -#include "src/feedback-vector.h" -#include "src/isolate.h" -#include "src/objects-inl.h" -#include "src/objects.h" +#include "src/execution/isolate.h" +#include "src/objects/feedback-vector.h" +#include "src/objects/objects-inl.h" +#include "src/objects/objects.h" namespace v8 { namespace internal { @@ -26,7 +26,7 @@ std::unique_ptr<TypeProfile> TypeProfile::Collect(Isolate* isolate) { for (Script script = scripts.Next(); !script.is_null(); script = scripts.Next()) { - if (!script->IsUserJavaScript()) { + if (!script.IsUserJavaScript()) { continue; } @@ -39,21 +39,20 @@ std::unique_ptr<TypeProfile> TypeProfile::Collect(Isolate* isolate) { // the list multiple times. for (int i = 0; i < list->Length(); i++) { FeedbackVector vector = FeedbackVector::cast(list->Get(i)); - SharedFunctionInfo info = vector->shared_function_info(); - DCHECK(info->IsSubjectToDebugging()); + SharedFunctionInfo info = vector.shared_function_info(); + DCHECK(info.IsSubjectToDebugging()); // Match vectors with script. - if (script != info->script()) { + if (script != info.script()) { continue; } - if (!info->HasFeedbackMetadata() || - info->feedback_metadata()->is_empty() || - !info->feedback_metadata()->HasTypeProfileSlot()) { + if (!info.HasFeedbackMetadata() || info.feedback_metadata().is_empty() || + !info.feedback_metadata().HasTypeProfileSlot()) { continue; } - FeedbackSlot slot = vector->GetTypeProfileSlot(); + FeedbackSlot slot = vector.GetTypeProfileSlot(); FeedbackNexus nexus(vector, slot); - Handle<String> name(info->DebugName(), isolate); + Handle<String> name(info.DebugName(), isolate); std::vector<int> source_positions = nexus.GetSourcePositions(); for (int position : source_positions) { DCHECK_GE(position, 0); @@ -89,10 +88,10 @@ void TypeProfile::SelectMode(Isolate* isolate, debug::TypeProfileMode mode) { for (int i = 0; i < list->Length(); i++) { FeedbackVector vector = FeedbackVector::cast(list->Get(i)); - SharedFunctionInfo info = vector->shared_function_info(); - DCHECK(info->IsSubjectToDebugging()); - if (info->feedback_metadata()->HasTypeProfileSlot()) { - FeedbackSlot slot = vector->GetTypeProfileSlot(); + SharedFunctionInfo info = vector.shared_function_info(); + DCHECK(info.IsSubjectToDebugging()); + if (info.feedback_metadata().HasTypeProfileSlot()) { + FeedbackSlot slot = vector.GetTypeProfileSlot(); FeedbackNexus nexus(vector, slot); nexus.ResetTypeProfile(); } diff --git a/chromium/v8/src/debug/debug-type-profile.h b/chromium/v8/src/debug/debug-type-profile.h index 37f2b659d88..16f739e4536 100644 --- a/chromium/v8/src/debug/debug-type-profile.h +++ b/chromium/v8/src/debug/debug-type-profile.h @@ -8,8 +8,8 @@ #include <vector> #include "src/debug/debug-interface.h" -#include "src/handles.h" -#include "src/objects.h" +#include "src/handles/handles.h" +#include "src/objects/objects.h" namespace v8 { namespace internal { diff --git a/chromium/v8/src/debug/debug.cc b/chromium/v8/src/debug/debug.cc index d33fc316694..5cc200d5527 100644 --- a/chromium/v8/src/debug/debug.cc +++ b/chromium/v8/src/debug/debug.cc @@ -7,29 +7,30 @@ #include <memory> #include <unordered_set> -#include "src/api-inl.h" -#include "src/api-natives.h" -#include "src/arguments.h" -#include "src/assembler-inl.h" +#include "src/api/api-inl.h" +#include "src/api/api-natives.h" #include "src/base/platform/mutex.h" -#include "src/bootstrapper.h" #include "src/builtins/builtins.h" -#include "src/compilation-cache.h" -#include "src/compiler.h" -#include "src/counters.h" +#include "src/codegen/assembler-inl.h" +#include "src/codegen/compilation-cache.h" +#include "src/codegen/compiler.h" +#include "src/common/globals.h" #include "src/debug/debug-evaluate.h" #include "src/debug/liveedit.h" -#include "src/deoptimizer.h" -#include "src/execution.h" -#include "src/frames-inl.h" -#include "src/global-handles.h" -#include "src/globals.h" +#include "src/deoptimizer/deoptimizer.h" +#include "src/execution/arguments.h" +#include "src/execution/execution.h" +#include "src/execution/frames-inl.h" +#include "src/execution/isolate-inl.h" +#include "src/execution/message-template.h" +#include "src/execution/v8threads.h" +#include "src/handles/global-handles.h" #include "src/heap/heap-inl.h" // For NextDebuggingId. +#include "src/init/bootstrapper.h" #include "src/interpreter/bytecode-array-accessor.h" #include "src/interpreter/bytecode-array-iterator.h" #include "src/interpreter/interpreter.h" -#include "src/isolate-inl.h" -#include "src/message-template.h" +#include "src/logging/counters.h" #include "src/objects/api-callbacks-inl.h" #include "src/objects/debug-objects-inl.h" #include "src/objects/js-generator-inl.h" @@ -37,7 +38,6 @@ #include "src/objects/slots.h" #include "src/snapshot/natives.h" #include "src/snapshot/snapshot.h" -#include "src/v8threads.h" #include "src/wasm/wasm-objects-inl.h" namespace v8 { @@ -202,8 +202,8 @@ BreakIterator::BreakIterator(Handle<DebugInfo> debug_info) : debug_info_(debug_info), break_index_(-1), source_position_iterator_( - debug_info->DebugBytecodeArray()->SourcePositionTable()) { - position_ = debug_info->shared()->StartPosition(); + debug_info->DebugBytecodeArray().SourcePositionTable()) { + position_ = debug_info->shared().StartPosition(); statement_position_ = position_; // There is at least one break location. DCHECK(!Done()); @@ -251,12 +251,12 @@ void BreakIterator::Next() { DebugBreakType BreakIterator::GetDebugBreakType() { BytecodeArray bytecode_array = debug_info_->OriginalBytecodeArray(); interpreter::Bytecode bytecode = - interpreter::Bytecodes::FromByte(bytecode_array->get(code_offset())); + interpreter::Bytecodes::FromByte(bytecode_array.get(code_offset())); // Make sure we read the actual bytecode, not a prefix scaling bytecode. if (interpreter::Bytecodes::IsPrefixScalingBytecode(bytecode)) { - bytecode = interpreter::Bytecodes::FromByte( - bytecode_array->get(code_offset() + 1)); + bytecode = + interpreter::Bytecodes::FromByte(bytecode_array.get(code_offset() + 1)); } if (bytecode == interpreter::Bytecode::kDebugger) { @@ -296,7 +296,7 @@ void BreakIterator::ClearDebugBreak() { DCHECK(debug_break_type >= DEBUG_BREAK_SLOT); BytecodeArray bytecode_array = debug_info_->DebugBytecodeArray(); BytecodeArray original = debug_info_->OriginalBytecodeArray(); - bytecode_array->set(code_offset(), original->get(code_offset())); + bytecode_array.set(code_offset(), original.get(code_offset())); } BreakLocation BreakIterator::GetBreakLocation() { @@ -541,8 +541,8 @@ bool Debug::IsMutedAtCurrentLocation(JavaScriptFrame* frame) { FrameSummary summary = FrameSummary::GetTop(frame); DCHECK(!summary.IsWasm()); Handle<JSFunction> function = summary.AsJavaScript().function(); - if (!function->shared()->HasBreakInfo()) return false; - Handle<DebugInfo> debug_info(function->shared()->GetDebugInfo(), isolate_); + if (!function->shared().HasBreakInfo()) return false; + Handle<DebugInfo> debug_info(function->shared().GetDebugInfo(), isolate_); // Enter the debugger. DebugScope debug_scope(this); std::vector<BreakLocation> break_locations; @@ -563,7 +563,7 @@ bool Debug::CheckBreakPoint(Handle<BreakPoint> break_point, bool is_break_at_entry) { HandleScope scope(isolate_); - if (!break_point->condition()->length()) return true; + if (!break_point->condition().length()) return true; Handle<String> condition(break_point->condition(), isolate_); MaybeHandle<Object> maybe_result; Handle<Object> result; @@ -589,13 +589,12 @@ bool Debug::CheckBreakPoint(Handle<BreakPoint> break_point, return result->BooleanValue(isolate_); } -bool Debug::SetBreakPoint(Handle<JSFunction> function, +bool Debug::SetBreakpoint(Handle<SharedFunctionInfo> shared, Handle<BreakPoint> break_point, int* source_position) { HandleScope scope(isolate_); // Make sure the function is compiled and has set up the debug info. - Handle<SharedFunctionInfo> shared(function->shared(), isolate_); if (!EnsureBreakInfo(shared)) return false; PrepareFunctionForDebugExecution(shared); @@ -686,13 +685,13 @@ void Debug::ApplyBreakPoints(Handle<DebugInfo> debug_info) { } else { if (!debug_info->HasInstrumentedBytecodeArray()) return; FixedArray break_points = debug_info->break_points(); - for (int i = 0; i < break_points->length(); i++) { - if (break_points->get(i)->IsUndefined(isolate_)) continue; - BreakPointInfo info = BreakPointInfo::cast(break_points->get(i)); - if (info->GetBreakPointCount(isolate_) == 0) continue; + for (int i = 0; i < break_points.length(); i++) { + if (break_points.get(i).IsUndefined(isolate_)) continue; + BreakPointInfo info = BreakPointInfo::cast(break_points.get(i)); + if (info.GetBreakPointCount(isolate_) == 0) continue; DCHECK(debug_info->HasInstrumentedBytecodeArray()); BreakIterator it(debug_info); - it.SkipToPosition(info->source_position()); + it.SkipToPosition(info.source_position()); it.SetDebugBreak(); } } @@ -750,13 +749,13 @@ int Debug::GetFunctionDebuggingId(Handle<JSFunction> function) { return id; } -bool Debug::SetBreakpointForFunction(Handle<JSFunction> function, +bool Debug::SetBreakpointForFunction(Handle<SharedFunctionInfo> shared, Handle<String> condition, int* id) { *id = ++thread_local_.last_breakpoint_id_; Handle<BreakPoint> breakpoint = isolate_->factory()->NewBreakPoint(*id, condition); int source_position = 0; - return SetBreakPoint(function, breakpoint, &source_position); + return SetBreakpoint(shared, breakpoint, &source_position); } void Debug::RemoveBreakpoint(int id) { @@ -874,7 +873,7 @@ void Debug::PrepareStepInSuspendedGenerator() { thread_local_.last_step_action_ = StepIn; UpdateHookOnFunctionCall(); Handle<JSFunction> function( - JSGeneratorObject::cast(thread_local_.suspended_generator_)->function(), + JSGeneratorObject::cast(thread_local_.suspended_generator_).function(), isolate_); FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared(), isolate_)); clear_suspended_generator(); @@ -978,12 +977,12 @@ void Debug::PrepareStep(StepAction step_action) { if (frame->is_wasm_compiled()) return; WasmInterpreterEntryFrame* wasm_frame = WasmInterpreterEntryFrame::cast(frame); - wasm_frame->debug_info()->PrepareStep(step_action); + wasm_frame->debug_info().PrepareStep(step_action); return; } JavaScriptFrame* js_frame = JavaScriptFrame::cast(frame); - DCHECK(js_frame->function()->IsJSFunction()); + DCHECK(js_frame->function().IsJSFunction()); // Get the debug info (create it if it does not exist). auto summary = FrameSummary::GetTop(frame).AsJavaScript(); @@ -1024,7 +1023,6 @@ void Debug::PrepareStep(StepAction step_action) { switch (step_action) { case StepNone: UNREACHABLE(); - break; case StepOut: { // Clear last position info. For stepping out it does not matter. thread_local_.last_statement_position_ = kNoSourcePosition; @@ -1091,15 +1089,15 @@ Handle<Object> Debug::GetSourceBreakLocations( Handle<FixedArray> locations = isolate->factory()->NewFixedArray( debug_info->GetBreakPointCount(isolate)); int count = 0; - for (int i = 0; i < debug_info->break_points()->length(); ++i) { - if (!debug_info->break_points()->get(i)->IsUndefined(isolate)) { + for (int i = 0; i < debug_info->break_points().length(); ++i) { + if (!debug_info->break_points().get(i).IsUndefined(isolate)) { BreakPointInfo break_point_info = - BreakPointInfo::cast(debug_info->break_points()->get(i)); - int break_points = break_point_info->GetBreakPointCount(isolate); + BreakPointInfo::cast(debug_info->break_points().get(i)); + int break_points = break_point_info.GetBreakPointCount(isolate); if (break_points == 0) continue; for (int j = 0; j < break_points; ++j) { locations->set(count++, - Smi::FromInt(break_point_info->source_position())); + Smi::FromInt(break_point_info.source_position())); } } } @@ -1150,8 +1148,8 @@ void Debug::DeoptimizeFunction(Handle<SharedFunctionInfo> shared) { do { Code code = iterator.Next(); if (code.is_null()) break; - if (code->Inlines(*shared)) { - code->set_marked_for_deoptimization(true); + if (code.Inlines(*shared)) { + code.set_marked_for_deoptimization(true); found_something = true; } } while (true); @@ -1215,7 +1213,7 @@ void Debug::InstallDebugBreakTrampoline() { current = current->next()) { if (current->debug_info()->CanBreakAtEntry()) { needs_to_use_trampoline = true; - if (current->debug_info()->shared()->IsApiFunction()) { + if (current->debug_info()->shared().IsApiFunction()) { needs_to_clear_ic = true; break; } @@ -1231,23 +1229,23 @@ void Debug::InstallDebugBreakTrampoline() { HeapIterator iterator(isolate_->heap()); for (HeapObject obj = iterator.next(); !obj.is_null(); obj = iterator.next()) { - if (needs_to_clear_ic && obj->IsFeedbackVector()) { - FeedbackVector::cast(obj)->ClearSlots(isolate_); + if (needs_to_clear_ic && obj.IsFeedbackVector()) { + FeedbackVector::cast(obj).ClearSlots(isolate_); continue; - } else if (obj->IsJSFunction()) { + } else if (obj.IsJSFunction()) { JSFunction fun = JSFunction::cast(obj); - SharedFunctionInfo shared = fun->shared(); - if (!shared->HasDebugInfo()) continue; - if (!shared->GetDebugInfo()->CanBreakAtEntry()) continue; - if (!fun->is_compiled()) { + SharedFunctionInfo shared = fun.shared(); + if (!shared.HasDebugInfo()) continue; + if (!shared.GetDebugInfo().CanBreakAtEntry()) continue; + if (!fun.is_compiled()) { needs_compile.push_back(handle(fun, isolate_)); } else { - fun->set_code(*trampoline); + fun.set_code(*trampoline); } - } else if (obj->IsAccessorPair()) { + } else if (obj.IsAccessorPair()) { AccessorPair accessor_pair = AccessorPair::cast(obj); - if (accessor_pair->getter()->IsFunctionTemplateInfo() || - accessor_pair->setter()->IsFunctionTemplateInfo()) { + if (accessor_pair.getter().IsFunctionTemplateInfo() || + accessor_pair.setter().IsFunctionTemplateInfo()) { needs_instantiate.push_back(handle(accessor_pair, isolate_)); } } @@ -1257,7 +1255,7 @@ void Debug::InstallDebugBreakTrampoline() { // Forcibly instantiate all lazy accessor pairs to make sure that they // properly hit the debug break trampoline. for (Handle<AccessorPair> accessor_pair : needs_instantiate) { - if (accessor_pair->getter()->IsFunctionTemplateInfo()) { + if (accessor_pair->getter().IsFunctionTemplateInfo()) { Handle<JSFunction> fun = ApiNatives::InstantiateFunction( handle(FunctionTemplateInfo::cast(accessor_pair->getter()), @@ -1265,7 +1263,7 @@ void Debug::InstallDebugBreakTrampoline() { .ToHandleChecked(); accessor_pair->set_getter(*fun); } - if (accessor_pair->setter()->IsFunctionTemplateInfo()) { + if (accessor_pair->setter().IsFunctionTemplateInfo()) { Handle<JSFunction> fun = ApiNatives::InstantiateFunction( handle(FunctionTemplateInfo::cast(accessor_pair->setter()), @@ -1332,12 +1330,12 @@ bool Debug::GetPossibleBreakpoints(Handle<Script> script, int start_position, SharedFunctionInfo::ScriptIterator iterator(isolate_, *script); for (SharedFunctionInfo info = iterator.Next(); !info.is_null(); info = iterator.Next()) { - if (info->EndPosition() < start_position || - info->StartPosition() >= end_position) { + if (info.EndPosition() < start_position || + info.StartPosition() >= end_position) { continue; } - if (!info->IsSubjectToDebugging()) continue; - if (!info->is_compiled() && !info->allows_lazy_compilation()) continue; + if (!info.IsSubjectToDebugging()) continue; + if (!info.is_compiled() && !info.allows_lazy_compilation()) continue; candidates.push_back(i::handle(info, isolate_)); } @@ -1396,26 +1394,26 @@ class SharedFunctionInfoFinder { void NewCandidate(SharedFunctionInfo shared, JSFunction closure = JSFunction()) { - if (!shared->IsSubjectToDebugging()) return; - int start_position = shared->function_token_position(); + if (!shared.IsSubjectToDebugging()) return; + int start_position = shared.function_token_position(); if (start_position == kNoSourcePosition) { - start_position = shared->StartPosition(); + start_position = shared.StartPosition(); } if (start_position > target_position_) return; - if (target_position_ > shared->EndPosition()) return; + if (target_position_ > shared.EndPosition()) return; if (!current_candidate_.is_null()) { if (current_start_position_ == start_position && - shared->EndPosition() == current_candidate_->EndPosition()) { + shared.EndPosition() == current_candidate_.EndPosition()) { // If we already have a matching closure, do not throw it away. if (!current_candidate_closure_.is_null() && closure.is_null()) return; // If a top-level function contains only one function // declaration the source for the top-level and the function // is the same. In that case prefer the non top-level function. - if (!current_candidate_->is_toplevel() && shared->is_toplevel()) return; + if (!current_candidate_.is_toplevel() && shared.is_toplevel()) return; } else if (start_position < current_start_position_ || - current_candidate_->EndPosition() < shared->EndPosition()) { + current_candidate_.EndPosition() < shared.EndPosition()) { return; } } @@ -1464,7 +1462,7 @@ Handle<Object> Debug::FindSharedFunctionInfoInScript(Handle<Script> script, shared = finder.Result(); if (shared.is_null()) break; // We found it if it's already compiled. - is_compiled_scope = shared->is_compiled_scope(); + is_compiled_scope = shared.is_compiled_scope(); if (is_compiled_scope.is_compiled()) { Handle<SharedFunctionInfo> shared_handle(shared, isolate_); // If the iteration count is larger than 1, we had to compile the outer @@ -1481,7 +1479,7 @@ Handle<Object> Debug::FindSharedFunctionInfoInScript(Handle<Script> script, // If not, compile to reveal inner functions. HandleScope scope(isolate_); // Code that cannot be compiled lazily are internal and not debuggable. - DCHECK(shared->allows_lazy_compilation()); + DCHECK(shared.allows_lazy_compilation()); if (!Compiler::Compile(handle(shared, isolate_), Compiler::CLEAR_EXCEPTION, &is_compiled_scope)) { break; @@ -1619,7 +1617,7 @@ void Debug::FreeDebugInfoListNode(DebugInfoListNode* prev, // Pack script back into the // SFI::script_or_debug_info field. Handle<DebugInfo> debug_info(node->debug_info()); - debug_info->shared()->set_script_or_debug_info(debug_info->script()); + debug_info->shared().set_script_or_debug_info(debug_info->script()); delete node; } @@ -1628,7 +1626,7 @@ bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) { HandleScope scope(isolate_); // Get the executing function in which the debug break occurred. - Handle<SharedFunctionInfo> shared(frame->function()->shared(), isolate_); + Handle<SharedFunctionInfo> shared(frame->function().shared(), isolate_); // With no debug info there are no break points, so we can't be at a return. if (!shared->HasBreakInfo()) return false; @@ -1675,7 +1673,7 @@ Handle<FixedArray> Debug::GetLoadedScripts() { Script::Iterator iterator(isolate_); for (Script script = iterator.Next(); !script.is_null(); script = iterator.Next()) { - if (script->HasValidSource()) results->set(length++, script); + if (script.HasValidSource()) results->set(length++, script); } } return FixedArray::ShrinkOrEmpty(isolate_, results, length); @@ -1808,7 +1806,7 @@ void Debug::OnDebugBreak(Handle<FixedArray> break_points_hit) { // This array contains breakpoints installed using JS debug API. for (int i = 0; i < break_points_hit->length(); ++i) { BreakPoint break_point = BreakPoint::cast(break_points_hit->get(i)); - inspector_break_points_hit.push_back(break_point->id()); + inspector_break_points_hit.push_back(break_point.id()); ++inspector_break_points_count; } @@ -1836,13 +1834,13 @@ bool Debug::IsBlackboxed(Handle<SharedFunctionInfo> shared) { Handle<DebugInfo> debug_info = GetOrCreateDebugInfo(shared); if (!debug_info->computed_debug_is_blackboxed()) { bool is_blackboxed = - !shared->IsSubjectToDebugging() || !shared->script()->IsScript(); + !shared->IsSubjectToDebugging() || !shared->script().IsScript(); if (!is_blackboxed) { SuppressDebug while_processing(this); HandleScope handle_scope(isolate_); PostponeInterruptsScope no_interrupts(isolate_); DisableBreak no_recursive_break(this); - DCHECK(shared->script()->IsScript()); + DCHECK(shared->script().IsScript()); Handle<Script> script(Script::cast(shared->script()), isolate_); DCHECK(script->IsUserJavaScript()); debug::Location start = GetDebugLocation(script, shared->StartPosition()); @@ -1980,7 +1978,7 @@ void Debug::HandleDebugBreak(IgnoreBreakMode ignore_break_mode) { { JavaScriptFrameIterator it(isolate_); DCHECK(!it.done()); Object fun = it.frame()->function(); - if (fun->IsJSFunction()) { + if (fun.IsJSFunction()) { HandleScope scope(isolate_); Handle<JSFunction> function(JSFunction::cast(fun), isolate_); // Don't stop in builtin and blackboxed functions. @@ -2032,7 +2030,7 @@ void Debug::PrintBreakLocation() { String::FlatContent content = source->GetFlatContent(no_gc); if (content.IsOneByte()) { PrintF("[debug] %.*s\n", line_end - line_start, - content.ToOneByteVector().start() + line_start); + content.ToOneByteVector().begin() + line_start); PrintF("[debug] "); for (int i = 0; i < column; i++) PrintF(" "); PrintF("^\n"); @@ -2093,7 +2091,7 @@ void Debug::UpdateDebugInfosForExecutionMode() { Handle<DebugInfo> debug_info = current->debug_info(); if (debug_info->HasInstrumentedBytecodeArray() && debug_info->DebugExecutionMode() != isolate_->debug_execution_mode()) { - DCHECK(debug_info->shared()->HasBytecodeArray()); + DCHECK(debug_info->shared().HasBytecodeArray()); if (isolate_->debug_execution_mode() == DebugInfo::kBreakpoints) { ClearSideEffectChecks(debug_info); ApplyBreakPoints(debug_info); @@ -2175,7 +2173,7 @@ bool Debug::PerformSideEffectCheck(Handle<JSFunction> function, Handle<Object> receiver) { DCHECK_EQ(isolate_->debug_execution_mode(), DebugInfo::kSideEffects); DisallowJavascriptExecution no_js(isolate_); - IsCompiledScope is_compiled_scope(function->shared()->is_compiled_scope()); + IsCompiledScope is_compiled_scope(function->shared().is_compiled_scope()); if (!function->is_compiled() && !Compiler::Compile(function, Compiler::KEEP_EXCEPTION, &is_compiled_scope)) { @@ -2190,7 +2188,7 @@ bool Debug::PerformSideEffectCheck(Handle<JSFunction> function, case DebugInfo::kHasSideEffects: if (FLAG_trace_side_effect_free_debug_evaluate) { PrintF("[debug-evaluate] Function %s failed side effect check.\n", - function->shared()->DebugName()->ToCString().get()); + function->shared().DebugName().ToCString().get()); } side_effect_check_failed_ = true; // Throw an uncatchable termination exception. @@ -2227,7 +2225,7 @@ bool Debug::PerformSideEffectCheckForCallback( DCHECK_EQ(!receiver.is_null(), callback_info->IsAccessorInfo()); DCHECK_EQ(isolate_->debug_execution_mode(), DebugInfo::kSideEffects); if (!callback_info.is_null() && callback_info->IsCallHandlerInfo() && - i::CallHandlerInfo::cast(*callback_info)->NextCallHasNoSideEffect()) { + i::CallHandlerInfo::cast(*callback_info).NextCallHasNoSideEffect()) { return true; } // TODO(7515): always pass a valid callback info object. @@ -2236,8 +2234,8 @@ bool Debug::PerformSideEffectCheckForCallback( // List of whitelisted internal accessors can be found in accessors.h. AccessorInfo info = AccessorInfo::cast(*callback_info); DCHECK_NE(kNotAccessor, accessor_kind); - switch (accessor_kind == kSetter ? info->setter_side_effect_type() - : info->getter_side_effect_type()) { + switch (accessor_kind == kSetter ? info.setter_side_effect_type() + : info.getter_side_effect_type()) { case SideEffectType::kHasNoSideEffect: // We do not support setter accessors with no side effects, since // calling set accessors go through a store bytecode. Store bytecodes @@ -2254,18 +2252,18 @@ bool Debug::PerformSideEffectCheckForCallback( } if (FLAG_trace_side_effect_free_debug_evaluate) { PrintF("[debug-evaluate] API Callback '"); - info->name()->ShortPrint(); + info.name().ShortPrint(); PrintF("' may cause side effect.\n"); } } else if (callback_info->IsInterceptorInfo()) { InterceptorInfo info = InterceptorInfo::cast(*callback_info); - if (info->has_no_side_effect()) return true; + if (info.has_no_side_effect()) return true; if (FLAG_trace_side_effect_free_debug_evaluate) { PrintF("[debug-evaluate] API Interceptor may cause side effect.\n"); } } else if (callback_info->IsCallHandlerInfo()) { CallHandlerInfo info = CallHandlerInfo::cast(*callback_info); - if (info->IsSideEffectFreeCallHandlerInfo()) return true; + if (info.IsSideEffectFreeCallHandlerInfo()) return true; if (FLAG_trace_side_effect_free_debug_evaluate) { PrintF("[debug-evaluate] API CallHandlerInfo may cause side effect.\n"); } @@ -2282,8 +2280,8 @@ bool Debug::PerformSideEffectCheckAtBytecode(InterpretedFrame* frame) { using interpreter::Bytecode; DCHECK_EQ(isolate_->debug_execution_mode(), DebugInfo::kSideEffects); - SharedFunctionInfo shared = frame->function()->shared(); - BytecodeArray bytecode_array = shared->GetBytecodeArray(); + SharedFunctionInfo shared = frame->function().shared(); + BytecodeArray bytecode_array = shared.GetBytecodeArray(); int offset = frame->GetBytecodeOffset(); interpreter::BytecodeArrayAccessor bytecode_accessor( handle(bytecode_array, isolate_), offset); diff --git a/chromium/v8/src/debug/debug.h b/chromium/v8/src/debug/debug.h index e0d675fc7d2..8ac77e259d3 100644 --- a/chromium/v8/src/debug/debug.h +++ b/chromium/v8/src/debug/debug.h @@ -7,14 +7,14 @@ #include <vector> +#include "src/codegen/source-position-table.h" +#include "src/common/globals.h" #include "src/debug/debug-interface.h" #include "src/debug/interface-types.h" -#include "src/frames.h" -#include "src/globals.h" -#include "src/handles.h" -#include "src/isolate.h" +#include "src/execution/frames.h" +#include "src/execution/isolate.h" +#include "src/handles/handles.h" #include "src/objects/debug-objects.h" -#include "src/source-position-table.h" namespace v8 { namespace internal { @@ -227,7 +227,7 @@ class V8_EXPORT_PRIVATE Debug { Handle<FixedArray> GetLoadedScripts(); // Break point handling. - bool SetBreakPoint(Handle<JSFunction> function, + bool SetBreakpoint(Handle<SharedFunctionInfo> shared, Handle<BreakPoint> break_point, int* source_position); void ClearBreakPoint(Handle<BreakPoint> break_point); void ChangeBreakOnException(ExceptionBreakType type, bool enable); @@ -235,7 +235,7 @@ class V8_EXPORT_PRIVATE Debug { bool SetBreakPointForScript(Handle<Script> script, Handle<String> condition, int* source_position, int* id); - bool SetBreakpointForFunction(Handle<JSFunction> function, + bool SetBreakpointForFunction(Handle<SharedFunctionInfo> shared, Handle<String> condition, int* id); void RemoveBreakpoint(int id); diff --git a/chromium/v8/src/debug/ia32/debug-ia32.cc b/chromium/v8/src/debug/ia32/debug-ia32.cc index a4466ee9ebd..e438f3a6407 100644 --- a/chromium/v8/src/debug/ia32/debug-ia32.cc +++ b/chromium/v8/src/debug/ia32/debug-ia32.cc @@ -6,9 +6,9 @@ #include "src/debug/debug.h" +#include "src/codegen/macro-assembler.h" #include "src/debug/liveedit.h" -#include "src/frames-inl.h" -#include "src/macro-assembler.h" +#include "src/execution/frames-inl.h" namespace v8 { namespace internal { diff --git a/chromium/v8/src/debug/interface-types.h b/chromium/v8/src/debug/interface-types.h index 3a449dde626..2375827b1bf 100644 --- a/chromium/v8/src/debug/interface-types.h +++ b/chromium/v8/src/debug/interface-types.h @@ -10,7 +10,7 @@ #include <vector> #include "include/v8.h" -#include "src/globals.h" +#include "src/common/globals.h" namespace v8 { diff --git a/chromium/v8/src/debug/liveedit.cc b/chromium/v8/src/debug/liveedit.cc index 013cb0ff500..9144e03be45 100644 --- a/chromium/v8/src/debug/liveedit.cc +++ b/chromium/v8/src/debug/liveedit.cc @@ -4,25 +4,25 @@ #include "src/debug/liveedit.h" -#include "src/api-inl.h" +#include "src/api/api-inl.h" #include "src/ast/ast-traversal-visitor.h" #include "src/ast/ast.h" #include "src/ast/scopes.h" -#include "src/compilation-cache.h" -#include "src/compiler.h" +#include "src/codegen/compilation-cache.h" +#include "src/codegen/compiler.h" +#include "src/codegen/source-position-table.h" #include "src/debug/debug-interface.h" #include "src/debug/debug.h" -#include "src/frames-inl.h" -#include "src/isolate-inl.h" -#include "src/log.h" -#include "src/objects-inl.h" +#include "src/execution/frames-inl.h" +#include "src/execution/isolate-inl.h" +#include "src/execution/v8threads.h" +#include "src/init/v8.h" +#include "src/logging/log.h" #include "src/objects/hash-table-inl.h" #include "src/objects/js-generator-inl.h" +#include "src/objects/objects-inl.h" #include "src/parsing/parse-info.h" #include "src/parsing/parsing.h" -#include "src/source-position-table.h" -#include "src/v8.h" -#include "src/v8threads.h" namespace v8 { namespace internal { @@ -811,12 +811,12 @@ class FunctionDataMap : public ThreadVisitor { } bool Lookup(SharedFunctionInfo sfi, FunctionData** data) { - int start_position = sfi->StartPosition(); - if (!sfi->script()->IsScript() || start_position == -1) { + int start_position = sfi.StartPosition(); + if (!sfi.script().IsScript() || start_position == -1) { return false; } - Script script = Script::cast(sfi->script()); - return Lookup(GetFuncId(script->id(), sfi), data); + Script script = Script::cast(sfi.script()); + return Lookup(GetFuncId(script.id(), sfi), data); } bool Lookup(Handle<Script> script, FunctionLiteral* literal, @@ -829,21 +829,21 @@ class FunctionDataMap : public ThreadVisitor { HeapIterator iterator(isolate->heap(), HeapIterator::kFilterUnreachable); for (HeapObject obj = iterator.next(); !obj.is_null(); obj = iterator.next()) { - if (obj->IsSharedFunctionInfo()) { + if (obj.IsSharedFunctionInfo()) { SharedFunctionInfo sfi = SharedFunctionInfo::cast(obj); FunctionData* data = nullptr; if (!Lookup(sfi, &data)) continue; data->shared = handle(sfi, isolate); - } else if (obj->IsJSFunction()) { + } else if (obj.IsJSFunction()) { JSFunction js_function = JSFunction::cast(obj); - SharedFunctionInfo sfi = js_function->shared(); + SharedFunctionInfo sfi = js_function.shared(); FunctionData* data = nullptr; if (!Lookup(sfi, &data)) continue; data->js_functions.emplace_back(js_function, isolate); - } else if (obj->IsJSGeneratorObject()) { + } else if (obj.IsJSGeneratorObject()) { JSGeneratorObject gen = JSGeneratorObject::cast(obj); - if (gen->is_closed()) continue; - SharedFunctionInfo sfi = gen->function()->shared(); + if (gen.is_closed()) continue; + SharedFunctionInfo sfi = gen.function().shared(); FunctionData* data = nullptr; if (!Lookup(sfi, &data)) continue; data->running_generators.emplace_back(gen, isolate); @@ -903,10 +903,10 @@ class FunctionDataMap : public ThreadVisitor { } FuncId GetFuncId(int script_id, SharedFunctionInfo sfi) { - DCHECK_EQ(script_id, Script::cast(sfi->script())->id()); - int start_position = sfi->StartPosition(); + DCHECK_EQ(script_id, Script::cast(sfi.script()).id()); + int start_position = sfi.StartPosition(); DCHECK_NE(start_position, -1); - if (sfi->is_toplevel()) { + if (sfi.is_toplevel()) { // This is the top-level function, so special case its start position DCHECK_EQ(start_position, 0); start_position = -1; @@ -1119,10 +1119,10 @@ void LiveEdit::PatchScript(Isolate* isolate, Handle<Script> script, sfi->set_script(*new_script); if (sfi->HasUncompiledData()) { - sfi->uncompiled_data()->set_function_literal_id( + sfi->uncompiled_data().set_function_literal_id( mapping.second->function_literal_id()); } - new_script->shared_function_infos()->Set( + new_script->shared_function_infos().Set( mapping.second->function_literal_id(), HeapObjectReference::Weak(*sfi)); DCHECK_EQ(sfi->FunctionLiteralId(isolate), mapping.second->function_literal_id()); @@ -1144,11 +1144,11 @@ void LiveEdit::PatchScript(Isolate* isolate, Handle<Script> script, } if (!sfi->HasBytecodeArray()) continue; - FixedArray constants = sfi->GetBytecodeArray()->constant_pool(); - for (int i = 0; i < constants->length(); ++i) { - if (!constants->get(i)->IsSharedFunctionInfo()) continue; + FixedArray constants = sfi->GetBytecodeArray().constant_pool(); + for (int i = 0; i < constants.length(); ++i) { + if (!constants.get(i).IsSharedFunctionInfo()) continue; FunctionData* data = nullptr; - if (!function_data_map.Lookup(SharedFunctionInfo::cast(constants->get(i)), + if (!function_data_map.Lookup(SharedFunctionInfo::cast(constants.get(i)), &data)) { continue; } @@ -1159,7 +1159,7 @@ void LiveEdit::PatchScript(Isolate* isolate, Handle<Script> script, } Handle<SharedFunctionInfo> new_sfi; if (!data->shared.ToHandle(&new_sfi)) continue; - constants->set(i, *new_sfi); + constants.set(i, *new_sfi); } } for (const auto& mapping : changed) { @@ -1176,7 +1176,7 @@ void LiveEdit::PatchScript(Isolate* isolate, Handle<Script> script, isolate->compilation_cache()->Remove(sfi); for (auto& js_function : data->js_functions) { js_function->set_shared(*new_sfi); - js_function->set_code(js_function->shared()->GetCode()); + js_function->set_code(js_function->shared().GetCode()); js_function->set_raw_feedback_cell( *isolate->factory()->many_closures_cell()); @@ -1186,30 +1186,29 @@ void LiveEdit::PatchScript(Isolate* isolate, Handle<Script> script, } SharedFunctionInfo::ScriptIterator it(isolate, *new_script); for (SharedFunctionInfo sfi = it.Next(); !sfi.is_null(); sfi = it.Next()) { - if (!sfi->HasBytecodeArray()) continue; - FixedArray constants = sfi->GetBytecodeArray()->constant_pool(); - for (int i = 0; i < constants->length(); ++i) { - if (!constants->get(i)->IsSharedFunctionInfo()) continue; - SharedFunctionInfo inner_sfi = - SharedFunctionInfo::cast(constants->get(i)); + if (!sfi.HasBytecodeArray()) continue; + FixedArray constants = sfi.GetBytecodeArray().constant_pool(); + for (int i = 0; i < constants.length(); ++i) { + if (!constants.get(i).IsSharedFunctionInfo()) continue; + SharedFunctionInfo inner_sfi = SharedFunctionInfo::cast(constants.get(i)); // See if there is a mapping from this function's start position to a // unchanged function's id. auto unchanged_it = - start_position_to_unchanged_id.find(inner_sfi->StartPosition()); + start_position_to_unchanged_id.find(inner_sfi.StartPosition()); if (unchanged_it == start_position_to_unchanged_id.end()) continue; // Grab that function id from the new script's SFI list, which should have // already been updated in in the unchanged pass. SharedFunctionInfo old_unchanged_inner_sfi = SharedFunctionInfo::cast(new_script->shared_function_infos() - ->Get(unchanged_it->second) + .Get(unchanged_it->second) ->GetHeapObject()); if (old_unchanged_inner_sfi == inner_sfi) continue; DCHECK_NE(old_unchanged_inner_sfi, inner_sfi); // Now some sanity checks. Make sure that the unchanged SFI has already // been processed and patched to be on the new script ... - DCHECK_EQ(old_unchanged_inner_sfi->script(), *new_script); - constants->set(i, old_unchanged_inner_sfi); + DCHECK_EQ(old_unchanged_inner_sfi.script(), *new_script); + constants.set(i, old_unchanged_inner_sfi); } } #ifdef DEBUG @@ -1222,28 +1221,28 @@ void LiveEdit::PatchScript(Isolate* isolate, Handle<Script> script, SharedFunctionInfo::ScriptIterator it(isolate, *new_script); std::set<int> start_positions; for (SharedFunctionInfo sfi = it.Next(); !sfi.is_null(); sfi = it.Next()) { - DCHECK_EQ(sfi->script(), *new_script); - DCHECK_EQ(sfi->FunctionLiteralId(isolate), it.CurrentIndex()); + DCHECK_EQ(sfi.script(), *new_script); + DCHECK_EQ(sfi.FunctionLiteralId(isolate), it.CurrentIndex()); // Don't check the start position of the top-level function, as it can // overlap with a function in the script. - if (sfi->is_toplevel()) { - DCHECK_EQ(start_positions.find(sfi->StartPosition()), + if (sfi.is_toplevel()) { + DCHECK_EQ(start_positions.find(sfi.StartPosition()), start_positions.end()); - start_positions.insert(sfi->StartPosition()); + start_positions.insert(sfi.StartPosition()); } - if (!sfi->HasBytecodeArray()) continue; + if (!sfi.HasBytecodeArray()) continue; // Check that all the functions in this function's constant pool are also // on the new script, and that their id matches their index in the new // scripts function list. - FixedArray constants = sfi->GetBytecodeArray()->constant_pool(); - for (int i = 0; i < constants->length(); ++i) { - if (!constants->get(i)->IsSharedFunctionInfo()) continue; + FixedArray constants = sfi.GetBytecodeArray().constant_pool(); + for (int i = 0; i < constants.length(); ++i) { + if (!constants.get(i).IsSharedFunctionInfo()) continue; SharedFunctionInfo inner_sfi = - SharedFunctionInfo::cast(constants->get(i)); - DCHECK_EQ(inner_sfi->script(), *new_script); + SharedFunctionInfo::cast(constants.get(i)); + DCHECK_EQ(inner_sfi.script(), *new_script); DCHECK_EQ(inner_sfi, new_script->shared_function_infos() - ->Get(inner_sfi->FunctionLiteralId(isolate)) + .Get(inner_sfi.FunctionLiteralId(isolate)) ->GetHeapObject()); } } diff --git a/chromium/v8/src/debug/liveedit.h b/chromium/v8/src/debug/liveedit.h index 0daba0da1fc..578cf292548 100644 --- a/chromium/v8/src/debug/liveedit.h +++ b/chromium/v8/src/debug/liveedit.h @@ -7,8 +7,8 @@ #include <vector> -#include "src/globals.h" -#include "src/handles.h" +#include "src/common/globals.h" +#include "src/handles/handles.h" namespace v8 { namespace debug { diff --git a/chromium/v8/src/debug/mips/OWNERS b/chromium/v8/src/debug/mips/OWNERS deleted file mode 100644 index cab3679d656..00000000000 --- a/chromium/v8/src/debug/mips/OWNERS +++ /dev/null @@ -1 +0,0 @@ -xwafish@gmail.com diff --git a/chromium/v8/src/debug/mips/debug-mips.cc b/chromium/v8/src/debug/mips/debug-mips.cc index b84779a4fb2..cc1adc2328e 100644 --- a/chromium/v8/src/debug/mips/debug-mips.cc +++ b/chromium/v8/src/debug/mips/debug-mips.cc @@ -6,9 +6,9 @@ #include "src/debug/debug.h" +#include "src/codegen/macro-assembler.h" #include "src/debug/liveedit.h" -#include "src/frames-inl.h" -#include "src/macro-assembler.h" +#include "src/execution/frames-inl.h" namespace v8 { namespace internal { diff --git a/chromium/v8/src/debug/mips64/OWNERS b/chromium/v8/src/debug/mips64/OWNERS deleted file mode 100644 index cab3679d656..00000000000 --- a/chromium/v8/src/debug/mips64/OWNERS +++ /dev/null @@ -1 +0,0 @@ -xwafish@gmail.com diff --git a/chromium/v8/src/debug/mips64/debug-mips64.cc b/chromium/v8/src/debug/mips64/debug-mips64.cc index ebd8db26d7d..b93eb39c52f 100644 --- a/chromium/v8/src/debug/mips64/debug-mips64.cc +++ b/chromium/v8/src/debug/mips64/debug-mips64.cc @@ -6,9 +6,9 @@ #include "src/debug/debug.h" +#include "src/codegen/macro-assembler.h" #include "src/debug/liveedit.h" -#include "src/frames-inl.h" -#include "src/macro-assembler.h" +#include "src/execution/frames-inl.h" namespace v8 { namespace internal { diff --git a/chromium/v8/src/debug/ppc/debug-ppc.cc b/chromium/v8/src/debug/ppc/debug-ppc.cc index 4a6d0a67d52..a5b41c46fe8 100644 --- a/chromium/v8/src/debug/ppc/debug-ppc.cc +++ b/chromium/v8/src/debug/ppc/debug-ppc.cc @@ -6,9 +6,9 @@ #include "src/debug/debug.h" +#include "src/codegen/macro-assembler.h" #include "src/debug/liveedit.h" -#include "src/frames-inl.h" -#include "src/macro-assembler.h" +#include "src/execution/frames-inl.h" namespace v8 { namespace internal { diff --git a/chromium/v8/src/debug/s390/OWNERS b/chromium/v8/src/debug/s390/OWNERS deleted file mode 100644 index 6d1a8fc472c..00000000000 --- a/chromium/v8/src/debug/s390/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -jyan@ca.ibm.com -joransiu@ca.ibm.com -michael_dawson@ca.ibm.com -miladfar@ca.ibm.com
\ No newline at end of file diff --git a/chromium/v8/src/debug/s390/debug-s390.cc b/chromium/v8/src/debug/s390/debug-s390.cc index f7aabe39b64..b85b2cc219f 100644 --- a/chromium/v8/src/debug/s390/debug-s390.cc +++ b/chromium/v8/src/debug/s390/debug-s390.cc @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "src/v8.h" +#include "src/init/v8.h" #if V8_TARGET_ARCH_S390 #include "src/debug/debug.h" +#include "src/codegen/macro-assembler.h" #include "src/debug/liveedit.h" -#include "src/frames-inl.h" -#include "src/macro-assembler.h" +#include "src/execution/frames-inl.h" namespace v8 { namespace internal { diff --git a/chromium/v8/src/debug/x64/debug-x64.cc b/chromium/v8/src/debug/x64/debug-x64.cc index 6cdfba151f2..a8b018d99fe 100644 --- a/chromium/v8/src/debug/x64/debug-x64.cc +++ b/chromium/v8/src/debug/x64/debug-x64.cc @@ -6,11 +6,11 @@ #include "src/debug/debug.h" -#include "src/assembler.h" +#include "src/codegen/assembler.h" +#include "src/codegen/macro-assembler.h" #include "src/debug/liveedit.h" -#include "src/frames-inl.h" -#include "src/macro-assembler.h" -#include "src/objects-inl.h" +#include "src/execution/frames-inl.h" +#include "src/objects/objects-inl.h" namespace v8 { namespace internal { |