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/mips64/lithium-codegen-mips64.h" | 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/crankshaft/hydrogen-osr.h" | 9 #include "src/crankshaft/hydrogen-osr.h" |
10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" | 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 int num_parameters = scope()->num_parameters(); | 185 int num_parameters = scope()->num_parameters(); |
186 int first_parameter = scope()->has_this_declaration() ? -1 : 0; | 186 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
187 for (int i = first_parameter; i < num_parameters; i++) { | 187 for (int i = first_parameter; i < num_parameters; i++) { |
188 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); | 188 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
189 if (var->IsContextSlot()) { | 189 if (var->IsContextSlot()) { |
190 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 190 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
191 (num_parameters - 1 - i) * kPointerSize; | 191 (num_parameters - 1 - i) * kPointerSize; |
192 // Load parameter from stack. | 192 // Load parameter from stack. |
193 __ ld(a0, MemOperand(fp, parameter_offset)); | 193 __ ld(a0, MemOperand(fp, parameter_offset)); |
194 // Store it in the context. | 194 // Store it in the context. |
195 MemOperand target = ContextOperand(cp, var->index()); | 195 MemOperand target = ContextMemOperand(cp, var->index()); |
196 __ sd(a0, target); | 196 __ sd(a0, target); |
197 // Update the write barrier. This clobbers a3 and a0. | 197 // Update the write barrier. This clobbers a3 and a0. |
198 if (need_write_barrier) { | 198 if (need_write_barrier) { |
199 __ RecordWriteContextSlot( | 199 __ RecordWriteContextSlot( |
200 cp, target.offset(), a0, a3, GetRAState(), kSaveFPRegs); | 200 cp, target.offset(), a0, a3, GetRAState(), kSaveFPRegs); |
201 } else if (FLAG_debug_code) { | 201 } else if (FLAG_debug_code) { |
202 Label done; | 202 Label done; |
203 __ JumpIfInNewSpace(cp, a0, &done); | 203 __ JumpIfInNewSpace(cp, a0, &done); |
204 __ Abort(kExpectedNewSpaceObject); | 204 __ Abort(kExpectedNewSpaceObject); |
205 __ bind(&done); | 205 __ bind(&done); |
(...skipping 2636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2842 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), | 2842 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), |
2843 SLOPPY, PREMONOMORPHIC).code(); | 2843 SLOPPY, PREMONOMORPHIC).code(); |
2844 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2844 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2845 } | 2845 } |
2846 | 2846 |
2847 | 2847 |
2848 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2848 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2849 Register context = ToRegister(instr->context()); | 2849 Register context = ToRegister(instr->context()); |
2850 Register result = ToRegister(instr->result()); | 2850 Register result = ToRegister(instr->result()); |
2851 | 2851 |
2852 __ ld(result, ContextOperand(context, instr->slot_index())); | 2852 __ ld(result, ContextMemOperand(context, instr->slot_index())); |
2853 if (instr->hydrogen()->RequiresHoleCheck()) { | 2853 if (instr->hydrogen()->RequiresHoleCheck()) { |
2854 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2854 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
2855 | 2855 |
2856 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2856 if (instr->hydrogen()->DeoptimizesOnHole()) { |
2857 DeoptimizeIf(eq, instr, Deoptimizer::kHole, result, Operand(at)); | 2857 DeoptimizeIf(eq, instr, Deoptimizer::kHole, result, Operand(at)); |
2858 } else { | 2858 } else { |
2859 Label is_not_hole; | 2859 Label is_not_hole; |
2860 __ Branch(&is_not_hole, ne, result, Operand(at)); | 2860 __ Branch(&is_not_hole, ne, result, Operand(at)); |
2861 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); | 2861 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
2862 __ bind(&is_not_hole); | 2862 __ bind(&is_not_hole); |
2863 } | 2863 } |
2864 } | 2864 } |
2865 } | 2865 } |
2866 | 2866 |
2867 | 2867 |
2868 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2868 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2869 Register context = ToRegister(instr->context()); | 2869 Register context = ToRegister(instr->context()); |
2870 Register value = ToRegister(instr->value()); | 2870 Register value = ToRegister(instr->value()); |
2871 Register scratch = scratch0(); | 2871 Register scratch = scratch0(); |
2872 MemOperand target = ContextOperand(context, instr->slot_index()); | 2872 MemOperand target = ContextMemOperand(context, instr->slot_index()); |
2873 | 2873 |
2874 Label skip_assignment; | 2874 Label skip_assignment; |
2875 | 2875 |
2876 if (instr->hydrogen()->RequiresHoleCheck()) { | 2876 if (instr->hydrogen()->RequiresHoleCheck()) { |
2877 __ ld(scratch, target); | 2877 __ ld(scratch, target); |
2878 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2878 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
2879 | 2879 |
2880 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2880 if (instr->hydrogen()->DeoptimizesOnHole()) { |
2881 DeoptimizeIf(eq, instr, Deoptimizer::kHole, scratch, Operand(at)); | 2881 DeoptimizeIf(eq, instr, Deoptimizer::kHole, scratch, Operand(at)); |
2882 } else { | 2882 } else { |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3403 __ SmiTst(receiver, scratch); | 3403 __ SmiTst(receiver, scratch); |
3404 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, scratch, Operand(zero_reg)); | 3404 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, scratch, Operand(zero_reg)); |
3405 | 3405 |
3406 __ GetObjectType(receiver, scratch, scratch); | 3406 __ GetObjectType(receiver, scratch, scratch); |
3407 DeoptimizeIf(lt, instr, Deoptimizer::kNotAJavaScriptObject, scratch, | 3407 DeoptimizeIf(lt, instr, Deoptimizer::kNotAJavaScriptObject, scratch, |
3408 Operand(FIRST_SPEC_OBJECT_TYPE)); | 3408 Operand(FIRST_SPEC_OBJECT_TYPE)); |
3409 __ Branch(&result_in_receiver); | 3409 __ Branch(&result_in_receiver); |
3410 | 3410 |
3411 __ bind(&global_object); | 3411 __ bind(&global_object); |
3412 __ ld(result, FieldMemOperand(function, JSFunction::kContextOffset)); | 3412 __ ld(result, FieldMemOperand(function, JSFunction::kContextOffset)); |
3413 __ ld(result, | 3413 __ ld(result, ContextMemOperand(result, Context::NATIVE_CONTEXT_INDEX)); |
3414 ContextOperand(result, Context::GLOBAL_OBJECT_INDEX)); | 3414 __ ld(result, ContextMemOperand(result, Context::GLOBAL_PROXY_INDEX)); |
3415 __ ld(result, FieldMemOperand(result, JSGlobalObject::kGlobalProxyOffset)); | |
3416 | 3415 |
3417 if (result.is(receiver)) { | 3416 if (result.is(receiver)) { |
3418 __ bind(&result_in_receiver); | 3417 __ bind(&result_in_receiver); |
3419 } else { | 3418 } else { |
3420 Label result_ok; | 3419 Label result_ok; |
3421 __ Branch(&result_ok); | 3420 __ Branch(&result_ok); |
3422 __ bind(&result_in_receiver); | 3421 __ bind(&result_in_receiver); |
3423 __ mov(result, receiver); | 3422 __ mov(result, receiver); |
3424 __ bind(&result_ok); | 3423 __ bind(&result_ok); |
3425 } | 3424 } |
(...skipping 2525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5951 __ Push(at, ToRegister(instr->function())); | 5950 __ Push(at, ToRegister(instr->function())); |
5952 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5951 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5953 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5952 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5954 } | 5953 } |
5955 | 5954 |
5956 | 5955 |
5957 #undef __ | 5956 #undef __ |
5958 | 5957 |
5959 } // namespace internal | 5958 } // namespace internal |
5960 } // namespace v8 | 5959 } // namespace v8 |
OLD | NEW |