OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 3350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3361 bool can_invoke_directly = | 3361 bool can_invoke_directly = |
3362 dont_adapt_arguments || formal_parameter_count == arity; | 3362 dont_adapt_arguments || formal_parameter_count == arity; |
3363 | 3363 |
3364 Register function_reg = rdi; | 3364 Register function_reg = rdi; |
3365 LPointerMap* pointers = instr->pointer_map(); | 3365 LPointerMap* pointers = instr->pointer_map(); |
3366 | 3366 |
3367 if (can_invoke_directly) { | 3367 if (can_invoke_directly) { |
3368 // Change context. | 3368 // Change context. |
3369 __ movp(rsi, FieldOperand(function_reg, JSFunction::kContextOffset)); | 3369 __ movp(rsi, FieldOperand(function_reg, JSFunction::kContextOffset)); |
3370 | 3370 |
3371 // Always initialize rax to the number of actual arguments. | 3371 // Always initialize new target and number of actual arguments. |
| 3372 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); |
3372 __ Set(rax, arity); | 3373 __ Set(rax, arity); |
3373 | 3374 |
3374 // Invoke function. | 3375 // Invoke function. |
3375 if (function.is_identical_to(info()->closure())) { | 3376 if (function.is_identical_to(info()->closure())) { |
3376 __ CallSelf(); | 3377 __ CallSelf(); |
3377 } else { | 3378 } else { |
3378 __ Call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset)); | 3379 __ Call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset)); |
3379 } | 3380 } |
3380 | 3381 |
3381 // Set up deoptimization. | 3382 // Set up deoptimization. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3425 } | 3426 } |
3426 generator.AfterCall(); | 3427 generator.AfterCall(); |
3427 } | 3428 } |
3428 } | 3429 } |
3429 | 3430 |
3430 | 3431 |
3431 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | 3432 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
3432 DCHECK(ToRegister(instr->function()).is(rdi)); | 3433 DCHECK(ToRegister(instr->function()).is(rdi)); |
3433 DCHECK(ToRegister(instr->result()).is(rax)); | 3434 DCHECK(ToRegister(instr->result()).is(rax)); |
3434 | 3435 |
3435 __ Set(rax, instr->arity()); | |
3436 | |
3437 // Change context. | 3436 // Change context. |
3438 __ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 3437 __ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
3439 | 3438 |
| 3439 // Always initialize new target and number of actual arguments. |
| 3440 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); |
| 3441 __ Set(rax, instr->arity()); |
| 3442 |
3440 LPointerMap* pointers = instr->pointer_map(); | 3443 LPointerMap* pointers = instr->pointer_map(); |
3441 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3444 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
3442 | 3445 |
3443 bool is_self_call = false; | 3446 bool is_self_call = false; |
3444 if (instr->hydrogen()->function()->IsConstant()) { | 3447 if (instr->hydrogen()->function()->IsConstant()) { |
3445 Handle<JSFunction> jsfun = Handle<JSFunction>::null(); | 3448 Handle<JSFunction> jsfun = Handle<JSFunction>::null(); |
3446 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); | 3449 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); |
3447 jsfun = Handle<JSFunction>::cast(fun_const->handle(isolate())); | 3450 jsfun = Handle<JSFunction>::cast(fun_const->handle(isolate())); |
3448 is_self_call = jsfun.is_identical_to(info()->closure()); | 3451 is_self_call = jsfun.is_identical_to(info()->closure()); |
3449 } | 3452 } |
(...skipping 2399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5849 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5852 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5850 } | 5853 } |
5851 | 5854 |
5852 | 5855 |
5853 #undef __ | 5856 #undef __ |
5854 | 5857 |
5855 } // namespace internal | 5858 } // namespace internal |
5856 } // namespace v8 | 5859 } // namespace v8 |
5857 | 5860 |
5858 #endif // V8_TARGET_ARCH_X64 | 5861 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |