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/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3806 __ bind(&need_incremental); | 3806 __ bind(&need_incremental); |
3807 | 3807 |
3808 // Fall through when we need to inform the incremental marker. | 3808 // Fall through when we need to inform the incremental marker. |
3809 } | 3809 } |
3810 | 3810 |
3811 | 3811 |
3812 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 3812 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
3813 CEntryStub ces(isolate(), 1, kSaveFPRegs); | 3813 CEntryStub ces(isolate(), 1, kSaveFPRegs); |
3814 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); | 3814 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); |
3815 int parameter_count_offset = | 3815 int parameter_count_offset = |
3816 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 3816 StubFailureTrampolineFrameConstants::kArgumentsLengthOffset; |
3817 __ LoadP(r4, MemOperand(fp, parameter_count_offset)); | 3817 __ LoadP(r4, MemOperand(fp, parameter_count_offset)); |
3818 if (function_mode() == JS_FUNCTION_STUB_MODE) { | 3818 if (function_mode() == JS_FUNCTION_STUB_MODE) { |
3819 __ addi(r4, r4, Operand(1)); | 3819 __ addi(r4, r4, Operand(1)); |
3820 } | 3820 } |
3821 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 3821 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
3822 __ slwi(r4, r4, Operand(kPointerSizeLog2)); | 3822 __ slwi(r4, r4, Operand(kPointerSizeLog2)); |
3823 __ add(sp, sp, r4); | 3823 __ add(sp, sp, r4); |
3824 __ Ret(); | 3824 __ Ret(); |
3825 } | 3825 } |
3826 | 3826 |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4818 // we reach the JavaScript frame for the function (similar to what the | 4818 // we reach the JavaScript frame for the function (similar to what the |
4819 // runtime fallback implementation does). So make r5 point to that | 4819 // runtime fallback implementation does). So make r5 point to that |
4820 // JavaScript frame. | 4820 // JavaScript frame. |
4821 { | 4821 { |
4822 Label loop, loop_entry; | 4822 Label loop, loop_entry; |
4823 __ mr(r5, fp); | 4823 __ mr(r5, fp); |
4824 __ b(&loop_entry); | 4824 __ b(&loop_entry); |
4825 __ bind(&loop); | 4825 __ bind(&loop); |
4826 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); | 4826 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); |
4827 __ bind(&loop_entry); | 4827 __ bind(&loop_entry); |
4828 __ LoadP(ip, MemOperand(r5, StandardFrameConstants::kMarkerOffset)); | 4828 __ LoadP(ip, MemOperand(r5, StandardFrameConstants::kFunctionOffset)); |
4829 __ cmp(ip, r4); | 4829 __ cmp(ip, r4); |
4830 __ bne(&loop); | 4830 __ bne(&loop); |
4831 } | 4831 } |
4832 | 4832 |
4833 // Check if we have rest parameters (only possible if we have an | 4833 // Check if we have rest parameters (only possible if we have an |
4834 // arguments adaptor frame below the function frame). | 4834 // arguments adaptor frame below the function frame). |
4835 Label no_rest_parameters; | 4835 Label no_rest_parameters; |
4836 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); | 4836 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); |
4837 __ LoadP(ip, MemOperand(r5, StandardFrameConstants::kContextOffset)); | 4837 __ LoadP(ip, MemOperand(r5, CommonFrameConstants::kContextOrFrameTypeOffset)); |
4838 __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 4838 __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); |
4839 __ bne(&no_rest_parameters); | 4839 __ bne(&no_rest_parameters); |
4840 | 4840 |
4841 // Check if the arguments adaptor frame contains more arguments than | 4841 // Check if the arguments adaptor frame contains more arguments than |
4842 // specified by the function's internal formal parameter count. | 4842 // specified by the function's internal formal parameter count. |
4843 Label rest_parameters; | 4843 Label rest_parameters; |
4844 __ LoadP(r3, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4844 __ LoadP(r3, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
4845 __ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 4845 __ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
4846 __ LoadWordArith( | 4846 __ LoadWordArith( |
4847 r4, FieldMemOperand(r4, SharedFunctionInfo::kFormalParameterCountOffset)); | 4847 r4, FieldMemOperand(r4, SharedFunctionInfo::kFormalParameterCountOffset)); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4972 // r4 : function | 4972 // r4 : function |
4973 // r5 : number of parameters (tagged) | 4973 // r5 : number of parameters (tagged) |
4974 // r6 : parameters pointer | 4974 // r6 : parameters pointer |
4975 // Registers used over whole function: | 4975 // Registers used over whole function: |
4976 // r8 : arguments count (tagged) | 4976 // r8 : arguments count (tagged) |
4977 // r9 : mapped parameter count (tagged) | 4977 // r9 : mapped parameter count (tagged) |
4978 | 4978 |
4979 // Check if the calling frame is an arguments adaptor frame. | 4979 // Check if the calling frame is an arguments adaptor frame. |
4980 Label adaptor_frame, try_allocate, runtime; | 4980 Label adaptor_frame, try_allocate, runtime; |
4981 __ LoadP(r7, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 4981 __ LoadP(r7, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
4982 __ LoadP(r3, MemOperand(r7, StandardFrameConstants::kContextOffset)); | 4982 __ LoadP(r3, MemOperand(r7, CommonFrameConstants::kContextOrFrameTypeOffset)); |
4983 __ CmpSmiLiteral(r3, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 4983 __ CmpSmiLiteral(r3, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); |
4984 __ beq(&adaptor_frame); | 4984 __ beq(&adaptor_frame); |
4985 | 4985 |
4986 // No adaptor, parameter count = argument count. | 4986 // No adaptor, parameter count = argument count. |
4987 __ mr(r8, r5); | 4987 __ mr(r8, r5); |
4988 __ mr(r9, r5); | 4988 __ mr(r9, r5); |
4989 __ b(&try_allocate); | 4989 __ b(&try_allocate); |
4990 | 4990 |
4991 // We have an adaptor frame. Patch the parameters pointer. | 4991 // We have an adaptor frame. Patch the parameters pointer. |
4992 __ bind(&adaptor_frame); | 4992 __ bind(&adaptor_frame); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5214 // we reach the JavaScript frame for the function (similar to what the | 5214 // we reach the JavaScript frame for the function (similar to what the |
5215 // runtime fallback implementation does). So make r5 point to that | 5215 // runtime fallback implementation does). So make r5 point to that |
5216 // JavaScript frame. | 5216 // JavaScript frame. |
5217 { | 5217 { |
5218 Label loop, loop_entry; | 5218 Label loop, loop_entry; |
5219 __ mr(r5, fp); | 5219 __ mr(r5, fp); |
5220 __ b(&loop_entry); | 5220 __ b(&loop_entry); |
5221 __ bind(&loop); | 5221 __ bind(&loop); |
5222 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); | 5222 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); |
5223 __ bind(&loop_entry); | 5223 __ bind(&loop_entry); |
5224 __ LoadP(ip, MemOperand(r5, StandardFrameConstants::kMarkerOffset)); | 5224 __ LoadP(ip, MemOperand(r5, StandardFrameConstants::kFunctionOffset)); |
5225 __ cmp(ip, r4); | 5225 __ cmp(ip, r4); |
5226 __ bne(&loop); | 5226 __ bne(&loop); |
5227 } | 5227 } |
5228 | 5228 |
5229 // Check if we have an arguments adaptor frame below the function frame. | 5229 // Check if we have an arguments adaptor frame below the function frame. |
5230 Label arguments_adaptor, arguments_done; | 5230 Label arguments_adaptor, arguments_done; |
5231 __ LoadP(r6, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); | 5231 __ LoadP(r6, MemOperand(r5, StandardFrameConstants::kCallerFPOffset)); |
5232 __ LoadP(ip, MemOperand(r6, StandardFrameConstants::kContextOffset)); | 5232 __ LoadP(ip, MemOperand(r6, CommonFrameConstants::kContextOrFrameTypeOffset)); |
5233 __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 5233 __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); |
5234 __ beq(&arguments_adaptor); | 5234 __ beq(&arguments_adaptor); |
5235 { | 5235 { |
5236 __ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 5236 __ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
5237 __ LoadWordArith( | 5237 __ LoadWordArith( |
5238 r3, | 5238 r3, |
5239 FieldMemOperand(r4, SharedFunctionInfo::kFormalParameterCountOffset)); | 5239 FieldMemOperand(r4, SharedFunctionInfo::kFormalParameterCountOffset)); |
5240 #if V8_TARGET_ARCH_PPC64 | 5240 #if V8_TARGET_ARCH_PPC64 |
5241 __ SmiTag(r3); | 5241 __ SmiTag(r3); |
5242 #endif | 5242 #endif |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5834 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5834 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5835 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5835 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5836 } | 5836 } |
5837 | 5837 |
5838 | 5838 |
5839 #undef __ | 5839 #undef __ |
5840 } // namespace internal | 5840 } // namespace internal |
5841 } // namespace v8 | 5841 } // namespace v8 |
5842 | 5842 |
5843 #endif // V8_TARGET_ARCH_PPC | 5843 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |