Chromium Code Reviews| Index: src/ia32/fast-codegen-ia32.cc |
| =================================================================== |
| --- src/ia32/fast-codegen-ia32.cc (revision 3095) |
| +++ src/ia32/fast-codegen-ia32.cc (working copy) |
| @@ -129,12 +129,32 @@ |
| void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) { |
| Comment cmnt(masm_, "[ VariableProxy"); |
| Expression* rewrite = expr->var()->rewrite(); |
| - ASSERT(rewrite != NULL); |
| + if (rewrite == NULL) { |
|
fschneider
2009/10/20 14:16:17
Insert a comment here like:
Comment cmnt(masm_, "
|
| + // Reference to a global variable, use inline caching. Variable |
| + // name is passed in ecx and the global object on the stack. |
| + __ push(CodeGenerator::GlobalObject()); |
| + __ mov(ecx, expr->name()); |
| + Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
| + __ call(ic, RelocInfo::CODE_TARGET_CONTEXT); |
| - Slot* slot = rewrite->AsSlot(); |
| - ASSERT(slot != NULL); |
| - { Comment cmnt(masm_, "[ Slot"); |
| + // A test eax instruction following the call is used by the IC to |
| + // indicate that the inobject property case was inlined. Ensure there |
| + // is no test eax instruction here. Remember that the assembler may |
| + // choose to do peephole optimization (eg, push/pop elimination). |
| if (expr->location().is_temporary()) { |
| + // Replace the global object with the result. |
| + __ mov(Operand(esp, 0), eax); |
| + } else { |
| + ASSERT(expr->location().is_nowhere()); |
| + __ pop(eax); |
| + } |
| + |
| + } else { |
| + // Reference to a local or parameter slot. |
| + Comment cmnt(masm_, "[ Slot"); |
| + Slot* slot = rewrite->AsSlot(); |
| + ASSERT(slot != NULL); |
| + if (expr->location().is_temporary()) { |
| __ push(Operand(ebp, SlotOffset(slot))); |
| } else { |
| ASSERT(expr->location().is_nowhere()); |