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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
706 break; | 706 break; |
707 | 707 |
708 case Slot::CONTEXT: | 708 case Slot::CONTEXT: |
709 // We bypass the general EmitSlotSearch because we know more about | 709 // We bypass the general EmitSlotSearch because we know more about |
710 // this specific context. | 710 // this specific context. |
711 | 711 |
712 // The variable in the decl always resides in the current function | 712 // The variable in the decl always resides in the current function |
713 // context. | 713 // context. |
714 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); | 714 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); |
715 if (FLAG_debug_code) { | 715 if (FLAG_debug_code) { |
716 // Check that we're not inside a 'with'. | 716 // Check that we're not inside a with or catch context. |
717 __ ldr(r1, ContextOperand(cp, Context::FCONTEXT_INDEX)); | 717 __ ldr(r1, FieldMemOperand(cp, HeapObject::kMapOffset)); |
718 __ cmp(r1, cp); | 718 __ CompareRoot(r1, Heap::kWithContextMapRootIndex); |
719 __ Check(eq, "Unexpected declaration in current context."); | 719 __ Check(ne, "Declaration in with context."); |
720 __ CompareRoot(r1, Heap::kCatchContextMapRootIndex); | |
721 __ Check(ne, "Declaration in catch context."); | |
720 } | 722 } |
721 if (mode == Variable::CONST) { | 723 if (mode == Variable::CONST) { |
722 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 724 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
723 __ str(ip, ContextOperand(cp, slot->index())); | 725 __ str(ip, ContextOperand(cp, slot->index())); |
724 // No write barrier since the_hole_value is in old space. | 726 // No write barrier since the_hole_value is in old space. |
725 } else if (function != NULL) { | 727 } else if (function != NULL) { |
726 VisitForAccumulatorValue(function); | 728 VisitForAccumulatorValue(function); |
727 __ str(result_register(), ContextOperand(cp, slot->index())); | 729 __ str(result_register(), ContextOperand(cp, slot->index())); |
728 int offset = Context::SlotOffset(slot->index()); | 730 int offset = Context::SlotOffset(slot->index()); |
729 // We know that we have written a function, which is not a smi. | 731 // We know that we have written a function, which is not a smi. |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1860 UNREACHABLE(); | 1862 UNREACHABLE(); |
1861 break; | 1863 break; |
1862 case Slot::LOCAL: | 1864 case Slot::LOCAL: |
1863 // Detect const reinitialization by checking for the hole value. | 1865 // Detect const reinitialization by checking for the hole value. |
1864 __ ldr(r1, MemOperand(fp, SlotOffset(slot))); | 1866 __ ldr(r1, MemOperand(fp, SlotOffset(slot))); |
1865 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 1867 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
1866 __ cmp(r1, ip); | 1868 __ cmp(r1, ip); |
1867 __ b(ne, &skip); | 1869 __ b(ne, &skip); |
1868 __ str(result_register(), MemOperand(fp, SlotOffset(slot))); | 1870 __ str(result_register(), MemOperand(fp, SlotOffset(slot))); |
1869 break; | 1871 break; |
1870 case Slot::CONTEXT: { | 1872 case Slot::CONTEXT: |
Kevin Millikin (Chromium)
2011/06/28 14:37:48
Const initialization can be nested inside a with o
Mads Ager (chromium)
2011/06/29 05:56:27
Let's file a bug report (internal cleanup?) about
| |
1871 __ ldr(r1, ContextOperand(cp, Context::FCONTEXT_INDEX)); | |
1872 __ ldr(r2, ContextOperand(r1, slot->index())); | |
1873 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | |
1874 __ cmp(r2, ip); | |
1875 __ b(ne, &skip); | |
1876 __ str(r0, ContextOperand(r1, slot->index())); | |
1877 int offset = Context::SlotOffset(slot->index()); | |
1878 __ mov(r3, r0); // Preserve the stored value in r0. | |
1879 __ RecordWrite(r1, Operand(offset), r3, r2); | |
1880 break; | |
1881 } | |
1882 case Slot::LOOKUP: | 1873 case Slot::LOOKUP: |
1883 __ push(r0); | 1874 __ push(r0); |
1884 __ mov(r0, Operand(slot->var()->name())); | 1875 __ mov(r0, Operand(slot->var()->name())); |
1885 __ Push(cp, r0); // Context and name. | 1876 __ Push(cp, r0); // Context and name. |
1886 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); | 1877 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); |
1887 break; | 1878 break; |
1888 } | 1879 } |
1889 __ bind(&skip); | 1880 __ bind(&skip); |
1890 | 1881 |
1891 } else if (var->mode() != Variable::CONST) { | 1882 } else if (var->mode() != Variable::CONST) { |
(...skipping 2405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4297 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4288 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
4298 __ add(pc, r1, Operand(masm_->CodeObject())); | 4289 __ add(pc, r1, Operand(masm_->CodeObject())); |
4299 } | 4290 } |
4300 | 4291 |
4301 | 4292 |
4302 #undef __ | 4293 #undef __ |
4303 | 4294 |
4304 } } // namespace v8::internal | 4295 } } // namespace v8::internal |
4305 | 4296 |
4306 #endif // V8_TARGET_ARCH_ARM | 4297 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |