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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 4789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4800 | 4800 |
4801 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { | 4801 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
4802 // ----------- S t a t e ------------- | 4802 // ----------- S t a t e ------------- |
4803 // -- edi : function | 4803 // -- edi : function |
4804 // -- esi : context | 4804 // -- esi : context |
4805 // -- ebp : frame pointer | 4805 // -- ebp : frame pointer |
4806 // -- esp[0] : return address | 4806 // -- esp[0] : return address |
4807 // ----------------------------------- | 4807 // ----------------------------------- |
4808 __ AssertFunction(edi); | 4808 __ AssertFunction(edi); |
4809 | 4809 |
4810 // For Ignition we need to skip all possible handler/stub frames until | 4810 // Make edx point to the JavaScript frame. |
4811 // we reach the JavaScript frame for the function (similar to what the | 4811 __ mov(edx, ebp); |
4812 // runtime fallback implementation does). So make edx point to that | 4812 if (skip_stub_frame()) { |
4813 // JavaScript frame. | 4813 // For Ignition we need to skip the handler/stub frame to reach the |
4814 { | 4814 // JavaScript frame for the function. |
4815 Label loop, loop_entry; | |
4816 __ mov(edx, ebp); | |
4817 __ jmp(&loop_entry, Label::kNear); | |
4818 __ bind(&loop); | |
4819 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4815 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
4820 __ bind(&loop_entry); | 4816 } |
| 4817 if (FLAG_debug_code) { |
| 4818 Label ok; |
4821 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); | 4819 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); |
4822 __ j(not_equal, &loop); | 4820 __ j(equal, &ok); |
| 4821 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 4822 __ bind(&ok); |
4823 } | 4823 } |
4824 | 4824 |
4825 // Check if we have rest parameters (only possible if we have an | 4825 // Check if we have rest parameters (only possible if we have an |
4826 // arguments adaptor frame below the function frame). | 4826 // arguments adaptor frame below the function frame). |
4827 Label no_rest_parameters; | 4827 Label no_rest_parameters; |
4828 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4828 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
4829 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), | 4829 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), |
4830 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4830 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4831 __ j(not_equal, &no_rest_parameters, Label::kNear); | 4831 __ j(not_equal, &no_rest_parameters, Label::kNear); |
4832 | 4832 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4947 | 4947 |
4948 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 4948 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { |
4949 // ----------- S t a t e ------------- | 4949 // ----------- S t a t e ------------- |
4950 // -- edi : function | 4950 // -- edi : function |
4951 // -- esi : context | 4951 // -- esi : context |
4952 // -- ebp : frame pointer | 4952 // -- ebp : frame pointer |
4953 // -- esp[0] : return address | 4953 // -- esp[0] : return address |
4954 // ----------------------------------- | 4954 // ----------------------------------- |
4955 __ AssertFunction(edi); | 4955 __ AssertFunction(edi); |
4956 | 4956 |
4957 // For Ignition we need to skip all possible handler/stub frames until | 4957 // Make ecx point to the JavaScript frame. |
4958 // we reach the JavaScript frame for the function (similar to what the | 4958 __ mov(ecx, ebp); |
4959 // runtime fallback implementation does). So make ebx point to that | 4959 if (skip_stub_frame()) { |
4960 // JavaScript frame. | 4960 // For Ignition we need to skip the handler/stub frame to reach the |
4961 { | 4961 // JavaScript frame for the function. |
4962 Label loop, loop_entry; | |
4963 __ mov(ecx, ebp); | |
4964 __ jmp(&loop_entry, Label::kNear); | |
4965 __ bind(&loop); | |
4966 __ mov(ecx, Operand(ecx, StandardFrameConstants::kCallerFPOffset)); | 4962 __ mov(ecx, Operand(ecx, StandardFrameConstants::kCallerFPOffset)); |
4967 __ bind(&loop_entry); | 4963 } |
| 4964 if (FLAG_debug_code) { |
| 4965 Label ok; |
4968 __ cmp(edi, Operand(ecx, StandardFrameConstants::kFunctionOffset)); | 4966 __ cmp(edi, Operand(ecx, StandardFrameConstants::kFunctionOffset)); |
4969 __ j(not_equal, &loop); | 4967 __ j(equal, &ok); |
| 4968 __ Abort(kInvalidFrameForFastNewSloppyArgumentsStub); |
| 4969 __ bind(&ok); |
4970 } | 4970 } |
4971 | 4971 |
4972 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. | 4972 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. |
4973 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 4973 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
4974 __ mov(ebx, | 4974 __ mov(ebx, |
4975 FieldOperand(ebx, SharedFunctionInfo::kFormalParameterCountOffset)); | 4975 FieldOperand(ebx, SharedFunctionInfo::kFormalParameterCountOffset)); |
4976 __ lea(edx, Operand(ecx, ebx, times_half_pointer_size, | 4976 __ lea(edx, Operand(ecx, ebx, times_half_pointer_size, |
4977 StandardFrameConstants::kCallerSPOffset)); | 4977 StandardFrameConstants::kCallerSPOffset)); |
4978 | 4978 |
4979 // ebx : number of parameters (tagged) | 4979 // ebx : number of parameters (tagged) |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5203 | 5203 |
5204 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { | 5204 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { |
5205 // ----------- S t a t e ------------- | 5205 // ----------- S t a t e ------------- |
5206 // -- edi : function | 5206 // -- edi : function |
5207 // -- esi : context | 5207 // -- esi : context |
5208 // -- ebp : frame pointer | 5208 // -- ebp : frame pointer |
5209 // -- esp[0] : return address | 5209 // -- esp[0] : return address |
5210 // ----------------------------------- | 5210 // ----------------------------------- |
5211 __ AssertFunction(edi); | 5211 __ AssertFunction(edi); |
5212 | 5212 |
5213 // For Ignition we need to skip all possible handler/stub frames until | 5213 // Make edx point to the JavaScript frame. |
5214 // we reach the JavaScript frame for the function (similar to what the | 5214 __ mov(edx, ebp); |
5215 // runtime fallback implementation does). So make edx point to that | 5215 if (skip_stub_frame()) { |
5216 // JavaScript frame. | 5216 // For Ignition we need to skip the handler/stub frame to reach the |
5217 { | 5217 // JavaScript frame for the function. |
5218 Label loop, loop_entry; | |
5219 __ mov(edx, ebp); | |
5220 __ jmp(&loop_entry, Label::kNear); | |
5221 __ bind(&loop); | |
5222 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 5218 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
5223 __ bind(&loop_entry); | 5219 } |
| 5220 if (FLAG_debug_code) { |
| 5221 Label ok; |
5224 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); | 5222 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); |
5225 __ j(not_equal, &loop); | 5223 __ j(equal, &ok); |
| 5224 __ Abort(kInvalidFrameForFastNewStrictArgumentsStub); |
| 5225 __ bind(&ok); |
5226 } | 5226 } |
5227 | 5227 |
5228 // Check if we have an arguments adaptor frame below the function frame. | 5228 // Check if we have an arguments adaptor frame below the function frame. |
5229 Label arguments_adaptor, arguments_done; | 5229 Label arguments_adaptor, arguments_done; |
5230 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 5230 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
5231 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), | 5231 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), |
5232 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 5232 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
5233 __ j(equal, &arguments_adaptor, Label::kNear); | 5233 __ j(equal, &arguments_adaptor, Label::kNear); |
5234 { | 5234 { |
5235 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 5235 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5845 kStackUnwindSpace, nullptr, return_value_operand, | 5845 kStackUnwindSpace, nullptr, return_value_operand, |
5846 NULL); | 5846 NULL); |
5847 } | 5847 } |
5848 | 5848 |
5849 #undef __ | 5849 #undef __ |
5850 | 5850 |
5851 } // namespace internal | 5851 } // namespace internal |
5852 } // namespace v8 | 5852 } // namespace v8 |
5853 | 5853 |
5854 #endif // V8_TARGET_ARCH_IA32 | 5854 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |