| 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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.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/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 3585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3596 // Call the target. | 3596 // Call the target. |
| 3597 __ Set(rax, argc); | 3597 __ Set(rax, argc); |
| 3598 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3598 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 3599 // Restore context register. | 3599 // Restore context register. |
| 3600 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 3600 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 3601 // Discard the function left on TOS. | 3601 // Discard the function left on TOS. |
| 3602 context()->DropAndPlug(1, rax); | 3602 context()->DropAndPlug(1, rax); |
| 3603 } | 3603 } |
| 3604 | 3604 |
| 3605 | 3605 |
| 3606 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | |
| 3607 ZoneList<Expression*>* args = expr->arguments(); | |
| 3608 DCHECK(args->length() == 2); | |
| 3609 | |
| 3610 // Evaluate new.target and super constructor. | |
| 3611 VisitForStackValue(args->at(0)); | |
| 3612 VisitForStackValue(args->at(1)); | |
| 3613 | |
| 3614 // Call the construct call builtin that handles allocation and | |
| 3615 // constructor invocation. | |
| 3616 SetConstructCallPosition(expr); | |
| 3617 | |
| 3618 // Check if the calling frame is an arguments adaptor frame. | |
| 3619 Label adaptor_frame, args_set_up, runtime; | |
| 3620 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | |
| 3621 __ movp(rbx, Operand(rdx, StandardFrameConstants::kContextOffset)); | |
| 3622 __ Cmp(rbx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | |
| 3623 __ j(equal, &adaptor_frame); | |
| 3624 // default constructor has no arguments, so no adaptor frame means no args. | |
| 3625 __ movp(rax, Immediate(0)); | |
| 3626 __ jmp(&args_set_up); | |
| 3627 | |
| 3628 // Copy arguments from adaptor frame. | |
| 3629 { | |
| 3630 __ bind(&adaptor_frame); | |
| 3631 __ movp(rbx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | |
| 3632 __ SmiToInteger64(rbx, rbx); | |
| 3633 | |
| 3634 __ movp(rax, rbx); | |
| 3635 __ leap(rdx, Operand(rdx, rbx, times_pointer_size, | |
| 3636 StandardFrameConstants::kCallerSPOffset)); | |
| 3637 Label loop; | |
| 3638 __ bind(&loop); | |
| 3639 __ Push(Operand(rdx, -1 * kPointerSize)); | |
| 3640 __ subp(rdx, Immediate(kPointerSize)); | |
| 3641 __ decp(rbx); | |
| 3642 __ j(not_zero, &loop); | |
| 3643 } | |
| 3644 | |
| 3645 __ bind(&args_set_up); | |
| 3646 __ movp(rdx, Operand(rsp, rax, times_pointer_size, 1 * kPointerSize)); | |
| 3647 __ movp(rdi, Operand(rsp, rax, times_pointer_size, 0 * kPointerSize)); | |
| 3648 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | |
| 3649 | |
| 3650 // Restore context register. | |
| 3651 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | |
| 3652 | |
| 3653 context()->DropAndPlug(1, rax); | |
| 3654 } | |
| 3655 | |
| 3656 | |
| 3657 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 3606 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
| 3658 ZoneList<Expression*>* args = expr->arguments(); | 3607 ZoneList<Expression*>* args = expr->arguments(); |
| 3659 DCHECK(args->length() == 1); | 3608 DCHECK(args->length() == 1); |
| 3660 | 3609 |
| 3661 VisitForAccumulatorValue(args->at(0)); | 3610 VisitForAccumulatorValue(args->at(0)); |
| 3662 | 3611 |
| 3663 Label materialize_true, materialize_false; | 3612 Label materialize_true, materialize_false; |
| 3664 Label* if_true = NULL; | 3613 Label* if_true = NULL; |
| 3665 Label* if_false = NULL; | 3614 Label* if_false = NULL; |
| 3666 Label* fall_through = NULL; | 3615 Label* fall_through = NULL; |
| (...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4831 Assembler::target_address_at(call_target_address, | 4780 Assembler::target_address_at(call_target_address, |
| 4832 unoptimized_code)); | 4781 unoptimized_code)); |
| 4833 return OSR_AFTER_STACK_CHECK; | 4782 return OSR_AFTER_STACK_CHECK; |
| 4834 } | 4783 } |
| 4835 | 4784 |
| 4836 | 4785 |
| 4837 } // namespace internal | 4786 } // namespace internal |
| 4838 } // namespace v8 | 4787 } // namespace v8 |
| 4839 | 4788 |
| 4840 #endif // V8_TARGET_ARCH_X64 | 4789 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |