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 4955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4966 | 4966 |
4967 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 4967 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { |
4968 // ----------- S t a t e ------------- | 4968 // ----------- S t a t e ------------- |
4969 // -- edi : function | 4969 // -- edi : function |
4970 // -- esi : context | 4970 // -- esi : context |
4971 // -- ebp : frame pointer | 4971 // -- ebp : frame pointer |
4972 // -- esp[0] : return address | 4972 // -- esp[0] : return address |
4973 // ----------------------------------- | 4973 // ----------------------------------- |
4974 __ AssertFunction(edi); | 4974 __ AssertFunction(edi); |
4975 | 4975 |
| 4976 // For Ignition we need to skip all possible handler/stub frames until |
| 4977 // we reach the JavaScript frame for the function (similar to what the |
| 4978 // runtime fallback implementation does). So make ebx point to that |
| 4979 // JavaScript frame. |
| 4980 { |
| 4981 Label loop, loop_entry; |
| 4982 __ mov(ecx, ebp); |
| 4983 __ jmp(&loop_entry, Label::kNear); |
| 4984 __ bind(&loop); |
| 4985 __ mov(ecx, Operand(ecx, StandardFrameConstants::kCallerFPOffset)); |
| 4986 __ bind(&loop_entry); |
| 4987 __ cmp(edi, Operand(ecx, StandardFrameConstants::kFunctionOffset)); |
| 4988 __ j(not_equal, &loop); |
| 4989 } |
| 4990 |
4976 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. | 4991 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. |
4977 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 4992 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
4978 __ mov(ecx, | 4993 __ mov(ebx, |
4979 FieldOperand(ecx, SharedFunctionInfo::kFormalParameterCountOffset)); | 4994 FieldOperand(ebx, SharedFunctionInfo::kFormalParameterCountOffset)); |
4980 __ lea(edx, Operand(ebp, ecx, times_half_pointer_size, | 4995 __ lea(edx, Operand(ecx, ebx, times_half_pointer_size, |
4981 StandardFrameConstants::kCallerSPOffset)); | 4996 StandardFrameConstants::kCallerSPOffset)); |
4982 | 4997 |
4983 // ecx : number of parameters (tagged) | 4998 // ebx : number of parameters (tagged) |
4984 // edx : parameters pointer | 4999 // edx : parameters pointer |
4985 // edi : function | 5000 // edi : function |
| 5001 // ecx : JavaScript frame pointer. |
4986 // esp[0] : return address | 5002 // esp[0] : return address |
4987 | 5003 |
4988 // Check if the calling frame is an arguments adaptor frame. | 5004 // Check if the calling frame is an arguments adaptor frame. |
4989 Label adaptor_frame, try_allocate, runtime; | 5005 Label adaptor_frame, try_allocate, runtime; |
4990 __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 5006 __ mov(eax, Operand(ecx, StandardFrameConstants::kCallerFPOffset)); |
4991 __ mov(eax, Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset)); | 5007 __ mov(eax, Operand(eax, CommonFrameConstants::kContextOrFrameTypeOffset)); |
4992 __ cmp(eax, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 5008 __ cmp(eax, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4993 __ j(equal, &adaptor_frame, Label::kNear); | 5009 __ j(equal, &adaptor_frame, Label::kNear); |
4994 | 5010 |
4995 // No adaptor, parameter count = argument count. | 5011 // No adaptor, parameter count = argument count. |
4996 __ mov(ebx, ecx); | 5012 __ mov(ecx, ebx); |
4997 __ push(ecx); | 5013 __ push(ebx); |
4998 __ jmp(&try_allocate, Label::kNear); | 5014 __ jmp(&try_allocate, Label::kNear); |
4999 | 5015 |
5000 // We have an adaptor frame. Patch the parameters pointer. | 5016 // We have an adaptor frame. Patch the parameters pointer. |
5001 __ bind(&adaptor_frame); | 5017 __ bind(&adaptor_frame); |
5002 __ mov(ebx, ecx); | 5018 __ push(ebx); |
5003 __ push(ecx); | 5019 __ mov(edx, Operand(ecx, StandardFrameConstants::kCallerFPOffset)); |
5004 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | |
5005 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 5020 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
5006 __ lea(edx, Operand(edx, ecx, times_2, | 5021 __ lea(edx, Operand(edx, ecx, times_2, |
5007 StandardFrameConstants::kCallerSPOffset)); | 5022 StandardFrameConstants::kCallerSPOffset)); |
5008 | 5023 |
5009 // ebx = parameter count (tagged) | 5024 // ebx = parameter count (tagged) |
5010 // ecx = argument count (smi-tagged) | 5025 // ecx = argument count (smi-tagged) |
5011 // Compute the mapped parameter count = min(ebx, ecx) in ebx. | 5026 // Compute the mapped parameter count = min(ebx, ecx) in ebx. |
5012 __ cmp(ebx, ecx); | 5027 __ cmp(ebx, ecx); |
5013 __ j(less_equal, &try_allocate, Label::kNear); | 5028 __ j(less_equal, &try_allocate, Label::kNear); |
5014 __ mov(ebx, ecx); | 5029 __ mov(ebx, ecx); |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5846 kStackUnwindSpace, nullptr, return_value_operand, | 5861 kStackUnwindSpace, nullptr, return_value_operand, |
5847 NULL); | 5862 NULL); |
5848 } | 5863 } |
5849 | 5864 |
5850 #undef __ | 5865 #undef __ |
5851 | 5866 |
5852 } // namespace internal | 5867 } // namespace internal |
5853 } // namespace v8 | 5868 } // namespace v8 |
5854 | 5869 |
5855 #endif // V8_TARGET_ARCH_IA32 | 5870 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |