Index: src/full-codegen/x64/full-codegen-x64.cc |
diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc |
index 0c5f0c13d1923f49b0b5ff6995f1ba790fc4db6e..4b0e43c9b21afc825338e7f62647b0b3676a5fce 100644 |
--- a/src/full-codegen/x64/full-codegen-x64.cc |
+++ b/src/full-codegen/x64/full-codegen-x64.cc |
@@ -1136,23 +1136,19 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
Register context = rsi; |
Register temp = rdx; |
- Scope* s = scope(); |
- while (s != NULL) { |
- if (s->num_heap_slots() > 0) { |
- if (s->calls_sloppy_eval()) { |
- // Check that extension is "the hole". |
- __ JumpIfNotRoot(ContextOperand(context, Context::EXTENSION_INDEX), |
- Heap::kTheHoleValueRootIndex, slow); |
- } |
- // Load next context in chain. |
- __ movp(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
- // Walk the rest of the chain without clobbering rsi. |
- context = temp; |
- } |
- // 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". |
+ __ JumpIfNotRoot(ContextOperand(context, Context::EXTENSION_INDEX), |
+ Heap::kTheHoleValueRootIndex, slow); |
+ } |
+ // Load next context in chain. |
+ __ movp(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
+ // Walk the rest of the chain without clobbering rsi. |
+ context = temp; |
+ to_check--; |
} |
// All extension objects were empty and it is safe to use a normal global |