Index: src/ia32/macro-assembler-ia32.cc |
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
index a4c9b11879725be6330c1cca5b5301ed24abe4a8..c138976243426db41dd417c43a7ffa3ee0d280b6 100644 |
--- a/src/ia32/macro-assembler-ia32.cc |
+++ b/src/ia32/macro-assembler-ia32.cc |
@@ -1523,12 +1523,20 @@ void MacroAssembler::LoadContext(Register dst, int context_chain_length) { |
mov(dst, Operand(dst, Context::SlotOffset(Context::CLOSURE_INDEX))); |
mov(dst, FieldOperand(dst, JSFunction::kContextOffset)); |
} |
- // The context may be an intermediate context, not a function context. |
- mov(dst, Operand(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. |
- mov(dst, Operand(esi, 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, esi); |
} |
+ |
+ // 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. |
+ cmp(dst, Operand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
fschneider
2011/02/04 11:29:58
Shouldn't this be inside
if (FLAG_debug_code)?
Kevin Millikin (Chromium)
2011/02/04 11:51:48
Good catch.
|
+ Check(equal, "Yo dawg, I heard you liked function contexts " |
+ "so I put function contexts in all your contexts"); |
} |