Index: src/full-codegen/ppc/full-codegen-ppc.cc |
diff --git a/src/full-codegen/ppc/full-codegen-ppc.cc b/src/full-codegen/ppc/full-codegen-ppc.cc |
index 3c6ad3306d2f2c8dd1712ebc1838aa7120c7cf05..00f8bbc83a2256174f24fa746962770494ee5ae0 100644 |
--- a/src/full-codegen/ppc/full-codegen-ppc.cc |
+++ b/src/full-codegen/ppc/full-codegen-ppc.cc |
@@ -1148,23 +1148,19 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
Register next = r4; |
Register temp = r5; |
- Scope* s = scope(); |
- while (s != NULL) { |
- if (s->num_heap_slots() > 0) { |
- if (s->calls_sloppy_eval()) { |
- // Check that extension is "the hole". |
- __ LoadP(temp, ContextMemOperand(current, Context::EXTENSION_INDEX)); |
- __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow); |
- } |
- // Load next context in chain. |
- __ LoadP(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". |
+ __ LoadP(temp, ContextMemOperand(current, Context::EXTENSION_INDEX)); |
+ __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow); |
+ } |
+ // Load next context in chain. |
+ __ LoadP(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 |