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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 break; | 711 break; |
712 | 712 |
713 case Slot::CONTEXT: | 713 case Slot::CONTEXT: |
714 // We bypass the general EmitSlotSearch because we know more about | 714 // We bypass the general EmitSlotSearch because we know more about |
715 // this specific context. | 715 // this specific context. |
716 | 716 |
717 // The variable in the decl always resides in the current function | 717 // The variable in the decl always resides in the current function |
718 // context. | 718 // context. |
719 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); | 719 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); |
720 if (FLAG_debug_code) { | 720 if (FLAG_debug_code) { |
721 // Check that we're not inside a 'with'. | 721 // Check that we're not inside a with or catch context. |
722 __ lw(a1, ContextOperand(cp, Context::FCONTEXT_INDEX)); | 722 __ lw(a1, FieldMemOperand(cp, HeapObject::kMapOffset)); |
723 __ Check(eq, "Unexpected declaration in current context.", | 723 __ LoadRoot(t0, Heap::kWithContextMapRootIndex); |
724 a1, Operand(cp)); | 724 __ Check(ne, "Declaration in with context.", |
| 725 a1, Operand(t0)); |
| 726 __ LoadRoot(t0, Heap::kCatchContextMapRootIndex); |
| 727 __ Check(ne, "Declaration in catch context.", |
| 728 a1, Operand(t0)); |
725 } | 729 } |
726 if (mode == Variable::CONST) { | 730 if (mode == Variable::CONST) { |
727 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 731 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
728 __ sw(at, ContextOperand(cp, slot->index())); | 732 __ sw(at, ContextOperand(cp, slot->index())); |
729 // No write barrier since the_hole_value is in old space. | 733 // No write barrier since the_hole_value is in old space. |
730 } else if (function != NULL) { | 734 } else if (function != NULL) { |
731 VisitForAccumulatorValue(function); | 735 VisitForAccumulatorValue(function); |
732 __ sw(result_register(), ContextOperand(cp, slot->index())); | 736 __ sw(result_register(), ContextOperand(cp, slot->index())); |
733 int offset = Context::SlotOffset(slot->index()); | 737 int offset = Context::SlotOffset(slot->index()); |
734 // We know that we have written a function, which is not a smi. | 738 // We know that we have written a function, which is not a smi. |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 // No const parameters. | 1876 // No const parameters. |
1873 UNREACHABLE(); | 1877 UNREACHABLE(); |
1874 break; | 1878 break; |
1875 case Slot::LOCAL: | 1879 case Slot::LOCAL: |
1876 // Detect const reinitialization by checking for the hole value. | 1880 // Detect const reinitialization by checking for the hole value. |
1877 __ lw(a1, MemOperand(fp, SlotOffset(slot))); | 1881 __ lw(a1, MemOperand(fp, SlotOffset(slot))); |
1878 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); | 1882 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); |
1879 __ Branch(&skip, ne, a1, Operand(t0)); | 1883 __ Branch(&skip, ne, a1, Operand(t0)); |
1880 __ sw(result_register(), MemOperand(fp, SlotOffset(slot))); | 1884 __ sw(result_register(), MemOperand(fp, SlotOffset(slot))); |
1881 break; | 1885 break; |
1882 case Slot::CONTEXT: { | 1886 case Slot::CONTEXT: |
1883 __ lw(a1, ContextOperand(cp, Context::FCONTEXT_INDEX)); | |
1884 __ lw(a2, ContextOperand(a1, slot->index())); | |
1885 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); | |
1886 __ Branch(&skip, ne, a2, Operand(t0)); | |
1887 __ sw(result_register(), ContextOperand(a1, slot->index())); | |
1888 int offset = Context::SlotOffset(slot->index()); | |
1889 __ mov(a3, result_register()); // Preserve the stored value in v0. | |
1890 __ RecordWrite(a1, Operand(offset), a3, a2); | |
1891 break; | |
1892 } | |
1893 case Slot::LOOKUP: | 1887 case Slot::LOOKUP: |
1894 __ push(result_register()); | 1888 __ push(result_register()); |
1895 __ li(a0, Operand(slot->var()->name())); | 1889 __ li(a0, Operand(slot->var()->name())); |
1896 __ Push(cp, a0); // Context and name. | 1890 __ Push(cp, a0); // Context and name. |
1897 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); | 1891 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); |
1898 break; | 1892 break; |
1899 } | 1893 } |
1900 __ bind(&skip); | 1894 __ bind(&skip); |
1901 | 1895 |
1902 } else if (var->mode() != Variable::CONST) { | 1896 } else if (var->mode() != Variable::CONST) { |
(...skipping 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4272 __ Addu(at, a1, Operand(masm_->CodeObject())); | 4266 __ Addu(at, a1, Operand(masm_->CodeObject())); |
4273 __ Jump(at); | 4267 __ Jump(at); |
4274 } | 4268 } |
4275 | 4269 |
4276 | 4270 |
4277 #undef __ | 4271 #undef __ |
4278 | 4272 |
4279 } } // namespace v8::internal | 4273 } } // namespace v8::internal |
4280 | 4274 |
4281 #endif // V8_TARGET_ARCH_MIPS | 4275 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |