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/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 4691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4702 | 4702 |
4703 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 4703 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { |
4704 // ----------- S t a t e ------------- | 4704 // ----------- S t a t e ------------- |
4705 // -- rdi : function | 4705 // -- rdi : function |
4706 // -- rsi : context | 4706 // -- rsi : context |
4707 // -- rbp : frame pointer | 4707 // -- rbp : frame pointer |
4708 // -- rsp[0] : return address | 4708 // -- rsp[0] : return address |
4709 // ----------------------------------- | 4709 // ----------------------------------- |
4710 __ AssertFunction(rdi); | 4710 __ AssertFunction(rdi); |
4711 | 4711 |
| 4712 // For Ignition we need to skip all possible handler/stub frames until |
| 4713 // we reach the JavaScript frame for the function (similar to what the |
| 4714 // runtime fallback implementation does). So make r9 point to that |
| 4715 // JavaScript frame. |
| 4716 { |
| 4717 Label loop, loop_entry; |
| 4718 __ movp(r9, rbp); |
| 4719 __ jmp(&loop_entry, Label::kNear); |
| 4720 __ bind(&loop); |
| 4721 __ movp(r9, Operand(r9, StandardFrameConstants::kCallerFPOffset)); |
| 4722 __ bind(&loop_entry); |
| 4723 __ cmpp(rdi, Operand(r9, StandardFrameConstants::kFunctionOffset)); |
| 4724 __ j(not_equal, &loop); |
| 4725 } |
| 4726 |
4712 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. | 4727 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. |
4713 __ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 4728 __ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
4714 __ LoadSharedFunctionInfoSpecialField( | 4729 __ LoadSharedFunctionInfoSpecialField( |
4715 rcx, rcx, SharedFunctionInfo::kFormalParameterCountOffset); | 4730 rcx, rcx, SharedFunctionInfo::kFormalParameterCountOffset); |
4716 __ leap(rdx, Operand(rbp, rcx, times_pointer_size, | 4731 __ leap(rdx, Operand(r9, rcx, times_pointer_size, |
4717 StandardFrameConstants::kCallerSPOffset)); | 4732 StandardFrameConstants::kCallerSPOffset)); |
4718 __ Integer32ToSmi(rcx, rcx); | 4733 __ Integer32ToSmi(rcx, rcx); |
4719 | 4734 |
4720 // rcx : number of parameters (tagged) | 4735 // rcx : number of parameters (tagged) |
4721 // rdx : parameters pointer | 4736 // rdx : parameters pointer |
4722 // rdi : function | 4737 // rdi : function |
4723 // rsp[0] : return address | 4738 // rsp[0] : return address |
| 4739 // r9 : JavaScript frame pointer. |
4724 // Registers used over the whole function: | 4740 // Registers used over the whole function: |
4725 // rbx: the mapped parameter count (untagged) | 4741 // rbx: the mapped parameter count (untagged) |
4726 // rax: the allocated object (tagged). | 4742 // rax: the allocated object (tagged). |
4727 Factory* factory = isolate()->factory(); | 4743 Factory* factory = isolate()->factory(); |
4728 | 4744 |
4729 __ SmiToInteger64(rbx, rcx); | 4745 __ SmiToInteger64(rbx, rcx); |
4730 // rbx = parameter count (untagged) | 4746 // rbx = parameter count (untagged) |
4731 | 4747 |
4732 // Check if the calling frame is an arguments adaptor frame. | 4748 // Check if the calling frame is an arguments adaptor frame. |
4733 Label adaptor_frame, try_allocate, runtime; | 4749 Label adaptor_frame, try_allocate, runtime; |
4734 __ movp(rax, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 4750 __ movp(rax, Operand(r9, StandardFrameConstants::kCallerFPOffset)); |
4735 __ movp(r8, Operand(rax, CommonFrameConstants::kContextOrFrameTypeOffset)); | 4751 __ movp(r8, Operand(rax, CommonFrameConstants::kContextOrFrameTypeOffset)); |
4736 __ Cmp(r8, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 4752 __ Cmp(r8, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
4737 __ j(equal, &adaptor_frame); | 4753 __ j(equal, &adaptor_frame); |
4738 | 4754 |
4739 // No adaptor, parameter count = argument count. | 4755 // No adaptor, parameter count = argument count. |
4740 __ movp(r11, rbx); | 4756 __ movp(r11, rbx); |
4741 __ jmp(&try_allocate, Label::kNear); | 4757 __ jmp(&try_allocate, Label::kNear); |
4742 | 4758 |
4743 // We have an adaptor frame. Patch the parameters pointer. | 4759 // We have an adaptor frame. Patch the parameters pointer. |
4744 __ bind(&adaptor_frame); | 4760 __ bind(&adaptor_frame); |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5571 kStackUnwindSpace, nullptr, return_value_operand, | 5587 kStackUnwindSpace, nullptr, return_value_operand, |
5572 NULL); | 5588 NULL); |
5573 } | 5589 } |
5574 | 5590 |
5575 #undef __ | 5591 #undef __ |
5576 | 5592 |
5577 } // namespace internal | 5593 } // namespace internal |
5578 } // namespace v8 | 5594 } // namespace v8 |
5579 | 5595 |
5580 #endif // V8_TARGET_ARCH_X64 | 5596 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |