| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 break; | 680 break; |
| 681 | 681 |
| 682 case Slot::CONTEXT: | 682 case Slot::CONTEXT: |
| 683 // We bypass the general EmitSlotSearch because we know more about | 683 // We bypass the general EmitSlotSearch because we know more about |
| 684 // this specific context. | 684 // this specific context. |
| 685 | 685 |
| 686 // The variable in the decl always resides in the current function | 686 // The variable in the decl always resides in the current function |
| 687 // context. | 687 // context. |
| 688 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); | 688 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); |
| 689 if (FLAG_debug_code) { | 689 if (FLAG_debug_code) { |
| 690 // Check that we're not inside a 'with'. | 690 // Check that we're not inside a with or catch context. |
| 691 __ mov(ebx, ContextOperand(esi, Context::FCONTEXT_INDEX)); | 691 __ mov(ebx, FieldOperand(esi, HeapObject::kMapOffset)); |
| 692 __ cmp(ebx, Operand(esi)); | 692 __ cmp(ebx, isolate()->factory()->with_context_map()); |
| 693 __ Check(equal, "Unexpected declaration in current context."); | 693 __ Check(not_equal, "Declaration in with context."); |
| 694 __ cmp(ebx, isolate()->factory()->catch_context_map()); |
| 695 __ Check(not_equal, "Declaration in catch context."); |
| 694 } | 696 } |
| 695 if (mode == Variable::CONST) { | 697 if (mode == Variable::CONST) { |
| 696 __ mov(ContextOperand(esi, slot->index()), | 698 __ mov(ContextOperand(esi, slot->index()), |
| 697 Immediate(isolate()->factory()->the_hole_value())); | 699 Immediate(isolate()->factory()->the_hole_value())); |
| 698 // No write barrier since the hole value is in old space. | 700 // No write barrier since the hole value is in old space. |
| 699 } else if (function != NULL) { | 701 } else if (function != NULL) { |
| 700 VisitForAccumulatorValue(function); | 702 VisitForAccumulatorValue(function); |
| 701 __ mov(ContextOperand(esi, slot->index()), result_register()); | 703 __ mov(ContextOperand(esi, slot->index()), result_register()); |
| 702 int offset = Context::SlotOffset(slot->index()); | 704 int offset = Context::SlotOffset(slot->index()); |
| 703 __ mov(ebx, esi); | 705 __ mov(ebx, esi); |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 case Slot::PARAMETER: | 1813 case Slot::PARAMETER: |
| 1812 // No const parameters. | 1814 // No const parameters. |
| 1813 UNREACHABLE(); | 1815 UNREACHABLE(); |
| 1814 break; | 1816 break; |
| 1815 case Slot::LOCAL: | 1817 case Slot::LOCAL: |
| 1816 __ mov(edx, Operand(ebp, SlotOffset(slot))); | 1818 __ mov(edx, Operand(ebp, SlotOffset(slot))); |
| 1817 __ cmp(edx, isolate()->factory()->the_hole_value()); | 1819 __ cmp(edx, isolate()->factory()->the_hole_value()); |
| 1818 __ j(not_equal, &skip); | 1820 __ j(not_equal, &skip); |
| 1819 __ mov(Operand(ebp, SlotOffset(slot)), eax); | 1821 __ mov(Operand(ebp, SlotOffset(slot)), eax); |
| 1820 break; | 1822 break; |
| 1821 case Slot::CONTEXT: { | 1823 case Slot::CONTEXT: |
| 1822 __ mov(ecx, ContextOperand(esi, Context::FCONTEXT_INDEX)); | |
| 1823 __ mov(edx, ContextOperand(ecx, slot->index())); | |
| 1824 __ cmp(edx, isolate()->factory()->the_hole_value()); | |
| 1825 __ j(not_equal, &skip); | |
| 1826 __ mov(ContextOperand(ecx, slot->index()), eax); | |
| 1827 int offset = Context::SlotOffset(slot->index()); | |
| 1828 __ mov(edx, eax); // Preserve the stored value in eax. | |
| 1829 __ RecordWrite(ecx, offset, edx, ebx); | |
| 1830 break; | |
| 1831 } | |
| 1832 case Slot::LOOKUP: | 1824 case Slot::LOOKUP: |
| 1833 __ push(eax); | 1825 __ push(eax); |
| 1834 __ push(esi); | 1826 __ push(esi); |
| 1835 __ push(Immediate(var->name())); | 1827 __ push(Immediate(var->name())); |
| 1836 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); | 1828 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); |
| 1837 break; | 1829 break; |
| 1838 } | 1830 } |
| 1839 __ bind(&skip); | 1831 __ bind(&skip); |
| 1840 | 1832 |
| 1841 } else if (var->mode() != Variable::CONST) { | 1833 } else if (var->mode() != Variable::CONST) { |
| (...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4248 // And return. | 4240 // And return. |
| 4249 __ ret(0); | 4241 __ ret(0); |
| 4250 } | 4242 } |
| 4251 | 4243 |
| 4252 | 4244 |
| 4253 #undef __ | 4245 #undef __ |
| 4254 | 4246 |
| 4255 } } // namespace v8::internal | 4247 } } // namespace v8::internal |
| 4256 | 4248 |
| 4257 #endif // V8_TARGET_ARCH_IA32 | 4249 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |