OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/base/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/cpu-profiler.h" | 8 #include "src/cpu-profiler.h" |
9 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 3635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3646 dont_adapt_arguments || formal_parameter_count == arity; | 3646 dont_adapt_arguments || formal_parameter_count == arity; |
3647 | 3647 |
3648 Register function_reg = r4; | 3648 Register function_reg = r4; |
3649 | 3649 |
3650 LPointerMap* pointers = instr->pointer_map(); | 3650 LPointerMap* pointers = instr->pointer_map(); |
3651 | 3651 |
3652 if (can_invoke_directly) { | 3652 if (can_invoke_directly) { |
3653 // Change context. | 3653 // Change context. |
3654 __ LoadP(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); | 3654 __ LoadP(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); |
3655 | 3655 |
3656 // Set r3 to arguments count if adaption is not needed. Assumes that r3 | 3656 // Always initialize r3 to the number of actual arguments. |
3657 // is available to write to at this point. | 3657 __ mov(r3, Operand(arity)); |
3658 if (dont_adapt_arguments) { | |
3659 __ mov(r3, Operand(arity)); | |
3660 } | |
3661 | 3658 |
3662 bool is_self_call = function.is_identical_to(info()->closure()); | 3659 bool is_self_call = function.is_identical_to(info()->closure()); |
3663 | 3660 |
3664 // Invoke function. | 3661 // Invoke function. |
3665 if (is_self_call) { | 3662 if (is_self_call) { |
3666 __ CallSelf(); | 3663 __ CallSelf(); |
3667 } else { | 3664 } else { |
3668 __ LoadP(ip, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset)); | 3665 __ LoadP(ip, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset)); |
3669 __ CallJSEntry(ip); | 3666 __ CallJSEntry(ip); |
3670 } | 3667 } |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4063 } | 4060 } |
4064 generator.AfterCall(); | 4061 generator.AfterCall(); |
4065 } | 4062 } |
4066 } | 4063 } |
4067 | 4064 |
4068 | 4065 |
4069 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | 4066 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
4070 DCHECK(ToRegister(instr->function()).is(r4)); | 4067 DCHECK(ToRegister(instr->function()).is(r4)); |
4071 DCHECK(ToRegister(instr->result()).is(r3)); | 4068 DCHECK(ToRegister(instr->result()).is(r3)); |
4072 | 4069 |
4073 if (instr->hydrogen()->pass_argument_count()) { | 4070 __ mov(r3, Operand(instr->arity())); |
4074 __ mov(r3, Operand(instr->arity())); | |
4075 } | |
4076 | 4071 |
4077 // Change context. | 4072 // Change context. |
4078 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); | 4073 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); |
4079 | 4074 |
4080 bool is_self_call = false; | 4075 bool is_self_call = false; |
4081 if (instr->hydrogen()->function()->IsConstant()) { | 4076 if (instr->hydrogen()->function()->IsConstant()) { |
4082 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); | 4077 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); |
4083 Handle<JSFunction> jsfun = | 4078 Handle<JSFunction> jsfun = |
4084 Handle<JSFunction>::cast(fun_const->handle(isolate())); | 4079 Handle<JSFunction>::cast(fun_const->handle(isolate())); |
4085 is_self_call = jsfun.is_identical_to(info()->closure()); | 4080 is_self_call = jsfun.is_identical_to(info()->closure()); |
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6162 __ Push(scope_info); | 6157 __ Push(scope_info); |
6163 __ push(ToRegister(instr->function())); | 6158 __ push(ToRegister(instr->function())); |
6164 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6159 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6165 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6160 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6166 } | 6161 } |
6167 | 6162 |
6168 | 6163 |
6169 #undef __ | 6164 #undef __ |
6170 } // namespace internal | 6165 } // namespace internal |
6171 } // namespace v8 | 6166 } // namespace v8 |
OLD | NEW |