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/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 4815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4826 | 4826 |
4827 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { | 4827 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
4828 // ----------- S t a t e ------------- | 4828 // ----------- S t a t e ------------- |
4829 // -- a1 : function | 4829 // -- a1 : function |
4830 // -- cp : context | 4830 // -- cp : context |
4831 // -- fp : frame pointer | 4831 // -- fp : frame pointer |
4832 // -- ra : return address | 4832 // -- ra : return address |
4833 // ----------------------------------- | 4833 // ----------------------------------- |
4834 __ AssertFunction(a1); | 4834 __ AssertFunction(a1); |
4835 | 4835 |
4836 // For Ignition we need to skip all possible handler/stub frames until | 4836 // Make a2 point to the JavaScript frame. |
4837 // we reach the JavaScript frame for the function (similar to what the | 4837 __ mov(a2, fp); |
4838 // runtime fallback implementation does). So make a2 point to that | 4838 if (skip_stub_frame()) { |
4839 // JavaScript frame. | 4839 // For Ignition we need to skip the handler/stub frame to reach the |
4840 { | 4840 // JavaScript frame for the function. |
4841 Label loop, loop_entry; | |
4842 __ Branch(USE_DELAY_SLOT, &loop_entry); | |
4843 __ mov(a2, fp); // In delay slot. | |
4844 __ bind(&loop); | |
4845 __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); | 4841 __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); |
4846 __ bind(&loop_entry); | 4842 } |
| 4843 if (FLAG_debug_code) { |
| 4844 Label ok; |
4847 __ lw(a3, MemOperand(a2, StandardFrameConstants::kFunctionOffset)); | 4845 __ lw(a3, MemOperand(a2, StandardFrameConstants::kFunctionOffset)); |
4848 __ Branch(&loop, ne, a1, Operand(a3)); | 4846 __ Branch(&ok, eq, a1, Operand(a3)); |
| 4847 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 4848 __ bind(&ok); |
4849 } | 4849 } |
4850 | 4850 |
4851 // Check if we have rest parameters (only possible if we have an | 4851 // Check if we have rest parameters (only possible if we have an |
4852 // arguments adaptor frame below the function frame). | 4852 // arguments adaptor frame below the function frame). |
4853 Label no_rest_parameters; | 4853 Label no_rest_parameters; |
4854 __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); | 4854 __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); |
4855 __ lw(a3, MemOperand(a2, CommonFrameConstants::kContextOrFrameTypeOffset)); | 4855 __ lw(a3, MemOperand(a2, CommonFrameConstants::kContextOrFrameTypeOffset)); |
4856 __ Branch(&no_rest_parameters, ne, a3, | 4856 __ Branch(&no_rest_parameters, ne, a3, |
4857 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4857 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4858 | 4858 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4967 | 4967 |
4968 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 4968 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { |
4969 // ----------- S t a t e ------------- | 4969 // ----------- S t a t e ------------- |
4970 // -- a1 : function | 4970 // -- a1 : function |
4971 // -- cp : context | 4971 // -- cp : context |
4972 // -- fp : frame pointer | 4972 // -- fp : frame pointer |
4973 // -- ra : return address | 4973 // -- ra : return address |
4974 // ----------------------------------- | 4974 // ----------------------------------- |
4975 __ AssertFunction(a1); | 4975 __ AssertFunction(a1); |
4976 | 4976 |
4977 // For Ignition we need to skip all possible handler/stub frames until | 4977 // Make t0 point to the JavaScript frame. |
4978 // we reach the JavaScript frame for the function (similar to what the | 4978 __ mov(t0, fp); |
4979 // runtime fallback implementation does). So make t0 point to that | 4979 if (skip_stub_frame()) { |
4980 // JavaScript frame. | 4980 // For Ignition we need to skip the handler/stub frame to reach the |
4981 { | 4981 // JavaScript frame for the function. |
4982 Label loop, loop_entry; | |
4983 __ Branch(USE_DELAY_SLOT, &loop_entry); | |
4984 __ mov(t0, fp); // In delay slot. | |
4985 __ bind(&loop); | |
4986 __ lw(t0, MemOperand(t0, StandardFrameConstants::kCallerFPOffset)); | 4982 __ lw(t0, MemOperand(t0, StandardFrameConstants::kCallerFPOffset)); |
4987 __ bind(&loop_entry); | 4983 } |
| 4984 if (FLAG_debug_code) { |
| 4985 Label ok; |
4988 __ lw(a3, MemOperand(t0, StandardFrameConstants::kFunctionOffset)); | 4986 __ lw(a3, MemOperand(t0, StandardFrameConstants::kFunctionOffset)); |
4989 __ Branch(&loop, ne, a1, Operand(a3)); | 4987 __ Branch(&ok, eq, a1, Operand(a3)); |
| 4988 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 4989 __ bind(&ok); |
4990 } | 4990 } |
4991 | 4991 |
4992 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. | 4992 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. |
4993 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 4993 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
4994 __ lw(a2, | 4994 __ lw(a2, |
4995 FieldMemOperand(a2, SharedFunctionInfo::kFormalParameterCountOffset)); | 4995 FieldMemOperand(a2, SharedFunctionInfo::kFormalParameterCountOffset)); |
4996 __ Lsa(a3, t0, a2, kPointerSizeLog2 - 1); | 4996 __ Lsa(a3, t0, a2, kPointerSizeLog2 - 1); |
4997 __ Addu(a3, a3, Operand(StandardFrameConstants::kCallerSPOffset)); | 4997 __ Addu(a3, a3, Operand(StandardFrameConstants::kCallerSPOffset)); |
4998 | 4998 |
4999 // a1 : function | 4999 // a1 : function |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5197 | 5197 |
5198 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { | 5198 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { |
5199 // ----------- S t a t e ------------- | 5199 // ----------- S t a t e ------------- |
5200 // -- a1 : function | 5200 // -- a1 : function |
5201 // -- cp : context | 5201 // -- cp : context |
5202 // -- fp : frame pointer | 5202 // -- fp : frame pointer |
5203 // -- ra : return address | 5203 // -- ra : return address |
5204 // ----------------------------------- | 5204 // ----------------------------------- |
5205 __ AssertFunction(a1); | 5205 __ AssertFunction(a1); |
5206 | 5206 |
5207 // For Ignition we need to skip all possible handler/stub frames until | 5207 // Make a2 point to the JavaScript frame. |
5208 // we reach the JavaScript frame for the function (similar to what the | 5208 __ mov(a2, fp); |
5209 // runtime fallback implementation does). So make a2 point to that | 5209 if (skip_stub_frame()) { |
5210 // JavaScript frame. | 5210 // For Ignition we need to skip the handler/stub frame to reach the |
5211 { | 5211 // JavaScript frame for the function. |
5212 Label loop, loop_entry; | |
5213 __ Branch(USE_DELAY_SLOT, &loop_entry); | |
5214 __ mov(a2, fp); // In delay slot. | |
5215 __ bind(&loop); | |
5216 __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); | 5212 __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); |
5217 __ bind(&loop_entry); | 5213 } |
| 5214 if (FLAG_debug_code) { |
| 5215 Label ok; |
5218 __ lw(a3, MemOperand(a2, StandardFrameConstants::kFunctionOffset)); | 5216 __ lw(a3, MemOperand(a2, StandardFrameConstants::kFunctionOffset)); |
5219 __ Branch(&loop, ne, a1, Operand(a3)); | 5217 __ Branch(&ok, eq, a1, Operand(a3)); |
| 5218 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 5219 __ bind(&ok); |
5220 } | 5220 } |
5221 | 5221 |
5222 // Check if we have an arguments adaptor frame below the function frame. | 5222 // Check if we have an arguments adaptor frame below the function frame. |
5223 Label arguments_adaptor, arguments_done; | 5223 Label arguments_adaptor, arguments_done; |
5224 __ lw(a3, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); | 5224 __ lw(a3, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); |
5225 __ lw(a0, MemOperand(a3, CommonFrameConstants::kContextOrFrameTypeOffset)); | 5225 __ lw(a0, MemOperand(a3, CommonFrameConstants::kContextOrFrameTypeOffset)); |
5226 __ Branch(&arguments_adaptor, eq, a0, | 5226 __ Branch(&arguments_adaptor, eq, a0, |
5227 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 5227 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
5228 { | 5228 { |
5229 __ lw(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 5229 __ lw(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5748 kStackUnwindSpace, kInvalidStackOffset, | 5748 kStackUnwindSpace, kInvalidStackOffset, |
5749 return_value_operand, NULL); | 5749 return_value_operand, NULL); |
5750 } | 5750 } |
5751 | 5751 |
5752 #undef __ | 5752 #undef __ |
5753 | 5753 |
5754 } // namespace internal | 5754 } // namespace internal |
5755 } // namespace v8 | 5755 } // namespace v8 |
5756 | 5756 |
5757 #endif // V8_TARGET_ARCH_MIPS | 5757 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |