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 3515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3526 bool can_invoke_directly = | 3526 bool can_invoke_directly = |
3527 dont_adapt_arguments || formal_parameter_count == arity; | 3527 dont_adapt_arguments || formal_parameter_count == arity; |
3528 | 3528 |
3529 Register function_reg = a1; | 3529 Register function_reg = a1; |
3530 LPointerMap* pointers = instr->pointer_map(); | 3530 LPointerMap* pointers = instr->pointer_map(); |
3531 | 3531 |
3532 if (can_invoke_directly) { | 3532 if (can_invoke_directly) { |
3533 // Change context. | 3533 // Change context. |
3534 __ ld(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); | 3534 __ ld(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); |
3535 | 3535 |
3536 // Always initialize a0 to the number of actual arguments. | 3536 // Always initialize new target and number of actual arguments. |
| 3537 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); |
3537 __ li(a0, Operand(arity)); | 3538 __ li(a0, Operand(arity)); |
3538 | 3539 |
3539 // Invoke function. | 3540 // Invoke function. |
3540 __ ld(at, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset)); | 3541 __ ld(at, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset)); |
3541 __ Call(at); | 3542 __ Call(at); |
3542 | 3543 |
3543 // Set up deoptimization. | 3544 // Set up deoptimization. |
3544 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3545 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
3545 } else { | 3546 } else { |
3546 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3547 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3953 } | 3954 } |
3954 generator.AfterCall(); | 3955 generator.AfterCall(); |
3955 } | 3956 } |
3956 } | 3957 } |
3957 | 3958 |
3958 | 3959 |
3959 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | 3960 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
3960 DCHECK(ToRegister(instr->function()).is(a1)); | 3961 DCHECK(ToRegister(instr->function()).is(a1)); |
3961 DCHECK(ToRegister(instr->result()).is(v0)); | 3962 DCHECK(ToRegister(instr->result()).is(v0)); |
3962 | 3963 |
3963 __ li(a0, Operand(instr->arity())); | |
3964 | |
3965 // Change context. | 3964 // Change context. |
3966 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 3965 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
3967 | 3966 |
| 3967 // Always initialize new target and number of actual arguments. |
| 3968 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); |
| 3969 __ li(a0, Operand(instr->arity())); |
| 3970 |
3968 // Load the code entry address | 3971 // Load the code entry address |
3969 __ ld(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 3972 __ ld(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
3970 __ Call(at); | 3973 __ Call(at); |
3971 | 3974 |
3972 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3975 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
3973 } | 3976 } |
3974 | 3977 |
3975 | 3978 |
3976 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 3979 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
3977 DCHECK(ToRegister(instr->context()).is(cp)); | 3980 DCHECK(ToRegister(instr->context()).is(cp)); |
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6013 __ Push(at, ToRegister(instr->function())); | 6016 __ Push(at, ToRegister(instr->function())); |
6014 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6017 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6015 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6018 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6016 } | 6019 } |
6017 | 6020 |
6018 | 6021 |
6019 #undef __ | 6022 #undef __ |
6020 | 6023 |
6021 } // namespace internal | 6024 } // namespace internal |
6022 } // namespace v8 | 6025 } // namespace v8 |
OLD | NEW |