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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 4621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4632 | 4632 |
4633 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { | 4633 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
4634 // ----------- S t a t e ------------- | 4634 // ----------- S t a t e ------------- |
4635 // -- r1 : function | 4635 // -- r1 : function |
4636 // -- cp : context | 4636 // -- cp : context |
4637 // -- fp : frame pointer | 4637 // -- fp : frame pointer |
4638 // -- lr : return address | 4638 // -- lr : return address |
4639 // ----------------------------------- | 4639 // ----------------------------------- |
4640 __ AssertFunction(r1); | 4640 __ AssertFunction(r1); |
4641 | 4641 |
4642 // For Ignition we need to skip all possible handler/stub frames until | 4642 // Make r2 point to the JavaScript frame. |
4643 // we reach the JavaScript frame for the function (similar to what the | 4643 __ mov(r2, fp); |
4644 // runtime fallback implementation does). So make r2 point to that | 4644 if (skip_stub_frame()) { |
4645 // JavaScript frame. | 4645 // For Ignition we need to skip the handler/stub frame to reach the |
4646 { | 4646 // JavaScript frame for the function. |
4647 Label loop, loop_entry; | |
4648 __ mov(r2, fp); | |
4649 __ b(&loop_entry); | |
4650 __ bind(&loop); | |
4651 __ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset)); | 4647 __ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset)); |
4652 __ bind(&loop_entry); | 4648 } |
| 4649 if (FLAG_debug_code) { |
| 4650 Label ok; |
4653 __ ldr(ip, MemOperand(r2, StandardFrameConstants::kFunctionOffset)); | 4651 __ ldr(ip, MemOperand(r2, StandardFrameConstants::kFunctionOffset)); |
4654 __ cmp(ip, r1); | 4652 __ cmp(ip, r1); |
4655 __ b(ne, &loop); | 4653 __ b(eq, &ok); |
| 4654 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 4655 __ bind(&ok); |
4656 } | 4656 } |
4657 | 4657 |
4658 // Check if we have rest parameters (only possible if we have an | 4658 // Check if we have rest parameters (only possible if we have an |
4659 // arguments adaptor frame below the function frame). | 4659 // arguments adaptor frame below the function frame). |
4660 Label no_rest_parameters; | 4660 Label no_rest_parameters; |
4661 __ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset)); | 4661 __ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset)); |
4662 __ ldr(ip, MemOperand(r2, CommonFrameConstants::kContextOrFrameTypeOffset)); | 4662 __ ldr(ip, MemOperand(r2, CommonFrameConstants::kContextOrFrameTypeOffset)); |
4663 __ cmp(ip, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4663 __ cmp(ip, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4664 __ b(ne, &no_rest_parameters); | 4664 __ b(ne, &no_rest_parameters); |
4665 | 4665 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4774 | 4774 |
4775 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 4775 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { |
4776 // ----------- S t a t e ------------- | 4776 // ----------- S t a t e ------------- |
4777 // -- r1 : function | 4777 // -- r1 : function |
4778 // -- cp : context | 4778 // -- cp : context |
4779 // -- fp : frame pointer | 4779 // -- fp : frame pointer |
4780 // -- lr : return address | 4780 // -- lr : return address |
4781 // ----------------------------------- | 4781 // ----------------------------------- |
4782 __ AssertFunction(r1); | 4782 __ AssertFunction(r1); |
4783 | 4783 |
4784 // For Ignition we need to skip all possible handler/stub frames until | 4784 // Make r9 point to the JavaScript frame. |
4785 // we reach the JavaScript frame for the function (similar to what the | 4785 __ mov(r9, fp); |
4786 // runtime fallback implementation does). So make r9 point to that | 4786 if (skip_stub_frame()) { |
4787 // JavaScript frame. | 4787 // For Ignition we need to skip the handler/stub frame to reach the |
4788 { | 4788 // JavaScript frame for the function. |
4789 Label loop, loop_entry; | |
4790 __ mov(r9, fp); | |
4791 __ b(&loop_entry); | |
4792 __ bind(&loop); | |
4793 __ ldr(r9, MemOperand(r9, StandardFrameConstants::kCallerFPOffset)); | 4789 __ ldr(r9, MemOperand(r9, StandardFrameConstants::kCallerFPOffset)); |
4794 __ bind(&loop_entry); | 4790 } |
| 4791 if (FLAG_debug_code) { |
| 4792 Label ok; |
4795 __ ldr(ip, MemOperand(r9, StandardFrameConstants::kFunctionOffset)); | 4793 __ ldr(ip, MemOperand(r9, StandardFrameConstants::kFunctionOffset)); |
4796 __ cmp(ip, r1); | 4794 __ cmp(ip, r1); |
4797 __ b(ne, &loop); | 4795 __ b(eq, &ok); |
| 4796 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 4797 __ bind(&ok); |
4798 } | 4798 } |
4799 | 4799 |
4800 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. | 4800 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. |
4801 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 4801 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
4802 __ ldr(r2, | 4802 __ ldr(r2, |
4803 FieldMemOperand(r2, SharedFunctionInfo::kFormalParameterCountOffset)); | 4803 FieldMemOperand(r2, SharedFunctionInfo::kFormalParameterCountOffset)); |
4804 __ add(r3, r9, Operand(r2, LSL, kPointerSizeLog2 - 1)); | 4804 __ add(r3, r9, Operand(r2, LSL, kPointerSizeLog2 - 1)); |
4805 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); | 4805 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); |
4806 | 4806 |
4807 // r1 : function | 4807 // r1 : function |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4996 | 4996 |
4997 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { | 4997 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { |
4998 // ----------- S t a t e ------------- | 4998 // ----------- S t a t e ------------- |
4999 // -- r1 : function | 4999 // -- r1 : function |
5000 // -- cp : context | 5000 // -- cp : context |
5001 // -- fp : frame pointer | 5001 // -- fp : frame pointer |
5002 // -- lr : return address | 5002 // -- lr : return address |
5003 // ----------------------------------- | 5003 // ----------------------------------- |
5004 __ AssertFunction(r1); | 5004 __ AssertFunction(r1); |
5005 | 5005 |
5006 // For Ignition we need to skip all possible handler/stub frames until | 5006 // Make r2 point to the JavaScript frame. |
5007 // we reach the JavaScript frame for the function (similar to what the | 5007 __ mov(r2, fp); |
5008 // runtime fallback implementation does). So make r2 point to that | 5008 if (skip_stub_frame()) { |
5009 // JavaScript frame. | 5009 // For Ignition we need to skip the handler/stub frame to reach the |
5010 { | 5010 // JavaScript frame for the function. |
5011 Label loop, loop_entry; | |
5012 __ mov(r2, fp); | |
5013 __ b(&loop_entry); | |
5014 __ bind(&loop); | |
5015 __ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset)); | 5011 __ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset)); |
5016 __ bind(&loop_entry); | 5012 } |
| 5013 if (FLAG_debug_code) { |
| 5014 Label ok; |
5017 __ ldr(ip, MemOperand(r2, StandardFrameConstants::kFunctionOffset)); | 5015 __ ldr(ip, MemOperand(r2, StandardFrameConstants::kFunctionOffset)); |
5018 __ cmp(ip, r1); | 5016 __ cmp(ip, r1); |
5019 __ b(ne, &loop); | 5017 __ b(eq, &ok); |
| 5018 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 5019 __ bind(&ok); |
5020 } | 5020 } |
5021 | 5021 |
5022 // Check if we have an arguments adaptor frame below the function frame. | 5022 // Check if we have an arguments adaptor frame below the function frame. |
5023 Label arguments_adaptor, arguments_done; | 5023 Label arguments_adaptor, arguments_done; |
5024 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kCallerFPOffset)); | 5024 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kCallerFPOffset)); |
5025 __ ldr(ip, MemOperand(r3, CommonFrameConstants::kContextOrFrameTypeOffset)); | 5025 __ ldr(ip, MemOperand(r3, CommonFrameConstants::kContextOrFrameTypeOffset)); |
5026 __ cmp(ip, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 5026 __ cmp(ip, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
5027 __ b(eq, &arguments_adaptor); | 5027 __ b(eq, &arguments_adaptor); |
5028 { | 5028 { |
5029 __ ldr(r1, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 5029 __ ldr(r1, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5559 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5559 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5560 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5560 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5561 } | 5561 } |
5562 | 5562 |
5563 #undef __ | 5563 #undef __ |
5564 | 5564 |
5565 } // namespace internal | 5565 } // namespace internal |
5566 } // namespace v8 | 5566 } // namespace v8 |
5567 | 5567 |
5568 #endif // V8_TARGET_ARCH_ARM | 5568 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |