OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/crankshaft/arm/lithium-codegen-arm.h" | 5 #include "src/crankshaft/arm/lithium-codegen-arm.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" | 10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 int num_parameters = scope()->num_parameters(); | 190 int num_parameters = scope()->num_parameters(); |
191 int first_parameter = scope()->has_this_declaration() ? -1 : 0; | 191 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
192 for (int i = first_parameter; i < num_parameters; i++) { | 192 for (int i = first_parameter; i < num_parameters; i++) { |
193 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); | 193 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
194 if (var->IsContextSlot()) { | 194 if (var->IsContextSlot()) { |
195 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 195 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
196 (num_parameters - 1 - i) * kPointerSize; | 196 (num_parameters - 1 - i) * kPointerSize; |
197 // Load parameter from stack. | 197 // Load parameter from stack. |
198 __ ldr(r0, MemOperand(fp, parameter_offset)); | 198 __ ldr(r0, MemOperand(fp, parameter_offset)); |
199 // Store it in the context. | 199 // Store it in the context. |
200 MemOperand target = ContextOperand(cp, var->index()); | 200 MemOperand target = ContextMemOperand(cp, var->index()); |
201 __ str(r0, target); | 201 __ str(r0, target); |
202 // Update the write barrier. This clobbers r3 and r0. | 202 // Update the write barrier. This clobbers r3 and r0. |
203 if (need_write_barrier) { | 203 if (need_write_barrier) { |
204 __ RecordWriteContextSlot( | 204 __ RecordWriteContextSlot( |
205 cp, | 205 cp, |
206 target.offset(), | 206 target.offset(), |
207 r0, | 207 r0, |
208 r3, | 208 r3, |
209 GetLinkRegisterState(), | 209 GetLinkRegisterState(), |
210 kSaveFPRegs); | 210 kSaveFPRegs); |
(...skipping 2595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2806 Handle<Code> ic = | 2806 Handle<Code> ic = |
2807 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), | 2807 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), |
2808 SLOPPY, PREMONOMORPHIC).code(); | 2808 SLOPPY, PREMONOMORPHIC).code(); |
2809 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2809 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2810 } | 2810 } |
2811 | 2811 |
2812 | 2812 |
2813 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2813 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2814 Register context = ToRegister(instr->context()); | 2814 Register context = ToRegister(instr->context()); |
2815 Register result = ToRegister(instr->result()); | 2815 Register result = ToRegister(instr->result()); |
2816 __ ldr(result, ContextOperand(context, instr->slot_index())); | 2816 __ ldr(result, ContextMemOperand(context, instr->slot_index())); |
2817 if (instr->hydrogen()->RequiresHoleCheck()) { | 2817 if (instr->hydrogen()->RequiresHoleCheck()) { |
2818 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 2818 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
2819 __ cmp(result, ip); | 2819 __ cmp(result, ip); |
2820 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2820 if (instr->hydrogen()->DeoptimizesOnHole()) { |
2821 DeoptimizeIf(eq, instr, Deoptimizer::kHole); | 2821 DeoptimizeIf(eq, instr, Deoptimizer::kHole); |
2822 } else { | 2822 } else { |
2823 __ mov(result, Operand(factory()->undefined_value()), LeaveCC, eq); | 2823 __ mov(result, Operand(factory()->undefined_value()), LeaveCC, eq); |
2824 } | 2824 } |
2825 } | 2825 } |
2826 } | 2826 } |
2827 | 2827 |
2828 | 2828 |
2829 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2829 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2830 Register context = ToRegister(instr->context()); | 2830 Register context = ToRegister(instr->context()); |
2831 Register value = ToRegister(instr->value()); | 2831 Register value = ToRegister(instr->value()); |
2832 Register scratch = scratch0(); | 2832 Register scratch = scratch0(); |
2833 MemOperand target = ContextOperand(context, instr->slot_index()); | 2833 MemOperand target = ContextMemOperand(context, instr->slot_index()); |
2834 | 2834 |
2835 Label skip_assignment; | 2835 Label skip_assignment; |
2836 | 2836 |
2837 if (instr->hydrogen()->RequiresHoleCheck()) { | 2837 if (instr->hydrogen()->RequiresHoleCheck()) { |
2838 __ ldr(scratch, target); | 2838 __ ldr(scratch, target); |
2839 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 2839 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
2840 __ cmp(scratch, ip); | 2840 __ cmp(scratch, ip); |
2841 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2841 if (instr->hydrogen()->DeoptimizesOnHole()) { |
2842 DeoptimizeIf(eq, instr, Deoptimizer::kHole); | 2842 DeoptimizeIf(eq, instr, Deoptimizer::kHole); |
2843 } else { | 2843 } else { |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3285 | 3285 |
3286 // Deoptimize if the receiver is not a JS object. | 3286 // Deoptimize if the receiver is not a JS object. |
3287 __ SmiTst(receiver); | 3287 __ SmiTst(receiver); |
3288 DeoptimizeIf(eq, instr, Deoptimizer::kSmi); | 3288 DeoptimizeIf(eq, instr, Deoptimizer::kSmi); |
3289 __ CompareObjectType(receiver, scratch, scratch, FIRST_SPEC_OBJECT_TYPE); | 3289 __ CompareObjectType(receiver, scratch, scratch, FIRST_SPEC_OBJECT_TYPE); |
3290 DeoptimizeIf(lt, instr, Deoptimizer::kNotAJavaScriptObject); | 3290 DeoptimizeIf(lt, instr, Deoptimizer::kNotAJavaScriptObject); |
3291 | 3291 |
3292 __ b(&result_in_receiver); | 3292 __ b(&result_in_receiver); |
3293 __ bind(&global_object); | 3293 __ bind(&global_object); |
3294 __ ldr(result, FieldMemOperand(function, JSFunction::kContextOffset)); | 3294 __ ldr(result, FieldMemOperand(function, JSFunction::kContextOffset)); |
3295 __ ldr(result, | 3295 __ ldr(result, ContextMemOperand(result, Context::NATIVE_CONTEXT_INDEX)); |
3296 ContextOperand(result, Context::GLOBAL_OBJECT_INDEX)); | 3296 __ ldr(result, ContextMemOperand(result, Context::GLOBAL_PROXY_INDEX)); |
3297 __ ldr(result, FieldMemOperand(result, JSGlobalObject::kGlobalProxyOffset)); | |
3298 | 3297 |
3299 if (result.is(receiver)) { | 3298 if (result.is(receiver)) { |
3300 __ bind(&result_in_receiver); | 3299 __ bind(&result_in_receiver); |
3301 } else { | 3300 } else { |
3302 Label result_ok; | 3301 Label result_ok; |
3303 __ b(&result_ok); | 3302 __ b(&result_ok); |
3304 __ bind(&result_in_receiver); | 3303 __ bind(&result_in_receiver); |
3305 __ mov(result, receiver); | 3304 __ mov(result, receiver); |
3306 __ bind(&result_ok); | 3305 __ bind(&result_ok); |
3307 } | 3306 } |
(...skipping 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5719 __ push(ToRegister(instr->function())); | 5718 __ push(ToRegister(instr->function())); |
5720 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5719 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5721 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5720 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5722 } | 5721 } |
5723 | 5722 |
5724 | 5723 |
5725 #undef __ | 5724 #undef __ |
5726 | 5725 |
5727 } // namespace internal | 5726 } // namespace internal |
5728 } // namespace v8 | 5727 } // namespace v8 |
OLD | NEW |