Commit c4706658 authored by yangguo's avatar yangguo Committed by Commit bot

[debugger] use object with null proto to materialize scopes.

Otherwise property lookups would also travel up the prototype chain, which makes no sense for the debugger use case.

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/1928463002

Cr-Commit-Position: refs/heads/master@{#35806}
parent d1e08e7a
......@@ -453,7 +453,7 @@ MaybeHandle<JSObject> ScopeIterator::MaterializeScriptScope() {
global->native_context()->script_context_table());
Handle<JSObject> script_scope =
isolate_->factory()->NewJSObject(isolate_->object_function());
isolate_->factory()->NewJSObjectWithNullProto();
for (int context_index = 0; context_index < script_contexts->used();
context_index++) {
......@@ -470,7 +470,7 @@ MaybeHandle<JSObject> ScopeIterator::MaterializeLocalScope() {
Handle<JSFunction> function = GetFunction();
Handle<JSObject> local_scope =
isolate_->factory()->NewJSObject(isolate_->object_function());
isolate_->factory()->NewJSObjectWithNullProto();
frame_inspector_->MaterializeStackLocals(local_scope, function);
Handle<Context> frame_context =
......@@ -513,7 +513,7 @@ Handle<JSObject> ScopeIterator::MaterializeClosure() {
// Allocate and initialize a JSObject with all the content of this function
// closure.
Handle<JSObject> closure_scope =
isolate_->factory()->NewJSObject(isolate_->object_function());
isolate_->factory()->NewJSObjectWithNullProto();
// Fill all context locals to the context extension.
CopyContextLocalsToScopeObject(scope_info, context, closure_scope);
......@@ -540,7 +540,7 @@ Handle<JSObject> ScopeIterator::MaterializeCatchScope() {
Handle<Object> thrown_object(context->get(Context::THROWN_OBJECT_INDEX),
isolate_);
Handle<JSObject> catch_scope =
isolate_->factory()->NewJSObject(isolate_->object_function());
isolate_->factory()->NewJSObjectWithNullProto();
JSObject::SetOwnPropertyIgnoreAttributes(catch_scope, name, thrown_object,
NONE)
.Check();
......@@ -562,7 +562,7 @@ Handle<JSObject> ScopeIterator::WithContextExtension() {
// block context.
Handle<JSObject> ScopeIterator::MaterializeBlockScope() {
Handle<JSObject> block_scope =
isolate_->factory()->NewJSObject(isolate_->object_function());
isolate_->factory()->NewJSObjectWithNullProto();
Handle<Context> context = Handle<Context>::null();
if (!nested_scope_chain_.is_empty()) {
......@@ -599,7 +599,7 @@ MaybeHandle<JSObject> ScopeIterator::MaterializeModuleScope() {
// Allocate and initialize a JSObject with all the members of the debugged
// module.
Handle<JSObject> module_scope =
isolate_->factory()->NewJSObject(isolate_->object_function());
isolate_->factory()->NewJSObjectWithNullProto();
// Fill all context locals.
CopyContextLocalsToScopeObject(scope_info, context, module_scope);
......
......@@ -1294,10 +1294,7 @@ RUNTIME_FUNCTION(Runtime_DebugGetLoadedScripts) {
}
// Return result as a JS array.
Handle<JSObject> result =
isolate->factory()->NewJSObject(isolate->array_function());
JSArray::SetContent(Handle<JSArray>::cast(result), instances);
return *result;
return *isolate->factory()->NewJSArrayWithElements(instances);
}
static bool HasInPrototypeChainIgnoringProxies(Isolate* isolate,
......
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