summaryrefslogtreecommitdiff
path: root/deps/v8/src/debug/debug-evaluate.cc
diff options
context:
space:
mode:
authorMichaƫl Zasso <targos@protonmail.com>2022-11-18 09:50:46 +0000
committerNode.js GitHub Bot <github-bot@iojs.org>2022-11-19 09:11:32 +0000
commitedd537ca2f38b94738fe25c2dc9b8c21bc7847f2 (patch)
treedad755f6f70ae5d70ab7bc251193ceeff04f20a5 /deps/v8/src/debug/debug-evaluate.cc
parentbcc704f6e527a2b072bf1477e72ae49a5a96c51a (diff)
downloadnode-new-edd537ca2f38b94738fe25c2dc9b8c21bc7847f2.tar.gz
deps: update V8 to 10.8.168.20
PR-URL: https://github.com/nodejs/node/pull/45230 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Diffstat (limited to 'deps/v8/src/debug/debug-evaluate.cc')
-rw-r--r--deps/v8/src/debug/debug-evaluate.cc49
1 files changed, 40 insertions, 9 deletions
diff --git a/deps/v8/src/debug/debug-evaluate.cc b/deps/v8/src/debug/debug-evaluate.cc
index 65bdfa241a..2813456b12 100644
--- a/deps/v8/src/debug/debug-evaluate.cc
+++ b/deps/v8/src/debug/debug-evaluate.cc
@@ -19,6 +19,7 @@
#include "src/interpreter/bytecodes.h"
#include "src/objects/code-inl.h"
#include "src/objects/contexts.h"
+#include "src/objects/string-set-inl.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/debug/debug-wasm-objects.h"
@@ -210,7 +211,9 @@ DebugEvaluate::ContextBuilder::ContextBuilder(Isolate* isolate,
: isolate_(isolate),
frame_inspector_(frame, inlined_jsframe_index, isolate),
scope_iterator_(isolate, &frame_inspector_,
- ScopeIterator::ReparseStrategy::kScript) {
+ v8_flags.experimental_reuse_locals_blocklists
+ ? ScopeIterator::ReparseStrategy::kScriptIfNeeded
+ : ScopeIterator::ReparseStrategy::kScript) {
Handle<Context> outer_context(frame_inspector_.GetFunction()->context(),
isolate);
evaluation_context_ = outer_context;
@@ -246,8 +249,16 @@ DebugEvaluate::ContextBuilder::ContextBuilder(Isolate* isolate,
if (scope_iterator_.HasContext()) {
context_chain_element.wrapped_context = scope_iterator_.CurrentContext();
}
- if (!scope_iterator_.InInnerScope()) {
- context_chain_element.blocklist = scope_iterator_.GetLocals();
+ if (v8_flags.experimental_reuse_locals_blocklists) {
+ // With the re-use experiment we only need `DebugEvaluateContexts` up
+ // to (and including) the paused function scope so the evaluated
+ // expression can access the materialized stack locals.
+ if (!scope_iterator_.InInnerScope()) break;
+ } else {
+ CHECK(!v8_flags.experimental_reuse_locals_blocklists);
+ if (!scope_iterator_.InInnerScope()) {
+ context_chain_element.blocklist = scope_iterator_.GetLocals();
+ }
}
context_chain_.push_back(context_chain_element);
}
@@ -261,10 +272,28 @@ DebugEvaluate::ContextBuilder::ContextBuilder(Isolate* isolate,
ContextChainElement element = *rit;
scope_info = ScopeInfo::CreateForWithScope(isolate, scope_info);
scope_info->SetIsDebugEvaluateScope();
- if (!element.blocklist.is_null()) {
+
+ if (v8_flags.experimental_reuse_locals_blocklists) {
+ if (rit == context_chain_.rbegin()) {
+ // The DebugEvaluateContext we create for the closure scope is the only
+ // DebugEvaluateContext with a block list. This means we'll retrieve
+ // the existing block list from the paused function scope
+ // and also associate the temporary scope_info we create here with that
+ // blocklist.
+ Handle<ScopeInfo> function_scope_info = handle(
+ frame_inspector_.GetFunction()->shared().scope_info(), isolate_);
+ Handle<Object> block_list = handle(
+ isolate_->LocalsBlockListCacheGet(function_scope_info), isolate_);
+ CHECK(block_list->IsStringSet());
+ isolate_->LocalsBlockListCacheSet(scope_info, Handle<ScopeInfo>::null(),
+ Handle<StringSet>::cast(block_list));
+ }
+ } else if (!element.blocklist.is_null()) {
+ CHECK(!v8_flags.experimental_reuse_locals_blocklists);
scope_info = ScopeInfo::RecreateWithBlockList(isolate, scope_info,
element.blocklist);
}
+
evaluation_context_ = factory->NewDebugEvaluateContext(
evaluation_context_, scope_info, element.materialized_object,
element.wrapped_context);
@@ -407,7 +436,7 @@ bool DebugEvaluate::IsSideEffectFreeIntrinsic(Runtime::FunctionId id) {
INLINE_INTRINSIC_ALLOWLIST(INLINE_CASE)
return true;
default:
- if (FLAG_trace_side_effect_free_debug_evaluate) {
+ if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] intrinsic %s may cause side effect.\n",
Runtime::FunctionForId(id)->name);
}
@@ -573,6 +602,8 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtin id) {
case Builtin::kArrayPrototypeFlat:
case Builtin::kArrayPrototypeFlatMap:
case Builtin::kArrayPrototypeJoin:
+ case Builtin::kArrayPrototypeGroup:
+ case Builtin::kArrayPrototypeGroupToMap:
case Builtin::kArrayPrototypeKeys:
case Builtin::kArrayPrototypeLastIndexOf:
case Builtin::kArrayPrototypeSlice:
@@ -975,7 +1006,7 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtin id) {
return DebugInfo::kRequiresRuntimeChecks;
default:
- if (FLAG_trace_side_effect_free_debug_evaluate) {
+ if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] built-in %s may cause side effect.\n",
Builtins::name(id));
}
@@ -1003,7 +1034,7 @@ bool BytecodeRequiresRuntimeCheck(interpreter::Bytecode bytecode) {
// static
DebugInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState(
Isolate* isolate, Handle<SharedFunctionInfo> info) {
- if (FLAG_trace_side_effect_free_debug_evaluate) {
+ if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] Checking function %s for side effect.\n",
info->DebugNameCStr().get());
}
@@ -1014,7 +1045,7 @@ DebugInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState(
// Check bytecodes against allowlist.
Handle<BytecodeArray> bytecode_array(info->GetBytecodeArray(isolate),
isolate);
- if (FLAG_trace_side_effect_free_debug_evaluate) {
+ if (v8_flags.trace_side_effect_free_debug_evaluate) {
bytecode_array->Print();
}
bool requires_runtime_checks = false;
@@ -1027,7 +1058,7 @@ DebugInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState(
continue;
}
- if (FLAG_trace_side_effect_free_debug_evaluate) {
+ if (v8_flags.trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] bytecode %s may cause side effect.\n",
interpreter::Bytecodes::ToString(bytecode));
}