Commit 3db269f9 authored by verwaest's avatar verwaest Committed by Commit bot

Drop is_eval_scope when checking how to access dynamic globals. It has no influence

BUG=

Review-Url: https://codereview.chromium.org/2266843002
Cr-Commit-Position: refs/heads/master@{#38773}
parent 6e665b09
......@@ -3084,15 +3084,10 @@ const uint32_t kFullCheckRequired = -1;
uint32_t AstGraphBuilder::ComputeBitsetForDynamicGlobal(Variable* variable) {
DCHECK_EQ(DYNAMIC_GLOBAL, variable->mode());
bool found_eval_scope = false;
uint32_t check_depths = 0;
for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) {
if (s->num_heap_slots() <= 0) continue;
// TODO(mstarzinger): If we have reached an eval scope, we check all
// extensions from this point. Replicated from full-codegen, figure out
// whether this is still needed. If not, drop {found_eval_scope} below.
if (s->is_eval_scope()) found_eval_scope = true;
if (!s->calls_sloppy_eval() && !found_eval_scope) continue;
if (!s->calls_sloppy_eval()) continue;
int depth = current_scope()->ContextChainLength(s);
if (depth > kMaxCheckDepth) return kFullCheckRequired;
check_depths |= 1 << depth;
......
......@@ -1199,30 +1199,10 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
}
// If no outer scope calls eval, we do not need to check more
// context extensions.
if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break;
if (!s->outer_scope_calls_sloppy_eval()) break;
s = s->outer_scope();
}
if (s->is_eval_scope()) {
Label loop, fast;
if (!current.is(next)) {
__ Move(next, current);
}
__ bind(&loop);
// Terminate at native context.
__ ldr(temp, FieldMemOperand(next, HeapObject::kMapOffset));
__ LoadRoot(ip, Heap::kNativeContextMapRootIndex);
__ cmp(temp, ip);
__ b(eq, &fast);
// Check that extension is "the hole".
__ ldr(temp, ContextMemOperand(next, Context::EXTENSION_INDEX));
__ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
// Load next context in chain.
__ ldr(next, ContextMemOperand(next, Context::PREVIOUS_INDEX));
__ b(&loop);
__ bind(&fast);
}
// All extension objects were empty and it is safe to use a normal global
// load machinery.
EmitGlobalVariableLoad(proxy, typeof_mode);
......
......@@ -1187,27 +1187,10 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
}
// If no outer scope calls eval, we do not need to check more
// context extensions.
if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break;
if (!s->outer_scope_calls_sloppy_eval()) break;
s = s->outer_scope();
}
if (s->is_eval_scope()) {
Label loop, fast;
__ Mov(next, current);
__ Bind(&loop);
// Terminate at native context.
__ Ldr(temp, FieldMemOperand(next, HeapObject::kMapOffset));
__ JumpIfRoot(temp, Heap::kNativeContextMapRootIndex, &fast);
// Check that extension is "the hole".
__ Ldr(temp, ContextMemOperand(next, Context::EXTENSION_INDEX));
__ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
// Load next context in chain.
__ Ldr(next, ContextMemOperand(next, Context::PREVIOUS_INDEX));
__ B(&loop);
__ Bind(&fast);
}
// All extension objects were empty and it is safe to use a normal global
// load machinery.
EmitGlobalVariableLoad(proxy, typeof_mode);
......
......@@ -1122,33 +1122,11 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
context = temp;
}
// If no outer scope calls eval, we do not need to check more
// context extensions. If we have reached an eval scope, we check
// all extensions from this point.
if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break;
// context extensions.
if (!s->outer_scope_calls_sloppy_eval()) break;
s = s->outer_scope();
}
if (s != NULL && s->is_eval_scope()) {
// Loop up the context chain. There is no frame effect so it is
// safe to use raw labels here.
Label next, fast;
if (!context.is(temp)) {
__ mov(temp, context);
}
__ bind(&next);
// Terminate at native context.
__ cmp(FieldOperand(temp, HeapObject::kMapOffset),
Immediate(isolate()->factory()->native_context_map()));
__ j(equal, &fast, Label::kNear);
// Check that extension is "the hole".
__ JumpIfNotRoot(ContextOperand(temp, Context::EXTENSION_INDEX),
Heap::kTheHoleValueRootIndex, slow);
// Load next context in chain.
__ mov(temp, ContextOperand(temp, Context::PREVIOUS_INDEX));
__ jmp(&next);
__ bind(&fast);
}
// All extension objects were empty and it is safe to use a normal global
// load machinery.
EmitGlobalVariableLoad(proxy, typeof_mode);
......
......@@ -1194,29 +1194,10 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
}
// If no outer scope calls eval, we do not need to check more
// context extensions.
if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break;
if (!s->outer_scope_calls_sloppy_eval()) break;
s = s->outer_scope();
}
if (s->is_eval_scope()) {
Label loop, fast;
if (!current.is(next)) {
__ Move(next, current);
}
__ bind(&loop);
// Terminate at native context.
__ lw(temp, FieldMemOperand(next, HeapObject::kMapOffset));
__ LoadRoot(t0, Heap::kNativeContextMapRootIndex);
__ Branch(&fast, eq, temp, Operand(t0));
// Check that extension is "the hole".
__ lw(temp, ContextMemOperand(next, Context::EXTENSION_INDEX));
__ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
// Load next context in chain.
__ lw(next, ContextMemOperand(next, Context::PREVIOUS_INDEX));
__ Branch(&loop);
__ bind(&fast);
}
// All extension objects were empty and it is safe to use a normal global
// load machinery.
EmitGlobalVariableLoad(proxy, typeof_mode);
......
......@@ -1195,29 +1195,10 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
}
// If no outer scope calls eval, we do not need to check more
// context extensions.
if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break;
if (!s->outer_scope_calls_sloppy_eval()) break;
s = s->outer_scope();
}
if (s->is_eval_scope()) {
Label loop, fast;
if (!current.is(next)) {
__ Move(next, current);
}
__ bind(&loop);
// Terminate at native context.
__ ld(temp, FieldMemOperand(next, HeapObject::kMapOffset));
__ LoadRoot(a4, Heap::kNativeContextMapRootIndex);
__ Branch(&fast, eq, temp, Operand(a4));
// Check that extension is "the hole".
__ ld(temp, ContextMemOperand(next, Context::EXTENSION_INDEX));
__ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
// Load next context in chain.
__ ld(next, ContextMemOperand(next, Context::PREVIOUS_INDEX));
__ Branch(&loop);
__ bind(&fast);
}
// All extension objects were empty and it is safe to use a normal global
// load machinery.
EmitGlobalVariableLoad(proxy, typeof_mode);
......
......@@ -1163,30 +1163,10 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
}
// If no outer scope calls eval, we do not need to check more
// context extensions.
if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break;
if (!s->outer_scope_calls_sloppy_eval()) break;
s = s->outer_scope();
}
if (s->is_eval_scope()) {
Label loop, fast;
if (!current.is(next)) {
__ Move(next, current);
}
__ bind(&loop);
// Terminate at native context.
__ LoadP(temp, FieldMemOperand(next, HeapObject::kMapOffset));
__ LoadRoot(ip, Heap::kNativeContextMapRootIndex);
__ cmp(temp, ip);
__ beq(&fast);
// Check that extension is "the hole".
__ LoadP(temp, ContextMemOperand(next, Context::EXTENSION_INDEX));
__ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
// Load next context in chain.
__ LoadP(next, ContextMemOperand(next, Context::PREVIOUS_INDEX));
__ b(&loop);
__ bind(&fast);
}
// All extension objects were empty and it is safe to use a normal global
// load machinery.
EmitGlobalVariableLoad(proxy, typeof_mode);
......
......@@ -1130,29 +1130,10 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
}
// If no outer scope calls eval, we do not need to check more
// context extensions.
if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break;
if (!s->outer_scope_calls_sloppy_eval()) break;
s = s->outer_scope();
}
if (s->is_eval_scope()) {
Label loop, fast;
if (!current.is(next)) {
__ Move(next, current);
}
__ bind(&loop);
// Terminate at native context.
__ LoadP(temp, FieldMemOperand(next, HeapObject::kMapOffset));
__ CompareRoot(temp, Heap::kNativeContextMapRootIndex);
__ beq(&fast, Label::kNear);
// Check that extension is "the hole".
__ LoadP(temp, ContextMemOperand(next, Context::EXTENSION_INDEX));
__ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
// Load next context in chain.
__ LoadP(next, ContextMemOperand(next, Context::PREVIOUS_INDEX));
__ b(&loop);
__ bind(&fast);
}
// All extension objects were empty and it is safe to use a normal global
// load machinery.
EmitGlobalVariableLoad(proxy, typeof_mode);
......
......@@ -1150,34 +1150,11 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
context = temp;
}
// If no outer scope calls eval, we do not need to check more
// context extensions. If we have reached an eval scope, we check
// all extensions from this point.
if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break;
// context extensions.
if (!s->outer_scope_calls_sloppy_eval()) break;
s = s->outer_scope();
}
if (s != NULL && s->is_eval_scope()) {
// Loop up the context chain. There is no frame effect so it is
// safe to use raw labels here.
Label next, fast;
if (!context.is(temp)) {
__ movp(temp, context);
}
// Load map for comparison into register, outside loop.
__ LoadRoot(kScratchRegister, Heap::kNativeContextMapRootIndex);
__ bind(&next);
// Terminate at native context.
__ cmpp(kScratchRegister, FieldOperand(temp, HeapObject::kMapOffset));
__ j(equal, &fast, Label::kNear);
// Check that extension is "the hole".
__ JumpIfNotRoot(ContextOperand(temp, Context::EXTENSION_INDEX),
Heap::kTheHoleValueRootIndex, slow);
// Load next context in chain.
__ movp(temp, ContextOperand(temp, Context::PREVIOUS_INDEX));
__ jmp(&next);
__ bind(&fast);
}
// All extension objects were empty and it is safe to use a normal global
// load machinery.
EmitGlobalVariableLoad(proxy, typeof_mode);
......
......@@ -1116,31 +1116,10 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
// If no outer scope calls eval, we do not need to check more
// context extensions. If we have reached an eval scope, we check
// all extensions from this point.
if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break;
if (!s->outer_scope_calls_sloppy_eval()) break;
s = s->outer_scope();
}
if (s != NULL && s->is_eval_scope()) {
// Loop up the context chain. There is no frame effect so it is
// safe to use raw labels here.
Label next, fast;
if (!context.is(temp)) {
__ mov(temp, context);
}
__ bind(&next);
// Terminate at native context.
__ cmp(FieldOperand(temp, HeapObject::kMapOffset),
Immediate(isolate()->factory()->native_context_map()));
__ j(equal, &fast, Label::kNear);
// Check that extension is "the hole".
__ JumpIfNotRoot(ContextOperand(temp, Context::EXTENSION_INDEX),
Heap::kTheHoleValueRootIndex, slow);
// Load next context in chain.
__ mov(temp, ContextOperand(temp, Context::PREVIOUS_INDEX));
__ jmp(&next);
__ bind(&fast);
}
// All extension objects were empty and it is safe to use a normal global
// load machinery.
EmitGlobalVariableLoad(proxy, typeof_mode);
......
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