Index: src/arm/macro-assembler-arm.cc |
=================================================================== |
--- src/arm/macro-assembler-arm.cc (revision 6881) |
+++ src/arm/macro-assembler-arm.cc (working copy) |
@@ -2155,12 +2155,24 @@ |
ldr(dst, MemOperand(dst, Context::SlotOffset(Context::CLOSURE_INDEX))); |
ldr(dst, FieldMemOperand(dst, JSFunction::kContextOffset)); |
} |
- // The context may be an intermediate context, not a function context. |
- ldr(dst, MemOperand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
- } else { // Slot is in the current function context. |
- // The context may be an intermediate context, not a function context. |
- ldr(dst, MemOperand(cp, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
+ } else { |
+ // Slot is in the current function context. Move it into the |
+ // destination register in case we store into it (the write barrier |
+ // cannot be allowed to destroy the context in esi). |
+ mov(dst, cp); |
} |
+ |
+ // We should not have found a 'with' context by walking the context chain |
+ // (i.e., the static scope chain and runtime context chain do not agree). |
+ // A variable occurring in such a scope should have slot type LOOKUP and |
+ // not CONTEXT. |
+ if (FLAG_debug_code) { |
+ ldr(ip, MemOperand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
+ cmp(dst, ip); |
+ Check(eq, "Yo dawg, I heard you liked function contexts " |
+ "so I put function contexts in all your contexts"); |
+ } |
+ |
} |