summaryrefslogtreecommitdiff
path: root/deps/v8/src/debug/debug-evaluate.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/debug/debug-evaluate.cc')
-rw-r--r--deps/v8/src/debug/debug-evaluate.cc42
1 files changed, 25 insertions, 17 deletions
diff --git a/deps/v8/src/debug/debug-evaluate.cc b/deps/v8/src/debug/debug-evaluate.cc
index 203885143f..3568860e7d 100644
--- a/deps/v8/src/debug/debug-evaluate.cc
+++ b/deps/v8/src/debug/debug-evaluate.cc
@@ -23,9 +23,13 @@ namespace internal {
MaybeHandle<Object> DebugEvaluate::Global(Isolate* isolate,
Handle<String> source,
- bool throw_on_side_effect) {
+ debug::EvaluateGlobalMode mode) {
// Disable breaks in side-effect free mode.
- DisableBreak disable_break_scope(isolate->debug(), throw_on_side_effect);
+ DisableBreak disable_break_scope(
+ isolate->debug(),
+ mode == debug::EvaluateGlobalMode::kDisableBreaks ||
+ mode ==
+ debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect);
Handle<Context> context = isolate->native_context();
ScriptOriginOptions origin_options(false, true);
@@ -42,11 +46,15 @@ MaybeHandle<Object> DebugEvaluate::Global(Isolate* isolate,
Handle<JSFunction> fun =
isolate->factory()->NewFunctionFromSharedFunctionInfo(shared_info,
context);
- if (throw_on_side_effect) isolate->debug()->StartSideEffectCheckMode();
+ if (mode == debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) {
+ isolate->debug()->StartSideEffectCheckMode();
+ }
MaybeHandle<Object> result = Execution::Call(
isolate, fun, Handle<JSObject>(context->global_proxy(), isolate), 0,
nullptr);
- if (throw_on_side_effect) isolate->debug()->StopSideEffectCheckMode();
+ if (mode == debug::EvaluateGlobalMode::kDisableBreaksAndThrowOnSideEffect) {
+ isolate->debug()->StopSideEffectCheckMode();
+ }
return result;
}
@@ -174,31 +182,31 @@ DebugEvaluate::ContextBuilder::ContextBuilder(Isolate* isolate,
// - To make stack-allocated variables visible, we materialize them and
// use a debug-evaluate context to wrap both the materialized object and
// the original context.
- // - We use the original context chain from the function context to the
- // native context.
+ // - We also wrap all contexts on the chain between the original context
+ // and the function context.
// - Between the function scope and the native context, we only resolve
- // variable names that the current function already uses. Only for these
- // names we can be sure that they will be correctly resolved. For the
- // rest, we only resolve to with, script, and native contexts. We use a
- // whitelist to implement that.
+ // variable names that are guaranteed to not be shadowed by stack-allocated
+ // variables. Contexts between the function context and the original
+ // context have a blacklist attached to implement that.
// Context::Lookup has special handling for debug-evaluate contexts:
// - Look up in the materialized stack variables.
+ // - Check the blacklist to find out whether to abort further lookup.
// - Look up in the original context.
- // - Check the whitelist to find out whether to skip contexts during lookup.
- for (; scope_iterator_.InInnerScope(); scope_iterator_.Next()) {
+ for (; !scope_iterator_.Done(); scope_iterator_.Next()) {
ScopeIterator::ScopeType scope_type = scope_iterator_.Type();
if (scope_type == ScopeIterator::ScopeTypeScript) break;
ContextChainElement context_chain_element;
- if (scope_type == ScopeIterator::ScopeTypeLocal ||
- scope_iterator_.DeclaresLocals(ScopeIterator::Mode::STACK)) {
+ if (scope_iterator_.InInnerScope() &&
+ (scope_type == ScopeIterator::ScopeTypeLocal ||
+ scope_iterator_.DeclaresLocals(ScopeIterator::Mode::STACK))) {
context_chain_element.materialized_object =
scope_iterator_.ScopeObject(ScopeIterator::Mode::STACK);
}
if (scope_iterator_.HasContext()) {
context_chain_element.wrapped_context = scope_iterator_.CurrentContext();
}
- if (scope_type == ScopeIterator::ScopeTypeLocal) {
- context_chain_element.whitelist = scope_iterator_.GetNonLocals();
+ if (!scope_iterator_.InInnerScope()) {
+ context_chain_element.blacklist = scope_iterator_.GetLocals();
}
context_chain_.push_back(context_chain_element);
}
@@ -214,7 +222,7 @@ DebugEvaluate::ContextBuilder::ContextBuilder(Isolate* isolate,
scope_info->SetIsDebugEvaluateScope();
evaluation_context_ = factory->NewDebugEvaluateContext(
evaluation_context_, scope_info, element.materialized_object,
- element.wrapped_context, element.whitelist);
+ element.wrapped_context, element.blacklist);
}
}