| 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/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
| (...skipping 3393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3404 bool can_invoke_directly = | 3404 bool can_invoke_directly = |
| 3405 dont_adapt_arguments || formal_parameter_count == arity; | 3405 dont_adapt_arguments || formal_parameter_count == arity; |
| 3406 | 3406 |
| 3407 Register function_reg = rdi; | 3407 Register function_reg = rdi; |
| 3408 LPointerMap* pointers = instr->pointer_map(); | 3408 LPointerMap* pointers = instr->pointer_map(); |
| 3409 | 3409 |
| 3410 if (can_invoke_directly) { | 3410 if (can_invoke_directly) { |
| 3411 // Change context. | 3411 // Change context. |
| 3412 __ movp(rsi, FieldOperand(function_reg, JSFunction::kContextOffset)); | 3412 __ movp(rsi, FieldOperand(function_reg, JSFunction::kContextOffset)); |
| 3413 | 3413 |
| 3414 // Set rax to arguments count if adaption is not needed. Assumes that rax | 3414 // Always initialize rax to the number of actual arguments. |
| 3415 // is available to write to at this point. | 3415 __ Set(rax, arity); |
| 3416 if (dont_adapt_arguments) { | |
| 3417 __ Set(rax, arity); | |
| 3418 } | |
| 3419 | 3416 |
| 3420 // Invoke function. | 3417 // Invoke function. |
| 3421 if (function.is_identical_to(info()->closure())) { | 3418 if (function.is_identical_to(info()->closure())) { |
| 3422 __ CallSelf(); | 3419 __ CallSelf(); |
| 3423 } else { | 3420 } else { |
| 3424 __ Call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset)); | 3421 __ Call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset)); |
| 3425 } | 3422 } |
| 3426 | 3423 |
| 3427 // Set up deoptimization. | 3424 // Set up deoptimization. |
| 3428 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT, 0); | 3425 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT, 0); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3471 } | 3468 } |
| 3472 generator.AfterCall(); | 3469 generator.AfterCall(); |
| 3473 } | 3470 } |
| 3474 } | 3471 } |
| 3475 | 3472 |
| 3476 | 3473 |
| 3477 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | 3474 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
| 3478 DCHECK(ToRegister(instr->function()).is(rdi)); | 3475 DCHECK(ToRegister(instr->function()).is(rdi)); |
| 3479 DCHECK(ToRegister(instr->result()).is(rax)); | 3476 DCHECK(ToRegister(instr->result()).is(rax)); |
| 3480 | 3477 |
| 3481 if (instr->hydrogen()->pass_argument_count()) { | 3478 __ Set(rax, instr->arity()); |
| 3482 __ Set(rax, instr->arity()); | |
| 3483 } | |
| 3484 | 3479 |
| 3485 // Change context. | 3480 // Change context. |
| 3486 __ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 3481 __ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 3487 | 3482 |
| 3488 LPointerMap* pointers = instr->pointer_map(); | 3483 LPointerMap* pointers = instr->pointer_map(); |
| 3489 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3484 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
| 3490 | 3485 |
| 3491 bool is_self_call = false; | 3486 bool is_self_call = false; |
| 3492 if (instr->hydrogen()->function()->IsConstant()) { | 3487 if (instr->hydrogen()->function()->IsConstant()) { |
| 3493 Handle<JSFunction> jsfun = Handle<JSFunction>::null(); | 3488 Handle<JSFunction> jsfun = Handle<JSFunction>::null(); |
| (...skipping 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5946 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5941 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5947 } | 5942 } |
| 5948 | 5943 |
| 5949 | 5944 |
| 5950 #undef __ | 5945 #undef __ |
| 5951 | 5946 |
| 5952 } // namespace internal | 5947 } // namespace internal |
| 5953 } // namespace v8 | 5948 } // namespace v8 |
| 5954 | 5949 |
| 5955 #endif // V8_TARGET_ARCH_X64 | 5950 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |