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

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

Issue 1696043002: [runtime] Unify and simplify how frames are marked (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix merge problems Created 4 years, 9 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
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/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 Label not_outermost_js, not_outermost_js_2; 1884 Label not_outermost_js, not_outermost_js_2;
1885 1885
1886 ProfileEntryHookStub::MaybeCallEntryHook(masm); 1886 ProfileEntryHookStub::MaybeCallEntryHook(masm);
1887 1887
1888 { // NOLINT. Scope block confuses linter. 1888 { // NOLINT. Scope block confuses linter.
1889 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); 1889 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm);
1890 // Set up frame. 1890 // Set up frame.
1891 __ pushq(rbp); 1891 __ pushq(rbp);
1892 __ movp(rbp, rsp); 1892 __ movp(rbp, rsp);
1893 1893
1894 // Push the stack frame type marker twice. 1894 // Push the stack frame type.
1895 int marker = type(); 1895 int marker = type();
1896 // Scratch register is neither callee-save, nor an argument register on any 1896 __ Push(Smi::FromInt(marker)); // context slot
1897 // platform. It's free to use at this point. 1897 ExternalReference context_address(Isolate::kContextAddress, isolate());
1898 // Cannot use smi-register for loading yet. 1898 __ Load(kScratchRegister, context_address);
1899 __ Move(kScratchRegister, Smi::FromInt(marker), Assembler::RelocInfoNone()); 1899 __ Push(kScratchRegister); // context
1900 __ Push(kScratchRegister); // context slot
1901 __ Push(kScratchRegister); // function slot
1902 // Save callee-saved registers (X64/X32/Win64 calling conventions). 1900 // Save callee-saved registers (X64/X32/Win64 calling conventions).
1903 __ pushq(r12); 1901 __ pushq(r12);
1904 __ pushq(r13); 1902 __ pushq(r13);
1905 __ pushq(r14); 1903 __ pushq(r14);
1906 __ pushq(r15); 1904 __ pushq(r15);
1907 #ifdef _WIN64 1905 #ifdef _WIN64
1908 __ pushq(rdi); // Only callee save in Win64 ABI, argument in AMD64 ABI. 1906 __ pushq(rdi); // Only callee save in Win64 ABI, argument in AMD64 ABI.
1909 __ pushq(rsi); // Only callee save in Win64 ABI, argument in AMD64 ABI. 1907 __ pushq(rsi); // Only callee save in Win64 ABI, argument in AMD64 ABI.
1910 #endif 1908 #endif
1911 __ pushq(rbx); 1909 __ pushq(rbx);
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
3617 __ bind(&need_incremental); 3615 __ bind(&need_incremental);
3618 3616
3619 // Fall through when we need to inform the incremental marker. 3617 // Fall through when we need to inform the incremental marker.
3620 } 3618 }
3621 3619
3622 3620
3623 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { 3621 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) {
3624 CEntryStub ces(isolate(), 1, kSaveFPRegs); 3622 CEntryStub ces(isolate(), 1, kSaveFPRegs);
3625 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET); 3623 __ Call(ces.GetCode(), RelocInfo::CODE_TARGET);
3626 int parameter_count_offset = 3624 int parameter_count_offset =
3627 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; 3625 StubFailureTrampolineFrameConstants::kArgumentsLengthOffset;
3628 __ movp(rbx, MemOperand(rbp, parameter_count_offset)); 3626 __ movp(rbx, MemOperand(rbp, parameter_count_offset));
3629 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); 3627 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
3630 __ PopReturnAddressTo(rcx); 3628 __ PopReturnAddressTo(rcx);
3631 int additional_offset = 3629 int additional_offset =
3632 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; 3630 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0;
3633 __ leap(rsp, MemOperand(rsp, rbx, times_pointer_size, additional_offset)); 3631 __ leap(rsp, MemOperand(rsp, rbx, times_pointer_size, additional_offset));
3634 __ jmp(rcx); // Return to IC Miss stub, continuation still on stack. 3632 __ jmp(rcx); // Return to IC Miss stub, continuation still on stack.
3635 } 3633 }
3636 3634
3637 3635
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
4586 // we reach the JavaScript frame for the function (similar to what the 4584 // we reach the JavaScript frame for the function (similar to what the
4587 // runtime fallback implementation does). So make rdx point to that 4585 // runtime fallback implementation does). So make rdx point to that
4588 // JavaScript frame. 4586 // JavaScript frame.
4589 { 4587 {
4590 Label loop, loop_entry; 4588 Label loop, loop_entry;
4591 __ movp(rdx, rbp); 4589 __ movp(rdx, rbp);
4592 __ jmp(&loop_entry, Label::kNear); 4590 __ jmp(&loop_entry, Label::kNear);
4593 __ bind(&loop); 4591 __ bind(&loop);
4594 __ movp(rdx, Operand(rdx, StandardFrameConstants::kCallerFPOffset)); 4592 __ movp(rdx, Operand(rdx, StandardFrameConstants::kCallerFPOffset));
4595 __ bind(&loop_entry); 4593 __ bind(&loop_entry);
4596 __ cmpp(rdi, Operand(rdx, StandardFrameConstants::kMarkerOffset)); 4594 __ cmpp(rdi, Operand(rdx, StandardFrameConstants::kFunctionOffset));
4597 __ j(not_equal, &loop); 4595 __ j(not_equal, &loop);
4598 } 4596 }
4599 4597
4600 // Check if we have rest parameters (only possible if we have an 4598 // Check if we have rest parameters (only possible if we have an
4601 // arguments adaptor frame below the function frame). 4599 // arguments adaptor frame below the function frame).
4602 Label no_rest_parameters; 4600 Label no_rest_parameters;
4603 __ movp(rbx, Operand(rdx, StandardFrameConstants::kCallerFPOffset)); 4601 __ movp(rbx, Operand(rdx, StandardFrameConstants::kCallerFPOffset));
4604 __ Cmp(Operand(rbx, StandardFrameConstants::kContextOffset), 4602 __ Cmp(Operand(rbx, CommonFrameConstants::kContextOrFrameTypeOffset),
4605 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 4603 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
4606 __ j(not_equal, &no_rest_parameters, Label::kNear); 4604 __ j(not_equal, &no_rest_parameters, Label::kNear);
4607 4605
4608 // Check if the arguments adaptor frame contains more arguments than 4606 // Check if the arguments adaptor frame contains more arguments than
4609 // specified by the function's internal formal parameter count. 4607 // specified by the function's internal formal parameter count.
4610 Label rest_parameters; 4608 Label rest_parameters;
4611 __ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); 4609 __ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
4612 __ LoadSharedFunctionInfoSpecialField( 4610 __ LoadSharedFunctionInfoSpecialField(
4613 rcx, rcx, SharedFunctionInfo::kFormalParameterCountOffset); 4611 rcx, rcx, SharedFunctionInfo::kFormalParameterCountOffset);
4614 __ SmiToInteger32( 4612 __ SmiToInteger32(
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
4750 // rbx: the mapped parameter count (untagged) 4748 // rbx: the mapped parameter count (untagged)
4751 // rax: the allocated object (tagged). 4749 // rax: the allocated object (tagged).
4752 Factory* factory = isolate()->factory(); 4750 Factory* factory = isolate()->factory();
4753 4751
4754 __ SmiToInteger64(rbx, rcx); 4752 __ SmiToInteger64(rbx, rcx);
4755 // rbx = parameter count (untagged) 4753 // rbx = parameter count (untagged)
4756 4754
4757 // Check if the calling frame is an arguments adaptor frame. 4755 // Check if the calling frame is an arguments adaptor frame.
4758 Label adaptor_frame, try_allocate, runtime; 4756 Label adaptor_frame, try_allocate, runtime;
4759 __ movp(rax, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 4757 __ movp(rax, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
4760 __ movp(r8, Operand(rax, StandardFrameConstants::kContextOffset)); 4758 __ movp(r8, Operand(rax, CommonFrameConstants::kContextOrFrameTypeOffset));
4761 __ Cmp(r8, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 4759 __ Cmp(r8, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
4762 __ j(equal, &adaptor_frame); 4760 __ j(equal, &adaptor_frame);
4763 4761
4764 // No adaptor, parameter count = argument count. 4762 // No adaptor, parameter count = argument count.
4765 __ movp(r11, rbx); 4763 __ movp(r11, rbx);
4766 __ jmp(&try_allocate, Label::kNear); 4764 __ jmp(&try_allocate, Label::kNear);
4767 4765
4768 // We have an adaptor frame. Patch the parameters pointer. 4766 // We have an adaptor frame. Patch the parameters pointer.
4769 __ bind(&adaptor_frame); 4767 __ bind(&adaptor_frame);
4770 __ SmiToInteger64( 4768 __ SmiToInteger64(
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
4956 // we reach the JavaScript frame for the function (similar to what the 4954 // we reach the JavaScript frame for the function (similar to what the
4957 // runtime fallback implementation does). So make rdx point to that 4955 // runtime fallback implementation does). So make rdx point to that
4958 // JavaScript frame. 4956 // JavaScript frame.
4959 { 4957 {
4960 Label loop, loop_entry; 4958 Label loop, loop_entry;
4961 __ movp(rdx, rbp); 4959 __ movp(rdx, rbp);
4962 __ jmp(&loop_entry, Label::kNear); 4960 __ jmp(&loop_entry, Label::kNear);
4963 __ bind(&loop); 4961 __ bind(&loop);
4964 __ movp(rdx, Operand(rdx, StandardFrameConstants::kCallerFPOffset)); 4962 __ movp(rdx, Operand(rdx, StandardFrameConstants::kCallerFPOffset));
4965 __ bind(&loop_entry); 4963 __ bind(&loop_entry);
4966 __ cmpp(rdi, Operand(rdx, StandardFrameConstants::kMarkerOffset)); 4964 __ cmpp(rdi, Operand(rdx, StandardFrameConstants::kFunctionOffset));
4967 __ j(not_equal, &loop); 4965 __ j(not_equal, &loop);
4968 } 4966 }
4969 4967
4970 // Check if we have an arguments adaptor frame below the function frame. 4968 // Check if we have an arguments adaptor frame below the function frame.
4971 Label arguments_adaptor, arguments_done; 4969 Label arguments_adaptor, arguments_done;
4972 __ movp(rbx, Operand(rdx, StandardFrameConstants::kCallerFPOffset)); 4970 __ movp(rbx, Operand(rdx, StandardFrameConstants::kCallerFPOffset));
4973 __ Cmp(Operand(rbx, StandardFrameConstants::kContextOffset), 4971 __ Cmp(Operand(rbx, CommonFrameConstants::kContextOrFrameTypeOffset),
4974 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 4972 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
4975 __ j(equal, &arguments_adaptor, Label::kNear); 4973 __ j(equal, &arguments_adaptor, Label::kNear);
4976 { 4974 {
4977 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); 4975 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
4978 __ LoadSharedFunctionInfoSpecialField( 4976 __ LoadSharedFunctionInfoSpecialField(
4979 rax, rax, SharedFunctionInfo::kFormalParameterCountOffset); 4977 rax, rax, SharedFunctionInfo::kFormalParameterCountOffset);
4980 __ leap(rbx, Operand(rdx, rax, times_pointer_size, 4978 __ leap(rbx, Operand(rdx, rax, times_pointer_size,
4981 StandardFrameConstants::kCallerSPOffset - 4979 StandardFrameConstants::kCallerSPOffset -
4982 1 * kPointerSize)); 4980 1 * kPointerSize));
4983 } 4981 }
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
5612 NULL); 5610 NULL);
5613 } 5611 }
5614 5612
5615 5613
5616 #undef __ 5614 #undef __
5617 5615
5618 } // namespace internal 5616 } // namespace internal
5619 } // namespace v8 5617 } // namespace v8
5620 5618
5621 #endif // V8_TARGET_ARCH_X64 5619 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698