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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 Label not_outermost_js, not_outermost_js_2; | 1713 Label not_outermost_js, not_outermost_js_2; |
1714 | 1714 |
1715 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 1715 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
1716 | 1716 |
1717 // Set up frame. | 1717 // Set up frame. |
1718 __ push(ebp); | 1718 __ push(ebp); |
1719 __ mov(ebp, esp); | 1719 __ mov(ebp, esp); |
1720 | 1720 |
1721 // Push marker in two places. | 1721 // Push marker in two places. |
1722 int marker = type(); | 1722 int marker = type(); |
1723 __ push(Immediate(Smi::FromInt(marker))); // context slot | 1723 __ push(Immediate(Smi::FromInt(marker))); // marker |
1724 __ push(Immediate(Smi::FromInt(marker))); // function slot | 1724 ExternalReference context_address(Isolate::kContextAddress, isolate()); |
| 1725 __ push(Operand::StaticVariable(context_address)); // context |
1725 // Save callee-saved registers (C calling conventions). | 1726 // Save callee-saved registers (C calling conventions). |
1726 __ push(edi); | 1727 __ push(edi); |
1727 __ push(esi); | 1728 __ push(esi); |
1728 __ push(ebx); | 1729 __ push(ebx); |
1729 | 1730 |
1730 // Save copies of the top frame descriptor on the stack. | 1731 // Save copies of the top frame descriptor on the stack. |
1731 ExternalReference c_entry_fp(Isolate::kCEntryFPAddress, isolate()); | 1732 ExternalReference c_entry_fp(Isolate::kCEntryFPAddress, isolate()); |
1732 __ push(Operand::StaticVariable(c_entry_fp)); | 1733 __ push(Operand::StaticVariable(c_entry_fp)); |
1733 | 1734 |
1734 // If this is the outermost JS call, set js_entry_sp value. | 1735 // If this is the outermost JS call, set js_entry_sp value. |
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3378 __ bind(&need_incremental); | 3379 __ bind(&need_incremental); |
3379 | 3380 |
3380 // Fall through when we need to inform the incremental marker. | 3381 // Fall through when we need to inform the incremental marker. |
3381 } | 3382 } |
3382 | 3383 |
3383 | 3384 |
3384 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 3385 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
3385 CEntryStub ces(isolate(), 1, kSaveFPRegs); | 3386 CEntryStub ces(isolate(), 1, kSaveFPRegs); |
3386 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); | 3387 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); |
3387 int parameter_count_offset = | 3388 int parameter_count_offset = |
3388 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 3389 StubFailureTrampolineFrameConstants::kArgumentsLengthOffset; |
3389 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); | 3390 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); |
3390 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 3391 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
3391 __ pop(ecx); | 3392 __ pop(ecx); |
3392 int additional_offset = | 3393 int additional_offset = |
3393 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; | 3394 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; |
3394 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset)); | 3395 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset)); |
3395 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. | 3396 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. |
3396 } | 3397 } |
3397 | 3398 |
3398 | 3399 |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4524 // we reach the JavaScript frame for the function (similar to what the | 4525 // we reach the JavaScript frame for the function (similar to what the |
4525 // runtime fallback implementation does). So make edx point to that | 4526 // runtime fallback implementation does). So make edx point to that |
4526 // JavaScript frame. | 4527 // JavaScript frame. |
4527 { | 4528 { |
4528 Label loop, loop_entry; | 4529 Label loop, loop_entry; |
4529 __ mov(edx, ebp); | 4530 __ mov(edx, ebp); |
4530 __ jmp(&loop_entry, Label::kNear); | 4531 __ jmp(&loop_entry, Label::kNear); |
4531 __ bind(&loop); | 4532 __ bind(&loop); |
4532 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4533 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
4533 __ bind(&loop_entry); | 4534 __ bind(&loop_entry); |
4534 __ cmp(edi, Operand(edx, StandardFrameConstants::kMarkerOffset)); | 4535 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); |
4535 __ j(not_equal, &loop); | 4536 __ j(not_equal, &loop); |
4536 } | 4537 } |
4537 | 4538 |
4538 // Check if we have rest parameters (only possible if we have an | 4539 // Check if we have rest parameters (only possible if we have an |
4539 // arguments adaptor frame below the function frame). | 4540 // arguments adaptor frame below the function frame). |
4540 Label no_rest_parameters; | 4541 Label no_rest_parameters; |
4541 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4542 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
4542 __ cmp(Operand(ebx, StandardFrameConstants::kContextOffset), | 4543 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), |
4543 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4544 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4544 __ j(not_equal, &no_rest_parameters, Label::kNear); | 4545 __ j(not_equal, &no_rest_parameters, Label::kNear); |
4545 | 4546 |
4546 // Check if the arguments adaptor frame contains more arguments than | 4547 // Check if the arguments adaptor frame contains more arguments than |
4547 // specified by the function's internal formal parameter count. | 4548 // specified by the function's internal formal parameter count. |
4548 Label rest_parameters; | 4549 Label rest_parameters; |
4549 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 4550 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
4550 __ mov(eax, Operand(ebx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4551 __ mov(eax, Operand(ebx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
4551 __ sub(eax, | 4552 __ sub(eax, |
4552 FieldOperand(ecx, SharedFunctionInfo::kFormalParameterCountOffset)); | 4553 FieldOperand(ecx, SharedFunctionInfo::kFormalParameterCountOffset)); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4674 StandardFrameConstants::kCallerSPOffset)); | 4675 StandardFrameConstants::kCallerSPOffset)); |
4675 | 4676 |
4676 // ecx : number of parameters (tagged) | 4677 // ecx : number of parameters (tagged) |
4677 // edx : parameters pointer | 4678 // edx : parameters pointer |
4678 // edi : function | 4679 // edi : function |
4679 // esp[0] : return address | 4680 // esp[0] : return address |
4680 | 4681 |
4681 // Check if the calling frame is an arguments adaptor frame. | 4682 // Check if the calling frame is an arguments adaptor frame. |
4682 Label adaptor_frame, try_allocate, runtime; | 4683 Label adaptor_frame, try_allocate, runtime; |
4683 __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 4684 __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
4684 __ mov(eax, Operand(ebx, StandardFrameConstants::kContextOffset)); | 4685 __ mov(eax, Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset)); |
4685 __ cmp(eax, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4686 __ cmp(eax, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4686 __ j(equal, &adaptor_frame, Label::kNear); | 4687 __ j(equal, &adaptor_frame, Label::kNear); |
4687 | 4688 |
4688 // No adaptor, parameter count = argument count. | 4689 // No adaptor, parameter count = argument count. |
4689 __ mov(ebx, ecx); | 4690 __ mov(ebx, ecx); |
4690 __ push(ecx); | 4691 __ push(ecx); |
4691 __ jmp(&try_allocate, Label::kNear); | 4692 __ jmp(&try_allocate, Label::kNear); |
4692 | 4693 |
4693 // We have an adaptor frame. Patch the parameters pointer. | 4694 // We have an adaptor frame. Patch the parameters pointer. |
4694 __ bind(&adaptor_frame); | 4695 __ bind(&adaptor_frame); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4910 // we reach the JavaScript frame for the function (similar to what the | 4911 // we reach the JavaScript frame for the function (similar to what the |
4911 // runtime fallback implementation does). So make edx point to that | 4912 // runtime fallback implementation does). So make edx point to that |
4912 // JavaScript frame. | 4913 // JavaScript frame. |
4913 { | 4914 { |
4914 Label loop, loop_entry; | 4915 Label loop, loop_entry; |
4915 __ mov(edx, ebp); | 4916 __ mov(edx, ebp); |
4916 __ jmp(&loop_entry, Label::kNear); | 4917 __ jmp(&loop_entry, Label::kNear); |
4917 __ bind(&loop); | 4918 __ bind(&loop); |
4918 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4919 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
4919 __ bind(&loop_entry); | 4920 __ bind(&loop_entry); |
4920 __ cmp(edi, Operand(edx, StandardFrameConstants::kMarkerOffset)); | 4921 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); |
4921 __ j(not_equal, &loop); | 4922 __ j(not_equal, &loop); |
4922 } | 4923 } |
4923 | 4924 |
4924 // Check if we have an arguments adaptor frame below the function frame. | 4925 // Check if we have an arguments adaptor frame below the function frame. |
4925 Label arguments_adaptor, arguments_done; | 4926 Label arguments_adaptor, arguments_done; |
4926 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4927 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
4927 __ cmp(Operand(ebx, StandardFrameConstants::kContextOffset), | 4928 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), |
4928 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4929 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4929 __ j(equal, &arguments_adaptor, Label::kNear); | 4930 __ j(equal, &arguments_adaptor, Label::kNear); |
4930 { | 4931 { |
4931 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 4932 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
4932 __ mov(eax, | 4933 __ mov(eax, |
4933 FieldOperand(eax, SharedFunctionInfo::kFormalParameterCountOffset)); | 4934 FieldOperand(eax, SharedFunctionInfo::kFormalParameterCountOffset)); |
4934 __ lea(ebx, | 4935 __ lea(ebx, |
4935 Operand(edx, eax, times_half_pointer_size, | 4936 Operand(edx, eax, times_half_pointer_size, |
4936 StandardFrameConstants::kCallerSPOffset - 1 * kPointerSize)); | 4937 StandardFrameConstants::kCallerSPOffset - 1 * kPointerSize)); |
4937 } | 4938 } |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5560 return_value_operand, NULL); | 5561 return_value_operand, NULL); |
5561 } | 5562 } |
5562 | 5563 |
5563 | 5564 |
5564 #undef __ | 5565 #undef __ |
5565 | 5566 |
5566 } // namespace internal | 5567 } // namespace internal |
5567 } // namespace v8 | 5568 } // namespace v8 |
5568 | 5569 |
5569 #endif // V8_TARGET_ARCH_X87 | 5570 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |