| 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/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 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1985 Label not_outermost_js, not_outermost_js_2; | 1985 Label not_outermost_js, not_outermost_js_2; |
| 1986 | 1986 |
| 1987 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 1987 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
| 1988 | 1988 |
| 1989 // Set up frame. | 1989 // Set up frame. |
| 1990 __ push(ebp); | 1990 __ push(ebp); |
| 1991 __ mov(ebp, esp); | 1991 __ mov(ebp, esp); |
| 1992 | 1992 |
| 1993 // Push marker in two places. | 1993 // Push marker in two places. |
| 1994 int marker = type(); | 1994 int marker = type(); |
| 1995 __ push(Immediate(Smi::FromInt(marker))); // context slot | 1995 __ push(Immediate(Smi::FromInt(marker))); // marker |
| 1996 __ push(Immediate(Smi::FromInt(marker))); // function slot | 1996 ExternalReference context_address(Isolate::kContextAddress, isolate()); |
| 1997 __ push(Operand::StaticVariable(context_address)); // context |
| 1997 // Save callee-saved registers (C calling conventions). | 1998 // Save callee-saved registers (C calling conventions). |
| 1998 __ push(edi); | 1999 __ push(edi); |
| 1999 __ push(esi); | 2000 __ push(esi); |
| 2000 __ push(ebx); | 2001 __ push(ebx); |
| 2001 | 2002 |
| 2002 // Save copies of the top frame descriptor on the stack. | 2003 // Save copies of the top frame descriptor on the stack. |
| 2003 ExternalReference c_entry_fp(Isolate::kCEntryFPAddress, isolate()); | 2004 ExternalReference c_entry_fp(Isolate::kCEntryFPAddress, isolate()); |
| 2004 __ push(Operand::StaticVariable(c_entry_fp)); | 2005 __ push(Operand::StaticVariable(c_entry_fp)); |
| 2005 | 2006 |
| 2006 // If this is the outermost JS call, set js_entry_sp value. | 2007 // If this is the outermost JS call, set js_entry_sp value. |
| (...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3713 __ bind(&need_incremental); | 3714 __ bind(&need_incremental); |
| 3714 | 3715 |
| 3715 // Fall through when we need to inform the incremental marker. | 3716 // Fall through when we need to inform the incremental marker. |
| 3716 } | 3717 } |
| 3717 | 3718 |
| 3718 | 3719 |
| 3719 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 3720 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
| 3720 CEntryStub ces(isolate(), 1, kSaveFPRegs); | 3721 CEntryStub ces(isolate(), 1, kSaveFPRegs); |
| 3721 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); | 3722 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); |
| 3722 int parameter_count_offset = | 3723 int parameter_count_offset = |
| 3723 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 3724 StubFailureTrampolineFrameConstants::kArgumentsLengthOffset; |
| 3724 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); | 3725 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); |
| 3725 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 3726 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 3726 __ pop(ecx); | 3727 __ pop(ecx); |
| 3727 int additional_offset = | 3728 int additional_offset = |
| 3728 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; | 3729 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; |
| 3729 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset)); | 3730 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset)); |
| 3730 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. | 3731 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. |
| 3731 } | 3732 } |
| 3732 | 3733 |
| 3733 | 3734 |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4880 // we reach the JavaScript frame for the function (similar to what the | 4881 // we reach the JavaScript frame for the function (similar to what the |
| 4881 // runtime fallback implementation does). So make edx point to that | 4882 // runtime fallback implementation does). So make edx point to that |
| 4882 // JavaScript frame. | 4883 // JavaScript frame. |
| 4883 { | 4884 { |
| 4884 Label loop, loop_entry; | 4885 Label loop, loop_entry; |
| 4885 __ mov(edx, ebp); | 4886 __ mov(edx, ebp); |
| 4886 __ jmp(&loop_entry, Label::kNear); | 4887 __ jmp(&loop_entry, Label::kNear); |
| 4887 __ bind(&loop); | 4888 __ bind(&loop); |
| 4888 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4889 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
| 4889 __ bind(&loop_entry); | 4890 __ bind(&loop_entry); |
| 4890 __ cmp(edi, Operand(edx, StandardFrameConstants::kMarkerOffset)); | 4891 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); |
| 4891 __ j(not_equal, &loop); | 4892 __ j(not_equal, &loop); |
| 4892 } | 4893 } |
| 4893 | 4894 |
| 4894 // Check if we have rest parameters (only possible if we have an | 4895 // Check if we have rest parameters (only possible if we have an |
| 4895 // arguments adaptor frame below the function frame). | 4896 // arguments adaptor frame below the function frame). |
| 4896 Label no_rest_parameters; | 4897 Label no_rest_parameters; |
| 4897 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4898 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
| 4898 __ cmp(Operand(ebx, StandardFrameConstants::kContextOffset), | 4899 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), |
| 4899 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4900 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 4900 __ j(not_equal, &no_rest_parameters, Label::kNear); | 4901 __ j(not_equal, &no_rest_parameters, Label::kNear); |
| 4901 | 4902 |
| 4902 // Check if the arguments adaptor frame contains more arguments than | 4903 // Check if the arguments adaptor frame contains more arguments than |
| 4903 // specified by the function's internal formal parameter count. | 4904 // specified by the function's internal formal parameter count. |
| 4904 Label rest_parameters; | 4905 Label rest_parameters; |
| 4905 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 4906 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 4906 __ mov(eax, Operand(ebx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4907 __ mov(eax, Operand(ebx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 4907 __ sub(eax, | 4908 __ sub(eax, |
| 4908 FieldOperand(ecx, SharedFunctionInfo::kFormalParameterCountOffset)); | 4909 FieldOperand(ecx, SharedFunctionInfo::kFormalParameterCountOffset)); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5031 StandardFrameConstants::kCallerSPOffset)); | 5032 StandardFrameConstants::kCallerSPOffset)); |
| 5032 | 5033 |
| 5033 // ecx : number of parameters (tagged) | 5034 // ecx : number of parameters (tagged) |
| 5034 // edx : parameters pointer | 5035 // edx : parameters pointer |
| 5035 // edi : function | 5036 // edi : function |
| 5036 // esp[0] : return address | 5037 // esp[0] : return address |
| 5037 | 5038 |
| 5038 // Check if the calling frame is an arguments adaptor frame. | 5039 // Check if the calling frame is an arguments adaptor frame. |
| 5039 Label adaptor_frame, try_allocate, runtime; | 5040 Label adaptor_frame, try_allocate, runtime; |
| 5040 __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 5041 __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 5041 __ mov(eax, Operand(ebx, StandardFrameConstants::kContextOffset)); | 5042 __ mov(eax, Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset)); |
| 5042 __ cmp(eax, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 5043 __ cmp(eax, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 5043 __ j(equal, &adaptor_frame, Label::kNear); | 5044 __ j(equal, &adaptor_frame, Label::kNear); |
| 5044 | 5045 |
| 5045 // No adaptor, parameter count = argument count. | 5046 // No adaptor, parameter count = argument count. |
| 5046 __ mov(ebx, ecx); | 5047 __ mov(ebx, ecx); |
| 5047 __ push(ecx); | 5048 __ push(ecx); |
| 5048 __ jmp(&try_allocate, Label::kNear); | 5049 __ jmp(&try_allocate, Label::kNear); |
| 5049 | 5050 |
| 5050 // We have an adaptor frame. Patch the parameters pointer. | 5051 // We have an adaptor frame. Patch the parameters pointer. |
| 5051 __ bind(&adaptor_frame); | 5052 __ bind(&adaptor_frame); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5268 // we reach the JavaScript frame for the function (similar to what the | 5269 // we reach the JavaScript frame for the function (similar to what the |
| 5269 // runtime fallback implementation does). So make edx point to that | 5270 // runtime fallback implementation does). So make edx point to that |
| 5270 // JavaScript frame. | 5271 // JavaScript frame. |
| 5271 { | 5272 { |
| 5272 Label loop, loop_entry; | 5273 Label loop, loop_entry; |
| 5273 __ mov(edx, ebp); | 5274 __ mov(edx, ebp); |
| 5274 __ jmp(&loop_entry, Label::kNear); | 5275 __ jmp(&loop_entry, Label::kNear); |
| 5275 __ bind(&loop); | 5276 __ bind(&loop); |
| 5276 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 5277 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
| 5277 __ bind(&loop_entry); | 5278 __ bind(&loop_entry); |
| 5278 __ cmp(edi, Operand(edx, StandardFrameConstants::kMarkerOffset)); | 5279 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); |
| 5279 __ j(not_equal, &loop); | 5280 __ j(not_equal, &loop); |
| 5280 } | 5281 } |
| 5281 | 5282 |
| 5282 // Check if we have an arguments adaptor frame below the function frame. | 5283 // Check if we have an arguments adaptor frame below the function frame. |
| 5283 Label arguments_adaptor, arguments_done; | 5284 Label arguments_adaptor, arguments_done; |
| 5284 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 5285 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
| 5285 __ cmp(Operand(ebx, StandardFrameConstants::kContextOffset), | 5286 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), |
| 5286 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 5287 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 5287 __ j(equal, &arguments_adaptor, Label::kNear); | 5288 __ j(equal, &arguments_adaptor, Label::kNear); |
| 5288 { | 5289 { |
| 5289 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 5290 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 5290 __ mov(eax, | 5291 __ mov(eax, |
| 5291 FieldOperand(eax, SharedFunctionInfo::kFormalParameterCountOffset)); | 5292 FieldOperand(eax, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 5292 __ lea(ebx, | 5293 __ lea(ebx, |
| 5293 Operand(edx, eax, times_half_pointer_size, | 5294 Operand(edx, eax, times_half_pointer_size, |
| 5294 StandardFrameConstants::kCallerSPOffset - 1 * kPointerSize)); | 5295 StandardFrameConstants::kCallerSPOffset - 1 * kPointerSize)); |
| 5295 } | 5296 } |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5919 return_value_operand, NULL); | 5920 return_value_operand, NULL); |
| 5920 } | 5921 } |
| 5921 | 5922 |
| 5922 | 5923 |
| 5923 #undef __ | 5924 #undef __ |
| 5924 | 5925 |
| 5925 } // namespace internal | 5926 } // namespace internal |
| 5926 } // namespace v8 | 5927 } // namespace v8 |
| 5927 | 5928 |
| 5928 #endif // V8_TARGET_ARCH_IA32 | 5929 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |