Index: src/full-codegen/arm64/full-codegen-arm64.cc |
diff --git a/src/full-codegen/arm64/full-codegen-arm64.cc b/src/full-codegen/arm64/full-codegen-arm64.cc |
index 1b0f8626bf8022b926b5d99d6a3b654ee7123a42..3330325df4447f152c9d133efe09c9526b47db3a 100644 |
--- a/src/full-codegen/arm64/full-codegen-arm64.cc |
+++ b/src/full-codegen/arm64/full-codegen-arm64.cc |
@@ -1172,23 +1172,19 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
Register next = x10; |
Register temp = x11; |
- Scope* s = scope(); |
- while (s != NULL) { |
- if (s->num_heap_slots() > 0) { |
- if (s->calls_sloppy_eval()) { |
- // Check that extension is "the hole". |
- __ Ldr(temp, ContextMemOperand(current, Context::EXTENSION_INDEX)); |
- __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow); |
- } |
- // Load next context in chain. |
- __ Ldr(next, ContextMemOperand(current, Context::PREVIOUS_INDEX)); |
- // Walk the rest of the chain without clobbering cp. |
- current = next; |
- } |
- // If no outer scope calls eval, we do not need to check more |
- // context extensions. |
- if (!s->outer_scope_calls_sloppy_eval()) break; |
- s = s->outer_scope(); |
+ int to_check = scope()->ContextChainLengthUntilOutermostSloppyEval(); |
+ for (Scope* s = scope(); to_check > 0; s = s->outer_scope()) { |
+ if (!s->NeedsContext()) continue; |
+ if (s->calls_sloppy_eval()) { |
+ // Check that extension is "the hole". |
+ __ Ldr(temp, ContextMemOperand(current, Context::EXTENSION_INDEX)); |
+ __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow); |
+ } |
+ // Load next context in chain. |
+ __ Ldr(next, ContextMemOperand(current, Context::PREVIOUS_INDEX)); |
+ // Walk the rest of the chain without clobbering cp. |
+ current = next; |
+ to_check--; |
} |
// All extension objects were empty and it is safe to use a normal global |