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/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 4460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4471 | 4471 |
4472 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { | 4472 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
4473 // ----------- S t a t e ------------- | 4473 // ----------- S t a t e ------------- |
4474 // -- edi : function | 4474 // -- edi : function |
4475 // -- esi : context | 4475 // -- esi : context |
4476 // -- ebp : frame pointer | 4476 // -- ebp : frame pointer |
4477 // -- esp[0] : return address | 4477 // -- esp[0] : return address |
4478 // ----------------------------------- | 4478 // ----------------------------------- |
4479 __ AssertFunction(edi); | 4479 __ AssertFunction(edi); |
4480 | 4480 |
4481 // For Ignition we need to skip all possible handler/stub frames until | 4481 // Make edx point to the JavaScript frame. |
4482 // we reach the JavaScript frame for the function (similar to what the | 4482 __ mov(edx, ebp); |
4483 // runtime fallback implementation does). So make edx point to that | 4483 if (skip_stub_frame()) { |
4484 // JavaScript frame. | 4484 // For Ignition we need to skip the handler/stub frame to reach the |
4485 { | 4485 // JavaScript frame for the function. |
4486 Label loop, loop_entry; | |
4487 __ mov(edx, ebp); | |
4488 __ jmp(&loop_entry, Label::kNear); | |
4489 __ bind(&loop); | |
4490 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4486 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
4491 __ bind(&loop_entry); | 4487 } |
| 4488 if (FLAG_debug_code) { |
| 4489 Label ok; |
4492 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); | 4490 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); |
4493 __ j(not_equal, &loop); | 4491 __ j(equal, &ok); |
| 4492 __ Abort(kInvalidFrameForFastNewRestArgumentsStub); |
| 4493 __ bind(&ok); |
4494 } | 4494 } |
4495 | 4495 |
4496 // Check if we have rest parameters (only possible if we have an | 4496 // Check if we have rest parameters (only possible if we have an |
4497 // arguments adaptor frame below the function frame). | 4497 // arguments adaptor frame below the function frame). |
4498 Label no_rest_parameters; | 4498 Label no_rest_parameters; |
4499 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4499 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
4500 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), | 4500 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), |
4501 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4501 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4502 __ j(not_equal, &no_rest_parameters, Label::kNear); | 4502 __ j(not_equal, &no_rest_parameters, Label::kNear); |
4503 | 4503 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4617 | 4617 |
4618 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { | 4618 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { |
4619 // ----------- S t a t e ------------- | 4619 // ----------- S t a t e ------------- |
4620 // -- edi : function | 4620 // -- edi : function |
4621 // -- esi : context | 4621 // -- esi : context |
4622 // -- ebp : frame pointer | 4622 // -- ebp : frame pointer |
4623 // -- esp[0] : return address | 4623 // -- esp[0] : return address |
4624 // ----------------------------------- | 4624 // ----------------------------------- |
4625 __ AssertFunction(edi); | 4625 __ AssertFunction(edi); |
4626 | 4626 |
4627 // For Ignition we need to skip all possible handler/stub frames until | 4627 // Make ecx point to the JavaScript frame. |
4628 // we reach the JavaScript frame for the function (similar to what the | 4628 __ mov(ecx, ebp); |
4629 // runtime fallback implementation does). So make ebx point to that | 4629 if (skip_stub_frame()) { |
4630 // JavaScript frame. | 4630 // For Ignition we need to skip the handler/stub frame to reach the |
4631 { | 4631 // JavaScript frame for the function. |
4632 Label loop, loop_entry; | |
4633 __ mov(ecx, ebp); | |
4634 __ jmp(&loop_entry, Label::kNear); | |
4635 __ bind(&loop); | |
4636 __ mov(ecx, Operand(ecx, StandardFrameConstants::kCallerFPOffset)); | 4632 __ mov(ecx, Operand(ecx, StandardFrameConstants::kCallerFPOffset)); |
4637 __ bind(&loop_entry); | 4633 } |
| 4634 if (FLAG_debug_code) { |
| 4635 Label ok; |
4638 __ cmp(edi, Operand(ecx, StandardFrameConstants::kFunctionOffset)); | 4636 __ cmp(edi, Operand(ecx, StandardFrameConstants::kFunctionOffset)); |
4639 __ j(not_equal, &loop); | 4637 __ j(equal, &ok); |
| 4638 __ Abort(kInvalidFrameForFastNewSloppyArgumentsStub); |
| 4639 __ bind(&ok); |
4640 } | 4640 } |
4641 | 4641 |
4642 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. | 4642 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. |
4643 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 4643 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
4644 __ mov(ebx, | 4644 __ mov(ebx, |
4645 FieldOperand(ebx, SharedFunctionInfo::kFormalParameterCountOffset)); | 4645 FieldOperand(ebx, SharedFunctionInfo::kFormalParameterCountOffset)); |
4646 __ lea(edx, Operand(ecx, ebx, times_half_pointer_size, | 4646 __ lea(edx, Operand(ecx, ebx, times_half_pointer_size, |
4647 StandardFrameConstants::kCallerSPOffset)); | 4647 StandardFrameConstants::kCallerSPOffset)); |
4648 | 4648 |
4649 // ebx : number of parameters (tagged) | 4649 // ebx : number of parameters (tagged) |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4872 | 4872 |
4873 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { | 4873 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { |
4874 // ----------- S t a t e ------------- | 4874 // ----------- S t a t e ------------- |
4875 // -- edi : function | 4875 // -- edi : function |
4876 // -- esi : context | 4876 // -- esi : context |
4877 // -- ebp : frame pointer | 4877 // -- ebp : frame pointer |
4878 // -- esp[0] : return address | 4878 // -- esp[0] : return address |
4879 // ----------------------------------- | 4879 // ----------------------------------- |
4880 __ AssertFunction(edi); | 4880 __ AssertFunction(edi); |
4881 | 4881 |
4882 // For Ignition we need to skip all possible handler/stub frames until | 4882 // Make edx point to the JavaScript frame. |
4883 // we reach the JavaScript frame for the function (similar to what the | 4883 __ mov(edx, ebp); |
4884 // runtime fallback implementation does). So make edx point to that | 4884 if (skip_stub_frame()) { |
4885 // JavaScript frame. | 4885 // For Ignition we need to skip the handler/stub frame to reach the |
4886 { | 4886 // JavaScript frame for the function. |
4887 Label loop, loop_entry; | |
4888 __ mov(edx, ebp); | |
4889 __ jmp(&loop_entry, Label::kNear); | |
4890 __ bind(&loop); | |
4891 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4887 __ mov(edx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
4892 __ bind(&loop_entry); | 4888 } |
| 4889 if (FLAG_debug_code) { |
| 4890 Label ok; |
4893 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); | 4891 __ cmp(edi, Operand(edx, StandardFrameConstants::kFunctionOffset)); |
4894 __ j(not_equal, &loop); | 4892 __ j(equal, &ok); |
| 4893 __ Abort(kInvalidFrameForFastNewStrictArgumentsStub); |
| 4894 __ bind(&ok); |
4895 } | 4895 } |
4896 | 4896 |
4897 // Check if we have an arguments adaptor frame below the function frame. | 4897 // Check if we have an arguments adaptor frame below the function frame. |
4898 Label arguments_adaptor, arguments_done; | 4898 Label arguments_adaptor, arguments_done; |
4899 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); | 4899 __ mov(ebx, Operand(edx, StandardFrameConstants::kCallerFPOffset)); |
4900 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), | 4900 __ cmp(Operand(ebx, CommonFrameConstants::kContextOrFrameTypeOffset), |
4901 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4901 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4902 __ j(equal, &arguments_adaptor, Label::kNear); | 4902 __ j(equal, &arguments_adaptor, Label::kNear); |
4903 { | 4903 { |
4904 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 4904 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5513 kStackUnwindSpace, nullptr, return_value_operand, | 5513 kStackUnwindSpace, nullptr, return_value_operand, |
5514 NULL); | 5514 NULL); |
5515 } | 5515 } |
5516 | 5516 |
5517 #undef __ | 5517 #undef __ |
5518 | 5518 |
5519 } // namespace internal | 5519 } // namespace internal |
5520 } // namespace v8 | 5520 } // namespace v8 |
5521 | 5521 |
5522 #endif // V8_TARGET_ARCH_X87 | 5522 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |