OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 4760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4771 | 4771 |
4772 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { | 4772 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
4773 // ----------- S t a t e ------------- | 4773 // ----------- S t a t e ------------- |
4774 // -- r4 : function | 4774 // -- r4 : function |
4775 // -- cp : context | 4775 // -- cp : context |
4776 // -- fp : frame pointer | 4776 // -- fp : frame pointer |
4777 // -- lr : return address | 4777 // -- lr : return address |
4778 // ----------------------------------- | 4778 // ----------------------------------- |
4779 __ AssertFunction(r4); | 4779 __ AssertFunction(r4); |
4780 | 4780 |
4781 // For Ignition we need to skip all possible handler/stub frames until | 4781 // Make r5 point to the JavaScript frame. |
4782 // we reach the JavaScript frame for the function (similar to what the | 4782 __ mr(r5, fp); |
4783 // runtime fallback implementation does). So make r5 point to that | 4783 if (skip_stub_frame()) { |
4784 // JavaScript frame. | 4784 // For Ignition we need to skip the handler/stub frame to reach the |
4785 { | 4785 // JavaScript frame for the function. |
4786 Label loop, loop_entry; | |
4787 __ mr(r5, fp); | |
4788 __ b(&loop_entry); | |
4789 __ bind(&loop); | |
4790 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); | 4786 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); |
4791 __ bind(&loop_entry); | 4787 } |
| 4788 if (FLAG_debug_code) { |
| 4789 Label ok; |
4792 __ LoadP(ip, MemOperand(r5, StandardFrameConstants::kFunctionOffset)); | 4790 __ LoadP(ip, MemOperand(r5, StandardFrameConstants::kFunctionOffset)); |
4793 __ cmp(ip, r4); | 4791 __ cmp(ip, r4); |
4794 __ bne(&loop); | 4792 __ beq(&ok); |
| 4793 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 4794 __ bind(&ok); |
4795 } | 4795 } |
4796 | 4796 |
4797 // Check if we have rest parameters (only possible if we have an | 4797 // Check if we have rest parameters (only possible if we have an |
4798 // arguments adaptor frame below the function frame). | 4798 // arguments adaptor frame below the function frame). |
4799 Label no_rest_parameters; | 4799 Label no_rest_parameters; |
4800 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); | 4800 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); |
4801 __ LoadP(ip, MemOperand(r5, CommonFrameConstants::kContextOrFrameTypeOffset)); | 4801 __ LoadP(ip, MemOperand(r5, CommonFrameConstants::kContextOrFrameTypeOffset)); |
4802 __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 4802 __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); |
4803 __ bne(&no_rest_parameters); | 4803 __ bne(&no_rest_parameters); |
4804 | 4804 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4915 | 4915 |
4916 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 4916 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { |
4917 // ----------- S t a t e ------------- | 4917 // ----------- S t a t e ------------- |
4918 // -- r4 : function | 4918 // -- r4 : function |
4919 // -- cp : context | 4919 // -- cp : context |
4920 // -- fp : frame pointer | 4920 // -- fp : frame pointer |
4921 // -- lr : return address | 4921 // -- lr : return address |
4922 // ----------------------------------- | 4922 // ----------------------------------- |
4923 __ AssertFunction(r4); | 4923 __ AssertFunction(r4); |
4924 | 4924 |
4925 // For Ignition we need to skip all possible handler/stub frames until | 4925 // Make r10 point to the JavaScript frame. |
4926 // we reach the JavaScript frame for the function (similar to what the | 4926 __ mr(r10, fp); |
4927 // runtime fallback implementation does). So make r10 point to that | 4927 if (skip_stub_frame()) { |
4928 // JavaScript frame. | 4928 // For Ignition we need to skip the handler/stub frame to reach the |
4929 { | 4929 // JavaScript frame for the function. |
4930 Label loop, loop_entry; | |
4931 __ mr(r10, fp); | |
4932 __ b(&loop_entry); | |
4933 __ bind(&loop); | |
4934 __ LoadP(r10, MemOperand(r10, StandardFrameConstants::kCallerFPOffset)); | 4930 __ LoadP(r10, MemOperand(r10, StandardFrameConstants::kCallerFPOffset)); |
4935 __ bind(&loop_entry); | 4931 } |
| 4932 if (FLAG_debug_code) { |
| 4933 Label ok; |
4936 __ LoadP(ip, MemOperand(r10, StandardFrameConstants::kFunctionOffset)); | 4934 __ LoadP(ip, MemOperand(r10, StandardFrameConstants::kFunctionOffset)); |
4937 __ cmp(ip, r4); | 4935 __ cmp(ip, r4); |
4938 __ bne(&loop); | 4936 __ beq(&ok); |
| 4937 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 4938 __ bind(&ok); |
4939 } | 4939 } |
4940 | 4940 |
4941 | 4941 |
4942 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. | 4942 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. |
4943 __ LoadP(r5, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 4943 __ LoadP(r5, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
4944 __ LoadWordArith( | 4944 __ LoadWordArith( |
4945 r5, FieldMemOperand(r5, SharedFunctionInfo::kFormalParameterCountOffset)); | 4945 r5, FieldMemOperand(r5, SharedFunctionInfo::kFormalParameterCountOffset)); |
4946 #if V8_TARGET_ARCH_PPC64 | 4946 #if V8_TARGET_ARCH_PPC64 |
4947 __ SmiTag(r5); | 4947 __ SmiTag(r5); |
4948 #endif | 4948 #endif |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5185 | 5185 |
5186 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { | 5186 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { |
5187 // ----------- S t a t e ------------- | 5187 // ----------- S t a t e ------------- |
5188 // -- r4 : function | 5188 // -- r4 : function |
5189 // -- cp : context | 5189 // -- cp : context |
5190 // -- fp : frame pointer | 5190 // -- fp : frame pointer |
5191 // -- lr : return address | 5191 // -- lr : return address |
5192 // ----------------------------------- | 5192 // ----------------------------------- |
5193 __ AssertFunction(r4); | 5193 __ AssertFunction(r4); |
5194 | 5194 |
5195 // For Ignition we need to skip all possible handler/stub frames until | 5195 // Make r5 point to the JavaScript frame. |
5196 // we reach the JavaScript frame for the function (similar to what the | 5196 __ mr(r5, fp); |
5197 // runtime fallback implementation does). So make r5 point to that | 5197 if (skip_stub_frame()) { |
5198 // JavaScript frame. | 5198 // For Ignition we need to skip the handler/stub frame to reach the |
5199 { | 5199 // JavaScript frame for the function. |
5200 Label loop, loop_entry; | |
5201 __ mr(r5, fp); | |
5202 __ b(&loop_entry); | |
5203 __ bind(&loop); | |
5204 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); | 5200 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); |
5205 __ bind(&loop_entry); | 5201 } |
| 5202 if (FLAG_debug_code) { |
| 5203 Label ok; |
5206 __ LoadP(ip, MemOperand(r5, StandardFrameConstants::kFunctionOffset)); | 5204 __ LoadP(ip, MemOperand(r5, StandardFrameConstants::kFunctionOffset)); |
5207 __ cmp(ip, r4); | 5205 __ cmp(ip, r4); |
5208 __ bne(&loop); | 5206 __ b(&ok); |
| 5207 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 5208 __ bind(&ok); |
5209 } | 5209 } |
5210 | 5210 |
5211 // Check if we have an arguments adaptor frame below the function frame. | 5211 // Check if we have an arguments adaptor frame below the function frame. |
5212 Label arguments_adaptor, arguments_done; | 5212 Label arguments_adaptor, arguments_done; |
5213 __ LoadP(r6, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); | 5213 __ LoadP(r6, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); |
5214 __ LoadP(ip, MemOperand(r6, CommonFrameConstants::kContextOrFrameTypeOffset)); | 5214 __ LoadP(ip, MemOperand(r6, CommonFrameConstants::kContextOrFrameTypeOffset)); |
5215 __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 5215 __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); |
5216 __ beq(&arguments_adaptor); | 5216 __ beq(&arguments_adaptor); |
5217 { | 5217 { |
5218 __ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 5218 __ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5803 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5803 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
5804 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5804 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5805 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5805 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5806 } | 5806 } |
5807 | 5807 |
5808 #undef __ | 5808 #undef __ |
5809 } // namespace internal | 5809 } // namespace internal |
5810 } // namespace v8 | 5810 } // namespace v8 |
5811 | 5811 |
5812 #endif // V8_TARGET_ARCH_PPC | 5812 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |