Commit 99d76752 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by V8 LUCI CQ

[debug] Store blocklist on ScopeInfo for DebugEvaluate contexts.

Following up on https://crrev.com/c/1946349, this moves the blocklist to
the ScopeInfo instead of storing it directly on the DebugEvaluate
contexts. This is not the final state that we're looking for, but a
small step along the way.

Bug: chromium:1027475, v8:9938, chromium:1072939
Change-Id: I529f2fcacaf057a1236847bf0eb8e12cc1686515
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2910774Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74724}
parent fed41a92
......@@ -159,9 +159,8 @@ MaybeHandle<Object> DebugEvaluate::WithTopmostArguments(Isolate* isolate,
Handle<ScopeInfo> scope_info =
ScopeInfo::CreateForWithScope(isolate, Handle<ScopeInfo>::null());
scope_info->SetIsDebugEvaluateScope();
Handle<Context> evaluation_context =
factory->NewDebugEvaluateContext(native_context, scope_info, materialized,
Handle<Context>(), Handle<StringSet>());
Handle<Context> evaluation_context = factory->NewDebugEvaluateContext(
native_context, scope_info, materialized, Handle<Context>());
Handle<SharedFunctionInfo> outer_info(
native_context->empty_function().shared(), isolate);
Handle<JSObject> receiver(native_context->global_proxy(), isolate);
......@@ -257,9 +256,13 @@ DebugEvaluate::ContextBuilder::ContextBuilder(Isolate* isolate,
ContextChainElement element = *rit;
scope_info = ScopeInfo::CreateForWithScope(isolate, scope_info);
scope_info->SetIsDebugEvaluateScope();
if (!element.blocklist.is_null()) {
scope_info = ScopeInfo::RecreateWithBlockList(isolate, scope_info,
element.blocklist);
}
evaluation_context_ = factory->NewDebugEvaluateContext(
evaluation_context_, scope_info, element.materialized_object,
element.wrapped_context, element.blocklist);
element.wrapped_context);
}
}
......
......@@ -1174,16 +1174,13 @@ Handle<Context> Factory::NewCatchContext(Handle<Context> previous,
Handle<Context> Factory::NewDebugEvaluateContext(Handle<Context> previous,
Handle<ScopeInfo> scope_info,
Handle<JSReceiver> extension,
Handle<Context> wrapped,
Handle<StringSet> blocklist) {
STATIC_ASSERT(Context::BLOCK_LIST_INDEX ==
Context::MIN_CONTEXT_EXTENDED_SLOTS + 1);
Handle<Context> wrapped) {
DCHECK(scope_info->IsDebugEvaluateScope());
Handle<HeapObject> ext = extension.is_null()
? Handle<HeapObject>::cast(undefined_value())
: Handle<HeapObject>::cast(extension);
// TODO(ishell): Take the details from DebugEvaluateContextContext class.
int variadic_part_length = Context::MIN_CONTEXT_EXTENDED_SLOTS + 2;
int variadic_part_length = Context::MIN_CONTEXT_EXTENDED_SLOTS + 1;
Context context =
NewContextInternal(isolate()->debug_evaluate_context_map(),
Context::SizeFor(variadic_part_length),
......@@ -1196,9 +1193,6 @@ Handle<Context> Factory::NewDebugEvaluateContext(Handle<Context> previous,
if (!wrapped.is_null()) {
context.set(Context::WRAPPED_CONTEXT_INDEX, *wrapped, SKIP_WRITE_BARRIER);
}
if (!blocklist.is_null()) {
context.set(Context::BLOCK_LIST_INDEX, *blocklist, SKIP_WRITE_BARRIER);
}
return handle(context, isolate());
}
......
......@@ -342,8 +342,7 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
Handle<Context> NewDebugEvaluateContext(Handle<Context> previous,
Handle<ScopeInfo> scope_info,
Handle<JSReceiver> extension,
Handle<Context> wrapped,
Handle<StringSet> blocklist);
Handle<Context> wrapped);
// Create a block context.
Handle<Context> NewBlockContext(Handle<Context> previous,
......
......@@ -373,9 +373,9 @@ Handle<Object> Context::Lookup(Handle<Context> context, Handle<String> name,
}
// Check blocklist. Names that are listed, cannot be resolved further.
Object blocklist = context->get(BLOCK_LIST_INDEX);
if (blocklist.IsStringSet() &&
StringSet::cast(blocklist).Has(isolate, name)) {
ScopeInfo scope_info = context->scope_info();
if (scope_info.HasLocalsBlockList() &&
scope_info.LocalsBlockList().Has(isolate, name)) {
if (FLAG_trace_contexts) {
PrintF(" - name is blocklisted. Aborting.\n");
}
......
......@@ -518,8 +518,7 @@ class Context : public TorqueGeneratedContext<Context, HeapObject> {
THROWN_OBJECT_INDEX = MIN_CONTEXT_SLOTS,
// These slots hold values in debug evaluate contexts.
WRAPPED_CONTEXT_INDEX = MIN_CONTEXT_EXTENDED_SLOTS,
BLOCK_LIST_INDEX = MIN_CONTEXT_EXTENDED_SLOTS + 1
WRAPPED_CONTEXT_INDEX = MIN_CONTEXT_EXTENDED_SLOTS
};
static const int kExtensionSize =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment