| 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/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
| 7 #include "src/cpu-profiler.h" | 7 #include "src/cpu-profiler.h" |
| 8 #include "src/hydrogen-osr.h" | 8 #include "src/hydrogen-osr.h" |
| 9 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
| 10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
| (...skipping 3564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3575 bool can_invoke_directly = | 3575 bool can_invoke_directly = |
| 3576 dont_adapt_arguments || formal_parameter_count == arity; | 3576 dont_adapt_arguments || formal_parameter_count == arity; |
| 3577 | 3577 |
| 3578 Register function_reg = a1; | 3578 Register function_reg = a1; |
| 3579 LPointerMap* pointers = instr->pointer_map(); | 3579 LPointerMap* pointers = instr->pointer_map(); |
| 3580 | 3580 |
| 3581 if (can_invoke_directly) { | 3581 if (can_invoke_directly) { |
| 3582 // Change context. | 3582 // Change context. |
| 3583 __ ld(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); | 3583 __ ld(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); |
| 3584 | 3584 |
| 3585 // Set r0 to arguments count if adaption is not needed. Assumes that r0 | 3585 // Always initialize a0 to the number of actual arguments. |
| 3586 // is available to write to at this point. | 3586 __ li(a0, Operand(arity)); |
| 3587 if (dont_adapt_arguments) { | |
| 3588 __ li(a0, Operand(arity)); | |
| 3589 } | |
| 3590 | 3587 |
| 3591 // Invoke function. | 3588 // Invoke function. |
| 3592 __ ld(at, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset)); | 3589 __ ld(at, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset)); |
| 3593 __ Call(at); | 3590 __ Call(at); |
| 3594 | 3591 |
| 3595 // Set up deoptimization. | 3592 // Set up deoptimization. |
| 3596 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3593 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
| 3597 } else { | 3594 } else { |
| 3598 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3595 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
| 3599 ParameterCount count(arity); | 3596 ParameterCount count(arity); |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4005 } | 4002 } |
| 4006 generator.AfterCall(); | 4003 generator.AfterCall(); |
| 4007 } | 4004 } |
| 4008 } | 4005 } |
| 4009 | 4006 |
| 4010 | 4007 |
| 4011 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | 4008 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
| 4012 DCHECK(ToRegister(instr->function()).is(a1)); | 4009 DCHECK(ToRegister(instr->function()).is(a1)); |
| 4013 DCHECK(ToRegister(instr->result()).is(v0)); | 4010 DCHECK(ToRegister(instr->result()).is(v0)); |
| 4014 | 4011 |
| 4015 if (instr->hydrogen()->pass_argument_count()) { | 4012 __ li(a0, Operand(instr->arity())); |
| 4016 __ li(a0, Operand(instr->arity())); | |
| 4017 } | |
| 4018 | 4013 |
| 4019 // Change context. | 4014 // Change context. |
| 4020 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 4015 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
| 4021 | 4016 |
| 4022 // Load the code entry address | 4017 // Load the code entry address |
| 4023 __ ld(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 4018 __ ld(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
| 4024 __ Call(at); | 4019 __ Call(at); |
| 4025 | 4020 |
| 4026 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 4021 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
| 4027 } | 4022 } |
| (...skipping 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6116 __ Push(at, ToRegister(instr->function())); | 6111 __ Push(at, ToRegister(instr->function())); |
| 6117 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6112 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6118 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6113 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6119 } | 6114 } |
| 6120 | 6115 |
| 6121 | 6116 |
| 6122 #undef __ | 6117 #undef __ |
| 6123 | 6118 |
| 6124 } // namespace internal | 6119 } // namespace internal |
| 6125 } // namespace v8 | 6120 } // namespace v8 |
| OLD | NEW |