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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 3876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3887 __ bind(&need_incremental); | 3887 __ bind(&need_incremental); |
3888 | 3888 |
3889 // Fall through when we need to inform the incremental marker. | 3889 // Fall through when we need to inform the incremental marker. |
3890 } | 3890 } |
3891 | 3891 |
3892 | 3892 |
3893 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 3893 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
3894 CEntryStub ces(isolate(), 1, kSaveFPRegs); | 3894 CEntryStub ces(isolate(), 1, kSaveFPRegs); |
3895 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); | 3895 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); |
3896 int parameter_count_offset = | 3896 int parameter_count_offset = |
3897 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 3897 StubFailureTrampolineFrameConstants::kArgumentsLengthOffset; |
3898 __ lw(a1, MemOperand(fp, parameter_count_offset)); | 3898 __ lw(a1, MemOperand(fp, parameter_count_offset)); |
3899 if (function_mode() == JS_FUNCTION_STUB_MODE) { | 3899 if (function_mode() == JS_FUNCTION_STUB_MODE) { |
3900 __ Addu(a1, a1, Operand(1)); | 3900 __ Addu(a1, a1, Operand(1)); |
3901 } | 3901 } |
3902 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 3902 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
3903 __ sll(a1, a1, kPointerSizeLog2); | 3903 __ sll(a1, a1, kPointerSizeLog2); |
3904 __ Ret(USE_DELAY_SLOT); | 3904 __ Ret(USE_DELAY_SLOT); |
3905 __ Addu(sp, sp, a1); | 3905 __ Addu(sp, sp, a1); |
3906 } | 3906 } |
3907 | 3907 |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4869 // we reach the JavaScript frame for the function (similar to what the | 4869 // we reach the JavaScript frame for the function (similar to what the |
4870 // runtime fallback implementation does). So make a2 point to that | 4870 // runtime fallback implementation does). So make a2 point to that |
4871 // JavaScript frame. | 4871 // JavaScript frame. |
4872 { | 4872 { |
4873 Label loop, loop_entry; | 4873 Label loop, loop_entry; |
4874 __ Branch(USE_DELAY_SLOT, &loop_entry); | 4874 __ Branch(USE_DELAY_SLOT, &loop_entry); |
4875 __ mov(a2, fp); // In delay slot. | 4875 __ mov(a2, fp); // In delay slot. |
4876 __ bind(&loop); | 4876 __ bind(&loop); |
4877 __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); | 4877 __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); |
4878 __ bind(&loop_entry); | 4878 __ bind(&loop_entry); |
4879 __ lw(a3, MemOperand(a2, StandardFrameConstants::kMarkerOffset)); | 4879 __ lw(a3, MemOperand(a2, StandardFrameConstants::kFunctionOffset)); |
4880 __ Branch(&loop, ne, a1, Operand(a3)); | 4880 __ Branch(&loop, ne, a1, Operand(a3)); |
4881 } | 4881 } |
4882 | 4882 |
4883 // Check if we have rest parameters (only possible if we have an | 4883 // Check if we have rest parameters (only possible if we have an |
4884 // arguments adaptor frame below the function frame). | 4884 // arguments adaptor frame below the function frame). |
4885 Label no_rest_parameters; | 4885 Label no_rest_parameters; |
4886 __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); | 4886 __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); |
4887 __ lw(a3, MemOperand(a2, StandardFrameConstants::kContextOffset)); | 4887 __ lw(a3, MemOperand(a2, CommonFrameConstants::kContextOrFrameTypeOffset)); |
4888 __ Branch(&no_rest_parameters, ne, a3, | 4888 __ Branch(&no_rest_parameters, ne, a3, |
4889 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4889 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4890 | 4890 |
4891 // Check if the arguments adaptor frame contains more arguments than | 4891 // Check if the arguments adaptor frame contains more arguments than |
4892 // specified by the function's internal formal parameter count. | 4892 // specified by the function's internal formal parameter count. |
4893 Label rest_parameters; | 4893 Label rest_parameters; |
4894 __ lw(a0, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4894 __ lw(a0, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
4895 __ lw(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 4895 __ lw(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
4896 __ lw(a1, | 4896 __ lw(a1, |
4897 FieldMemOperand(a1, SharedFunctionInfo::kFormalParameterCountOffset)); | 4897 FieldMemOperand(a1, SharedFunctionInfo::kFormalParameterCountOffset)); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5016 // a1 : function | 5016 // a1 : function |
5017 // a2 : number of parameters (tagged) | 5017 // a2 : number of parameters (tagged) |
5018 // a3 : parameters pointer | 5018 // a3 : parameters pointer |
5019 // Registers used over whole function: | 5019 // Registers used over whole function: |
5020 // t1 : arguments count (tagged) | 5020 // t1 : arguments count (tagged) |
5021 // t2 : mapped parameter count (tagged) | 5021 // t2 : mapped parameter count (tagged) |
5022 | 5022 |
5023 // Check if the calling frame is an arguments adaptor frame. | 5023 // Check if the calling frame is an arguments adaptor frame. |
5024 Label adaptor_frame, try_allocate, runtime; | 5024 Label adaptor_frame, try_allocate, runtime; |
5025 __ lw(t0, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 5025 __ lw(t0, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
5026 __ lw(a0, MemOperand(t0, StandardFrameConstants::kContextOffset)); | 5026 __ lw(a0, MemOperand(t0, CommonFrameConstants::kContextOrFrameTypeOffset)); |
5027 __ Branch(&adaptor_frame, eq, a0, | 5027 __ Branch(&adaptor_frame, eq, a0, |
5028 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 5028 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
5029 | 5029 |
5030 // No adaptor, parameter count = argument count. | 5030 // No adaptor, parameter count = argument count. |
5031 __ mov(t1, a2); | 5031 __ mov(t1, a2); |
5032 __ Branch(USE_DELAY_SLOT, &try_allocate); | 5032 __ Branch(USE_DELAY_SLOT, &try_allocate); |
5033 __ mov(t2, a2); // In delay slot. | 5033 __ mov(t2, a2); // In delay slot. |
5034 | 5034 |
5035 // We have an adaptor frame. Patch the parameters pointer. | 5035 // We have an adaptor frame. Patch the parameters pointer. |
5036 __ bind(&adaptor_frame); | 5036 __ bind(&adaptor_frame); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5224 // we reach the JavaScript frame for the function (similar to what the | 5224 // we reach the JavaScript frame for the function (similar to what the |
5225 // runtime fallback implementation does). So make a2 point to that | 5225 // runtime fallback implementation does). So make a2 point to that |
5226 // JavaScript frame. | 5226 // JavaScript frame. |
5227 { | 5227 { |
5228 Label loop, loop_entry; | 5228 Label loop, loop_entry; |
5229 __ Branch(USE_DELAY_SLOT, &loop_entry); | 5229 __ Branch(USE_DELAY_SLOT, &loop_entry); |
5230 __ mov(a2, fp); // In delay slot. | 5230 __ mov(a2, fp); // In delay slot. |
5231 __ bind(&loop); | 5231 __ bind(&loop); |
5232 __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); | 5232 __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); |
5233 __ bind(&loop_entry); | 5233 __ bind(&loop_entry); |
5234 __ lw(a3, MemOperand(a2, StandardFrameConstants::kMarkerOffset)); | 5234 __ lw(a3, MemOperand(a2, StandardFrameConstants::kFunctionOffset)); |
5235 __ Branch(&loop, ne, a1, Operand(a3)); | 5235 __ Branch(&loop, ne, a1, Operand(a3)); |
5236 } | 5236 } |
5237 | 5237 |
5238 // Check if we have an arguments adaptor frame below the function frame. | 5238 // Check if we have an arguments adaptor frame below the function frame. |
5239 Label arguments_adaptor, arguments_done; | 5239 Label arguments_adaptor, arguments_done; |
5240 __ lw(a3, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); | 5240 __ lw(a3, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); |
5241 __ lw(a0, MemOperand(a3, StandardFrameConstants::kContextOffset)); | 5241 __ lw(a0, MemOperand(a3, CommonFrameConstants::kContextOrFrameTypeOffset)); |
5242 __ Branch(&arguments_adaptor, eq, a0, | 5242 __ Branch(&arguments_adaptor, eq, a0, |
5243 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 5243 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
5244 { | 5244 { |
5245 __ lw(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 5245 __ lw(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
5246 __ lw(a0, | 5246 __ lw(a0, |
5247 FieldMemOperand(a1, SharedFunctionInfo::kFormalParameterCountOffset)); | 5247 FieldMemOperand(a1, SharedFunctionInfo::kFormalParameterCountOffset)); |
5248 __ Lsa(a2, a2, a0, kPointerSizeLog2 - 1); | 5248 __ Lsa(a2, a2, a0, kPointerSizeLog2 - 1); |
5249 __ Addu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset - | 5249 __ Addu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset - |
5250 1 * kPointerSize)); | 5250 1 * kPointerSize)); |
5251 } | 5251 } |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5769 return_value_operand, NULL); | 5769 return_value_operand, NULL); |
5770 } | 5770 } |
5771 | 5771 |
5772 | 5772 |
5773 #undef __ | 5773 #undef __ |
5774 | 5774 |
5775 } // namespace internal | 5775 } // namespace internal |
5776 } // namespace v8 | 5776 } // namespace v8 |
5777 | 5777 |
5778 #endif // V8_TARGET_ARCH_MIPS | 5778 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |