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 4705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4716 | 4716 |
4717 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 4717 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { |
4718 // ----------- S t a t e ------------- | 4718 // ----------- S t a t e ------------- |
4719 // -- rdi : function | 4719 // -- rdi : function |
4720 // -- rsi : context | 4720 // -- rsi : context |
4721 // -- rbp : frame pointer | 4721 // -- rbp : frame pointer |
4722 // -- rsp[0] : return address | 4722 // -- rsp[0] : return address |
4723 // ----------------------------------- | 4723 // ----------------------------------- |
4724 __ AssertFunction(rdi); | 4724 __ AssertFunction(rdi); |
4725 | 4725 |
4726 // For Ignition we need to skip all possible handler/stub frames until | |
4727 // we reach the JavaScript frame for the function (similar to what the | |
4728 // runtime fallback implementation does). So make r9 point to that | |
4729 // JavaScript frame. | |
4730 { | |
4731 Label loop, loop_entry; | |
4732 __ movp(r9, rbp); | |
4733 __ jmp(&loop_entry, Label::kNear); | |
4734 __ bind(&loop); | |
4735 __ movp(r9, Operand(r9, StandardFrameConstants::kCallerFPOffset)); | |
4736 __ bind(&loop_entry); | |
4737 __ cmpp(rdi, Operand(r9, StandardFrameConstants::kFunctionOffset)); | |
4738 __ j(not_equal, &loop); | |
4739 } | |
4740 | |
4726 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. | 4741 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. |
rmcilroy
2016/04/21 11:03:34
I didn't touch this TODO since I'm not sure how yo
| |
4727 __ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 4742 __ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
4728 __ LoadSharedFunctionInfoSpecialField( | 4743 __ LoadSharedFunctionInfoSpecialField( |
4729 rcx, rcx, SharedFunctionInfo::kFormalParameterCountOffset); | 4744 rcx, rcx, SharedFunctionInfo::kFormalParameterCountOffset); |
4730 __ leap(rdx, Operand(rbp, rcx, times_pointer_size, | 4745 __ leap(rdx, Operand(r9, rcx, times_pointer_size, |
4731 StandardFrameConstants::kCallerSPOffset)); | 4746 StandardFrameConstants::kCallerSPOffset)); |
4732 __ Integer32ToSmi(rcx, rcx); | 4747 __ Integer32ToSmi(rcx, rcx); |
4733 | 4748 |
4734 // rcx : number of parameters (tagged) | 4749 // rcx : number of parameters (tagged) |
4735 // rdx : parameters pointer | 4750 // rdx : parameters pointer |
4736 // rdi : function | 4751 // rdi : function |
4737 // rsp[0] : return address | 4752 // rsp[0] : return address |
4753 // r9 : JavaScript frame pointer. | |
4738 // Registers used over the whole function: | 4754 // Registers used over the whole function: |
4739 // rbx: the mapped parameter count (untagged) | 4755 // rbx: the mapped parameter count (untagged) |
4740 // rax: the allocated object (tagged). | 4756 // rax: the allocated object (tagged). |
4741 Factory* factory = isolate()->factory(); | 4757 Factory* factory = isolate()->factory(); |
4742 | 4758 |
4743 __ SmiToInteger64(rbx, rcx); | 4759 __ SmiToInteger64(rbx, rcx); |
4744 // rbx = parameter count (untagged) | 4760 // rbx = parameter count (untagged) |
4745 | 4761 |
4746 // Check if the calling frame is an arguments adaptor frame. | 4762 // Check if the calling frame is an arguments adaptor frame. |
4747 Label adaptor_frame, try_allocate, runtime; | 4763 Label adaptor_frame, try_allocate, runtime; |
4748 __ movp(rax, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 4764 __ movp(rax, Operand(r9, StandardFrameConstants::kCallerFPOffset)); |
4749 __ movp(r8, Operand(rax, CommonFrameConstants::kContextOrFrameTypeOffset)); | 4765 __ movp(r8, Operand(rax, CommonFrameConstants::kContextOrFrameTypeOffset)); |
4750 __ Cmp(r8, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 4766 __ Cmp(r8, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
4751 __ j(equal, &adaptor_frame); | 4767 __ j(equal, &adaptor_frame); |
4752 | 4768 |
4753 // No adaptor, parameter count = argument count. | 4769 // No adaptor, parameter count = argument count. |
4754 __ movp(r11, rbx); | 4770 __ movp(r11, rbx); |
4755 __ jmp(&try_allocate, Label::kNear); | 4771 __ jmp(&try_allocate, Label::kNear); |
4756 | 4772 |
4757 // We have an adaptor frame. Patch the parameters pointer. | 4773 // We have an adaptor frame. Patch the parameters pointer. |
4758 __ bind(&adaptor_frame); | 4774 __ bind(&adaptor_frame); |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5585 kStackUnwindSpace, nullptr, return_value_operand, | 5601 kStackUnwindSpace, nullptr, return_value_operand, |
5586 NULL); | 5602 NULL); |
5587 } | 5603 } |
5588 | 5604 |
5589 #undef __ | 5605 #undef __ |
5590 | 5606 |
5591 } // namespace internal | 5607 } // namespace internal |
5592 } // namespace v8 | 5608 } // namespace v8 |
5593 | 5609 |
5594 #endif // V8_TARGET_ARCH_X64 | 5610 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |