| 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 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1988 Label not_outermost_js, not_outermost_js_2; | 1988 Label not_outermost_js, not_outermost_js_2; |
| 1989 | 1989 |
| 1990 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 1990 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
| 1991 | 1991 |
| 1992 // Set up frame. | 1992 // Set up frame. |
| 1993 __ push(ebp); | 1993 __ push(ebp); |
| 1994 __ mov(ebp, esp); | 1994 __ mov(ebp, esp); |
| 1995 | 1995 |
| 1996 // Push marker in two places. | 1996 // Push marker in two places. |
| 1997 int marker = type(); | 1997 int marker = type(); |
| 1998 __ push(Immediate(Smi::FromInt(marker))); // context slot | 1998 __ push(Immediate(Smi::FromInt(marker))); // marker |
| 1999 __ push(Immediate(Smi::FromInt(marker))); // function slot | 1999 ExternalReference context_address(Isolate::kContextAddress, isolate()); |
| 2000 __ push(Operand::StaticVariable(context_address)); // context |
| 2000 // Save callee-saved registers (C calling conventions). | 2001 // Save callee-saved registers (C calling conventions). |
| 2001 __ push(edi); | 2002 __ push(edi); |
| 2002 __ push(esi); | 2003 __ push(esi); |
| 2003 __ push(ebx); | 2004 __ push(ebx); |
| 2004 | 2005 |
| 2005 // Save copies of the top frame descriptor on the stack. | 2006 // Save copies of the top frame descriptor on the stack. |
| 2006 ExternalReference c_entry_fp(Isolate::kCEntryFPAddress, isolate()); | 2007 ExternalReference c_entry_fp(Isolate::kCEntryFPAddress, isolate()); |
| 2007 __ push(Operand::StaticVariable(c_entry_fp)); | 2008 __ push(Operand::StaticVariable(c_entry_fp)); |
| 2008 | 2009 |
| 2009 // If this is the outermost JS call, set js_entry_sp value. | 2010 // If this is the outermost JS call, set js_entry_sp value. |
| (...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3685 __ bind(&need_incremental); | 3686 __ bind(&need_incremental); |
| 3686 | 3687 |
| 3687 // Fall through when we need to inform the incremental marker. | 3688 // Fall through when we need to inform the incremental marker. |
| 3688 } | 3689 } |
| 3689 | 3690 |
| 3690 | 3691 |
| 3691 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 3692 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
| 3692 CEntryStub ces(isolate(), 1, kSaveFPRegs); | 3693 CEntryStub ces(isolate(), 1, kSaveFPRegs); |
| 3693 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); | 3694 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); |
| 3694 int parameter_count_offset = | 3695 int parameter_count_offset = |
| 3695 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 3696 StubFailureTrampolineFrameConstants::kArgumentsLengthOffset; |
| 3696 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); | 3697 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); |
| 3697 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 3698 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 3698 __ pop(ecx); | 3699 __ pop(ecx); |
| 3699 int additional_offset = | 3700 int additional_offset = |
| 3700 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; | 3701 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; |
| 3701 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset)); | 3702 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset)); |
| 3702 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. | 3703 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. |
| 3703 } | 3704 } |
| 3704 | 3705 |
| 3705 | 3706 |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4852 // we reach the JavaScript frame for the function (similar to what the | 4853 // we reach the JavaScript frame for the function (similar to what the |
| 4853 // runtime fallback implementation does). So make edx point to that | 4854 // runtime fallback implementation does). So make edx point to that |
| 4854 // JavaScript frame. | 4855 // JavaScript frame. |
| 4855 { | 4856 { |
| 4856 Label loop, loop_entry; | 4857 Label loop, loop_entry; |
| 4857 __ mov(edx, ebp); | 4858 __ mov(edx, ebp); |
| 4858 __ jmp(&loop_entry, Label::kNear); | 4859 __ jmp(&loop_entry, Label::kNear); |
| 4859 __ bind(&loop); | 4860 __ bind(&loop); |
| 4860 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4861 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
| 4861 __ bind(&loop_entry); | 4862 __ bind(&loop_entry); |
| 4862 __ cmp(edi, Operand(edx, StandardFrameConstants::kMarkerOffset)); | 4863 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); |
| 4863 __ j(not_equal, &loop); | 4864 __ j(not_equal, &loop); |
| 4864 } | 4865 } |
| 4865 | 4866 |
| 4866 // Check if we have rest parameters (only possible if we have an | 4867 // Check if we have rest parameters (only possible if we have an |
| 4867 // arguments adaptor frame below the function frame). | 4868 // arguments adaptor frame below the function frame). |
| 4868 Label no_rest_parameters; | 4869 Label no_rest_parameters; |
| 4869 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4870 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
| 4870 __ cmp(Operand(ebx, StandardFrameConstants::kContextOffset), | 4871 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), |
| 4871 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4872 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 4872 __ j(not_equal, &no_rest_parameters, Label::kNear); | 4873 __ j(not_equal, &no_rest_parameters, Label::kNear); |
| 4873 | 4874 |
| 4874 // Check if the arguments adaptor frame contains more arguments than | 4875 // Check if the arguments adaptor frame contains more arguments than |
| 4875 // specified by the function's internal formal parameter count. | 4876 // specified by the function's internal formal parameter count. |
| 4876 Label rest_parameters; | 4877 Label rest_parameters; |
| 4877 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 4878 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 4878 __ mov(eax, Operand(ebx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4879 __ mov(eax, Operand(ebx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 4879 __ sub(eax, | 4880 __ sub(eax, |
| 4880 FieldOperand(ecx, SharedFunctionInfo::kFormalParameterCountOffset)); | 4881 FieldOperand(ecx, SharedFunctionInfo::kFormalParameterCountOffset)); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5003 StandardFrameConstants::kCallerSPOffset)); | 5004 StandardFrameConstants::kCallerSPOffset)); |
| 5004 | 5005 |
| 5005 // ecx : number of parameters (tagged) | 5006 // ecx : number of parameters (tagged) |
| 5006 // edx : parameters pointer | 5007 // edx : parameters pointer |
| 5007 // edi : function | 5008 // edi : function |
| 5008 // esp[0] : return address | 5009 // esp[0] : return address |
| 5009 | 5010 |
| 5010 // Check if the calling frame is an arguments adaptor frame. | 5011 // Check if the calling frame is an arguments adaptor frame. |
| 5011 Label adaptor_frame, try_allocate, runtime; | 5012 Label adaptor_frame, try_allocate, runtime; |
| 5012 __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 5013 __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 5013 __ mov(eax, Operand(ebx, StandardFrameConstants::kContextOffset)); | 5014 __ mov(eax, Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset)); |
| 5014 __ cmp(eax, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 5015 __ cmp(eax, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 5015 __ j(equal, &adaptor_frame, Label::kNear); | 5016 __ j(equal, &adaptor_frame, Label::kNear); |
| 5016 | 5017 |
| 5017 // No adaptor, parameter count = argument count. | 5018 // No adaptor, parameter count = argument count. |
| 5018 __ mov(ebx, ecx); | 5019 __ mov(ebx, ecx); |
| 5019 __ push(ecx); | 5020 __ push(ecx); |
| 5020 __ jmp(&try_allocate, Label::kNear); | 5021 __ jmp(&try_allocate, Label::kNear); |
| 5021 | 5022 |
| 5022 // We have an adaptor frame. Patch the parameters pointer. | 5023 // We have an adaptor frame. Patch the parameters pointer. |
| 5023 __ bind(&adaptor_frame); | 5024 __ bind(&adaptor_frame); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5240 // we reach the JavaScript frame for the function (similar to what the | 5241 // we reach the JavaScript frame for the function (similar to what the |
| 5241 // runtime fallback implementation does). So make edx point to that | 5242 // runtime fallback implementation does). So make edx point to that |
| 5242 // JavaScript frame. | 5243 // JavaScript frame. |
| 5243 { | 5244 { |
| 5244 Label loop, loop_entry; | 5245 Label loop, loop_entry; |
| 5245 __ mov(edx, ebp); | 5246 __ mov(edx, ebp); |
| 5246 __ jmp(&loop_entry, Label::kNear); | 5247 __ jmp(&loop_entry, Label::kNear); |
| 5247 __ bind(&loop); | 5248 __ bind(&loop); |
| 5248 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 5249 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
| 5249 __ bind(&loop_entry); | 5250 __ bind(&loop_entry); |
| 5250 __ cmp(edi, Operand(edx, StandardFrameConstants::kMarkerOffset)); | 5251 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); |
| 5251 __ j(not_equal, &loop); | 5252 __ j(not_equal, &loop); |
| 5252 } | 5253 } |
| 5253 | 5254 |
| 5254 // Check if we have an arguments adaptor frame below the function frame. | 5255 // Check if we have an arguments adaptor frame below the function frame. |
| 5255 Label arguments_adaptor, arguments_done; | 5256 Label arguments_adaptor, arguments_done; |
| 5256 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 5257 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
| 5257 __ cmp(Operand(ebx, StandardFrameConstants::kContextOffset), | 5258 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), |
| 5258 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 5259 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 5259 __ j(equal, &arguments_adaptor, Label::kNear); | 5260 __ j(equal, &arguments_adaptor, Label::kNear); |
| 5260 { | 5261 { |
| 5261 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 5262 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 5262 __ mov(eax, | 5263 __ mov(eax, |
| 5263 FieldOperand(eax, SharedFunctionInfo::kFormalParameterCountOffset)); | 5264 FieldOperand(eax, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 5264 __ lea(ebx, | 5265 __ lea(ebx, |
| 5265 Operand(edx, eax, times_half_pointer_size, | 5266 Operand(edx, eax, times_half_pointer_size, |
| 5266 StandardFrameConstants::kCallerSPOffset - 1 * kPointerSize)); | 5267 StandardFrameConstants::kCallerSPOffset - 1 * kPointerSize)); |
| 5267 } | 5268 } |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5891 return_value_operand, NULL); | 5892 return_value_operand, NULL); |
| 5892 } | 5893 } |
| 5893 | 5894 |
| 5894 | 5895 |
| 5895 #undef __ | 5896 #undef __ |
| 5896 | 5897 |
| 5897 } // namespace internal | 5898 } // namespace internal |
| 5898 } // namespace v8 | 5899 } // namespace v8 |
| 5899 | 5900 |
| 5900 #endif // V8_TARGET_ARCH_IA32 | 5901 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |