Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 1949023003: [Interpreter] Fix incorrect frame walking in arguments create stubs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add ports Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | test/cctest/cctest.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_X64 5 #if V8_TARGET_ARCH_X64
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/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 4520 matching lines...) Expand 10 before | Expand all | Expand 10 after
4531 4531
4532 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { 4532 void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
4533 // ----------- S t a t e ------------- 4533 // ----------- S t a t e -------------
4534 // -- rdi : function 4534 // -- rdi : function
4535 // -- rsi : context 4535 // -- rsi : context
4536 // -- rbp : frame pointer 4536 // -- rbp : frame pointer
4537 // -- rsp[0] : return address 4537 // -- rsp[0] : return address
4538 // ----------------------------------- 4538 // -----------------------------------
4539 __ AssertFunction(rdi); 4539 __ AssertFunction(rdi);
4540 4540
4541 // For Ignition we need to skip all possible handler/stub frames until 4541 // Make rdx point to the JavaScript frame.
4542 // we reach the JavaScript frame for the function (similar to what the 4542 __ movp(rdx, rbp);
4543 // runtime fallback implementation does). So make rdx point to that 4543 if (skip_stub_frame()) {
4544 // JavaScript frame. 4544 // For Ignition we need to skip the handler/stub frame to reach the
4545 { 4545 // JavaScript frame for the function.
4546 Label loop, loop_entry;
4547 __ movp(rdx, rbp);
4548 __ jmp(&loop_entry, Label::kNear);
4549 __ bind(&loop);
4550 __ movp(rdx, Operand(rdx, StandardFrameConstants::kCallerFPOffset)); 4546 __ movp(rdx, Operand(rdx, StandardFrameConstants::kCallerFPOffset));
4551 __ bind(&loop_entry); 4547 }
4548 if (FLAG_debug_code) {
4549 Label ok;
4552 __ cmpp(rdi, Operand(rdx, StandardFrameConstants::kFunctionOffset)); 4550 __ cmpp(rdi, Operand(rdx, StandardFrameConstants::kFunctionOffset));
4553 __ j(not_equal, &loop); 4551 __ j(equal, &ok);
4552 __ Abort(kInvalidFrameForFastNewRestArgumentsStub);
4553 __ bind(&ok);
4554 } 4554 }
4555 4555
4556 // Check if we have rest parameters (only possible if we have an 4556 // Check if we have rest parameters (only possible if we have an
4557 // arguments adaptor frame below the function frame). 4557 // arguments adaptor frame below the function frame).
4558 Label no_rest_parameters; 4558 Label no_rest_parameters;
4559 __ movp(rbx, Operand(rdx, StandardFrameConstants::kCallerFPOffset)); 4559 __ movp(rbx, Operand(rdx, StandardFrameConstants::kCallerFPOffset));
4560 __ Cmp(Operand(rbx, CommonFrameConstants::kContextOrFrameTypeOffset), 4560 __ Cmp(Operand(rbx, CommonFrameConstants::kContextOrFrameTypeOffset),
4561 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 4561 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
4562 __ j(not_equal, &no_rest_parameters, Label::kNear); 4562 __ j(not_equal, &no_rest_parameters, Label::kNear);
4563 4563
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
4683 4683
4684 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { 4684 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
4685 // ----------- S t a t e ------------- 4685 // ----------- S t a t e -------------
4686 // -- rdi : function 4686 // -- rdi : function
4687 // -- rsi : context 4687 // -- rsi : context
4688 // -- rbp : frame pointer 4688 // -- rbp : frame pointer
4689 // -- rsp[0] : return address 4689 // -- rsp[0] : return address
4690 // ----------------------------------- 4690 // -----------------------------------
4691 __ AssertFunction(rdi); 4691 __ AssertFunction(rdi);
4692 4692
4693 // For Ignition we need to skip all possible handler/stub frames until 4693 // Make r9 point to the JavaScript frame.
4694 // we reach the JavaScript frame for the function (similar to what the 4694 __ movp(r9, rbp);
4695 // runtime fallback implementation does). So make r9 point to that 4695 if (skip_stub_frame()) {
4696 // JavaScript frame. 4696 // For Ignition we need to skip the handler/stub frame to reach the
4697 { 4697 // JavaScript frame for the function.
4698 Label loop, loop_entry;
4699 __ movp(r9, rbp);
4700 __ jmp(&loop_entry, Label::kNear);
4701 __ bind(&loop);
4702 __ movp(r9, Operand(r9, StandardFrameConstants::kCallerFPOffset)); 4698 __ movp(r9, Operand(r9, StandardFrameConstants::kCallerFPOffset));
4703 __ bind(&loop_entry); 4699 }
4700 if (FLAG_debug_code) {
4701 Label ok;
4704 __ cmpp(rdi, Operand(r9, StandardFrameConstants::kFunctionOffset)); 4702 __ cmpp(rdi, Operand(r9, StandardFrameConstants::kFunctionOffset));
4705 __ j(not_equal, &loop); 4703 __ j(equal, &ok);
4704 __ Abort(kInvalidFrameForFastNewRestArgumentsStub);
4705 __ bind(&ok);
4706 } 4706 }
4707 4707
4708 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. 4708 // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub.
4709 __ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); 4709 __ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
4710 __ LoadSharedFunctionInfoSpecialField( 4710 __ LoadSharedFunctionInfoSpecialField(
4711 rcx, rcx, SharedFunctionInfo::kFormalParameterCountOffset); 4711 rcx, rcx, SharedFunctionInfo::kFormalParameterCountOffset);
4712 __ leap(rdx, Operand(r9, rcx, times_pointer_size, 4712 __ leap(rdx, Operand(r9, rcx, times_pointer_size,
4713 StandardFrameConstants::kCallerSPOffset)); 4713 StandardFrameConstants::kCallerSPOffset));
4714 __ Integer32ToSmi(rcx, rcx); 4714 __ Integer32ToSmi(rcx, rcx);
4715 4715
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
4917 4917
4918 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { 4918 void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) {
4919 // ----------- S t a t e ------------- 4919 // ----------- S t a t e -------------
4920 // -- rdi : function 4920 // -- rdi : function
4921 // -- rsi : context 4921 // -- rsi : context
4922 // -- rbp : frame pointer 4922 // -- rbp : frame pointer
4923 // -- rsp[0] : return address 4923 // -- rsp[0] : return address
4924 // ----------------------------------- 4924 // -----------------------------------
4925 __ AssertFunction(rdi); 4925 __ AssertFunction(rdi);
4926 4926
4927 // For Ignition we need to skip all possible handler/stub frames until 4927 // Make rdx point to the JavaScript frame.
4928 // we reach the JavaScript frame for the function (similar to what the 4928 __ movp(rdx, rbp);
4929 // runtime fallback implementation does). So make rdx point to that 4929 if (skip_stub_frame()) {
4930 // JavaScript frame. 4930 // For Ignition we need to skip the handler/stub frame to reach the
4931 { 4931 // JavaScript frame for the function.
4932 Label loop, loop_entry;
4933 __ movp(rdx, rbp);
4934 __ jmp(&loop_entry, Label::kNear);
4935 __ bind(&loop);
4936 __ movp(rdx, Operand(rdx, StandardFrameConstants::kCallerFPOffset)); 4932 __ movp(rdx, Operand(rdx, StandardFrameConstants::kCallerFPOffset));
4937 __ bind(&loop_entry); 4933 }
4934 if (FLAG_debug_code) {
4935 Label ok;
4938 __ cmpp(rdi, Operand(rdx, StandardFrameConstants::kFunctionOffset)); 4936 __ cmpp(rdi, Operand(rdx, StandardFrameConstants::kFunctionOffset));
4939 __ j(not_equal, &loop); 4937 __ j(equal, &ok);
4938 __ Abort(kInvalidFrameForFastNewRestArgumentsStub);
4939 __ bind(&ok);
4940 } 4940 }
4941 4941
4942 // Check if we have an arguments adaptor frame below the function frame. 4942 // Check if we have an arguments adaptor frame below the function frame.
4943 Label arguments_adaptor, arguments_done; 4943 Label arguments_adaptor, arguments_done;
4944 __ movp(rbx, Operand(rdx, StandardFrameConstants::kCallerFPOffset)); 4944 __ movp(rbx, Operand(rdx, StandardFrameConstants::kCallerFPOffset));
4945 __ Cmp(Operand(rbx, CommonFrameConstants::kContextOrFrameTypeOffset), 4945 __ Cmp(Operand(rbx, CommonFrameConstants::kContextOrFrameTypeOffset),
4946 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 4946 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
4947 __ j(equal, &arguments_adaptor, Label::kNear); 4947 __ j(equal, &arguments_adaptor, Label::kNear);
4948 { 4948 {
4949 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); 4949 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
5570 kStackUnwindSpace, nullptr, return_value_operand, 5570 kStackUnwindSpace, nullptr, return_value_operand,
5571 NULL); 5571 NULL);
5572 } 5572 }
5573 5573
5574 #undef __ 5574 #undef __
5575 5575
5576 } // namespace internal 5576 } // namespace internal
5577 } // namespace v8 5577 } // namespace v8
5578 5578
5579 #endif // V8_TARGET_ARCH_X64 5579 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698