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

Side by Side Diff: src/mips64/builtins-mips64.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 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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 521
522 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 522 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
523 bool is_api_function, 523 bool is_api_function,
524 bool create_implicit_receiver, 524 bool create_implicit_receiver,
525 bool check_derived_construct) { 525 bool check_derived_construct) {
526 // ----------- S t a t e ------------- 526 // ----------- S t a t e -------------
527 // -- a0 : number of arguments 527 // -- a0 : number of arguments
528 // -- a1 : constructor function 528 // -- a1 : constructor function
529 // -- a2 : allocation site or undefined 529 // -- a2 : allocation site or undefined
530 // -- a3 : new target 530 // -- a3 : new target
531 // -- cp : context
531 // -- ra : return address 532 // -- ra : return address
532 // -- sp[...]: constructor arguments 533 // -- sp[...]: constructor arguments
533 // ----------------------------------- 534 // -----------------------------------
534 535
535 Isolate* isolate = masm->isolate(); 536 Isolate* isolate = masm->isolate();
536 537
537 // Enter a construct frame. 538 // Enter a construct frame.
538 { 539 {
539 FrameScope scope(masm, StackFrame::CONSTRUCT); 540 FrameScope scope(masm, StackFrame::CONSTRUCT);
540 541
541 // Preserve the incoming parameters on the stack. 542 // Preserve the incoming parameters on the stack.
542 __ AssertUndefinedOrAllocationSite(a2, t0); 543 __ AssertUndefinedOrAllocationSite(a2, t0);
543 __ SmiTag(a0); 544 __ SmiTag(a0);
544 __ Push(a2, a0); 545 __ Push(cp, a2, a0);
545 546
546 if (create_implicit_receiver) { 547 if (create_implicit_receiver) {
547 __ Push(a1, a3); 548 __ Push(a1, a3);
548 FastNewObjectStub stub(masm->isolate()); 549 FastNewObjectStub stub(masm->isolate());
549 __ CallStub(&stub); 550 __ CallStub(&stub);
550 __ mov(t0, v0); 551 __ mov(t0, v0);
551 __ Pop(a1, a3); 552 __ Pop(a1, a3);
552 553
553 // ----------- S t a t e ------------- 554 // ----------- S t a t e -------------
554 // -- a1: constructor function 555 // -- a1: constructor function
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 __ InvokeFunction(a1, a3, actual, CALL_FUNCTION, 606 __ InvokeFunction(a1, a3, actual, CALL_FUNCTION,
606 CheckDebugStepCallWrapper()); 607 CheckDebugStepCallWrapper());
607 } 608 }
608 609
609 // Store offset of return address for deoptimizer. 610 // Store offset of return address for deoptimizer.
610 if (create_implicit_receiver && !is_api_function) { 611 if (create_implicit_receiver && !is_api_function) {
611 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); 612 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset());
612 } 613 }
613 614
614 // Restore context from the frame. 615 // Restore context from the frame.
615 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 616 __ ld(cp, MemOperand(fp, ConstructFrameConstants::kContextOffset));
616 617
617 if (create_implicit_receiver) { 618 if (create_implicit_receiver) {
618 // If the result is an object (in the ECMA sense), we should get rid 619 // If the result is an object (in the ECMA sense), we should get rid
619 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 620 // of the receiver and use the result; see ECMA-262 section 13.2.2-7
620 // on page 74. 621 // on page 74.
621 Label use_receiver, exit; 622 Label use_receiver, exit;
622 623
623 // If the result is a smi, it is *not* an object in the ECMA sense. 624 // If the result is a smi, it is *not* an object in the ECMA sense.
624 // v0: result 625 // v0: result
625 // sp[0]: receiver (newly allocated object) 626 // sp[0]: receiver (newly allocated object)
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 // Called from JSEntryStub::GenerateBody 737 // Called from JSEntryStub::GenerateBody
737 738
738 // ----------- S t a t e ------------- 739 // ----------- S t a t e -------------
739 // -- a0: new.target 740 // -- a0: new.target
740 // -- a1: function 741 // -- a1: function
741 // -- a2: receiver_pointer 742 // -- a2: receiver_pointer
742 // -- a3: argc 743 // -- a3: argc
743 // -- s0: argv 744 // -- s0: argv
744 // ----------------------------------- 745 // -----------------------------------
745 ProfileEntryHookStub::MaybeCallEntryHook(masm); 746 ProfileEntryHookStub::MaybeCallEntryHook(masm);
746 // Clear the context before we push it when entering the JS frame.
747 __ mov(cp, zero_reg);
748 747
749 // Enter an internal frame. 748 // Enter an internal frame.
750 { 749 {
751 FrameScope scope(masm, StackFrame::INTERNAL); 750 FrameScope scope(masm, StackFrame::INTERNAL);
752 751
753 // Setup the context (we need to use the caller context from the isolate). 752 // Setup the context (we need to use the caller context from the isolate).
754 ExternalReference context_address(Isolate::kContextAddress, 753 ExternalReference context_address(Isolate::kContextAddress,
755 masm->isolate()); 754 masm->isolate());
756 __ li(cp, Operand(context_address)); 755 __ li(cp, Operand(context_address));
757 __ ld(cp, MemOperand(cp)); 756 __ ld(cp, MemOperand(cp));
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 // o sp: stack pointer 831 // o sp: stack pointer
833 // o ra: return address 832 // o ra: return address
834 // 833 //
835 // The function builds an interpreter frame. See InterpreterFrameConstants in 834 // The function builds an interpreter frame. See InterpreterFrameConstants in
836 // frames.h for its layout. 835 // frames.h for its layout.
837 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { 836 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
838 // Open a frame scope to indicate that there is a frame on the stack. The 837 // Open a frame scope to indicate that there is a frame on the stack. The
839 // MANUAL indicates that the scope shouldn't actually generate code to set up 838 // MANUAL indicates that the scope shouldn't actually generate code to set up
840 // the frame (that is done below). 839 // the frame (that is done below).
841 FrameScope frame_scope(masm, StackFrame::MANUAL); 840 FrameScope frame_scope(masm, StackFrame::MANUAL);
842 841 __ PushStandardFrame(a1);
843 __ Push(ra, fp, cp, a1);
844 __ Daddu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
845 842
846 // Get the bytecode array from the function object and load the pointer to the 843 // Get the bytecode array from the function object and load the pointer to the
847 // first entry into kInterpreterBytecodeRegister. 844 // first entry into kInterpreterBytecodeRegister.
848 __ ld(a0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 845 __ ld(a0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
849 Label load_debug_bytecode_array, bytecode_array_loaded; 846 Label load_debug_bytecode_array, bytecode_array_loaded;
850 Register debug_info = kInterpreterBytecodeArrayRegister; 847 Register debug_info = kInterpreterBytecodeArrayRegister;
851 DCHECK(!debug_info.is(a0)); 848 DCHECK(!debug_info.is(a0));
852 __ ld(debug_info, FieldMemOperand(a0, SharedFunctionInfo::kDebugInfoOffset)); 849 __ ld(debug_info, FieldMemOperand(a0, SharedFunctionInfo::kDebugInfoOffset));
853 __ Branch(&load_debug_bytecode_array, ne, debug_info, 850 __ Branch(&load_debug_bytecode_array, ne, debug_info,
854 Operand(DebugInfo::uninitialized())); 851 Operand(DebugInfo::uninitialized()));
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 FrameScope scope(masm, StackFrame::MANUAL); 1187 FrameScope scope(masm, StackFrame::MANUAL);
1191 __ MultiPush(saved_regs); 1188 __ MultiPush(saved_regs);
1192 __ PrepareCallCFunction(2, 0, a2); 1189 __ PrepareCallCFunction(2, 0, a2);
1193 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate()))); 1190 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate())));
1194 __ CallCFunction( 1191 __ CallCFunction(
1195 ExternalReference::get_mark_code_as_executed_function(masm->isolate()), 1192 ExternalReference::get_mark_code_as_executed_function(masm->isolate()),
1196 2); 1193 2);
1197 __ MultiPop(saved_regs); 1194 __ MultiPop(saved_regs);
1198 1195
1199 // Perform prologue operations usually performed by the young code stub. 1196 // Perform prologue operations usually performed by the young code stub.
1200 __ Push(ra, fp, cp, a1); 1197 __ PushStandardFrame(a1);
1201 __ Daddu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
1202 1198
1203 // Jump to point after the code-age stub. 1199 // Jump to point after the code-age stub.
1204 __ Daddu(a0, a0, Operand((kNoCodeAgeSequenceLength))); 1200 __ Daddu(a0, a0, Operand((kNoCodeAgeSequenceLength)));
1205 __ Jump(a0); 1201 __ Jump(a0);
1206 } 1202 }
1207 1203
1208 1204
1209 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) { 1205 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) {
1210 GenerateMakeCodeYoungAgainCommon(masm); 1206 GenerateMakeCodeYoungAgainCommon(masm);
1211 } 1207 }
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 Label done; 1956 Label done;
1961 ExternalReference debug_is_active = 1957 ExternalReference debug_is_active =
1962 ExternalReference::debug_is_active_address(masm->isolate()); 1958 ExternalReference::debug_is_active_address(masm->isolate());
1963 __ li(at, Operand(debug_is_active)); 1959 __ li(at, Operand(debug_is_active));
1964 __ lb(scratch1, MemOperand(at)); 1960 __ lb(scratch1, MemOperand(at));
1965 __ Branch(&done, ne, scratch1, Operand(zero_reg)); 1961 __ Branch(&done, ne, scratch1, Operand(zero_reg));
1966 1962
1967 // Drop possible interpreter handler/stub frame. 1963 // Drop possible interpreter handler/stub frame.
1968 { 1964 {
1969 Label no_interpreter_frame; 1965 Label no_interpreter_frame;
1970 __ ld(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); 1966 __ ld(scratch3,
1967 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset));
1971 __ Branch(&no_interpreter_frame, ne, scratch3, 1968 __ Branch(&no_interpreter_frame, ne, scratch3,
1972 Operand(Smi::FromInt(StackFrame::STUB))); 1969 Operand(Smi::FromInt(StackFrame::STUB)));
1973 __ ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 1970 __ ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1974 __ bind(&no_interpreter_frame); 1971 __ bind(&no_interpreter_frame);
1975 } 1972 }
1976 1973
1977 // Check if next frame is an arguments adaptor frame. 1974 // Check if next frame is an arguments adaptor frame.
1978 Register caller_args_count_reg = scratch1; 1975 Register caller_args_count_reg = scratch1;
1979 Label no_arguments_adaptor, formal_parameter_count_loaded; 1976 Label no_arguments_adaptor, formal_parameter_count_loaded;
1980 __ ld(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 1977 __ ld(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1981 __ ld(scratch3, MemOperand(scratch2, StandardFrameConstants::kContextOffset)); 1978 __ ld(scratch3,
1979 MemOperand(scratch2, CommonFrameConstants::kContextOrFrameTypeOffset));
1982 __ Branch(&no_arguments_adaptor, ne, scratch3, 1980 __ Branch(&no_arguments_adaptor, ne, scratch3,
1983 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 1981 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1984 1982
1985 // Drop current frame and load arguments count from arguments adaptor frame. 1983 // Drop current frame and load arguments count from arguments adaptor frame.
1986 __ mov(fp, scratch2); 1984 __ mov(fp, scratch2);
1987 __ ld(caller_args_count_reg, 1985 __ ld(caller_args_count_reg,
1988 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); 1986 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset));
1989 __ SmiUntag(caller_args_count_reg); 1987 __ SmiUntag(caller_args_count_reg);
1990 __ Branch(&formal_parameter_count_loaded); 1988 __ Branch(&formal_parameter_count_loaded);
1991 1989
1992 __ bind(&no_arguments_adaptor); 1990 __ bind(&no_arguments_adaptor);
1993 // Load caller's formal parameter count 1991 // Load caller's formal parameter count
1994 __ ld(scratch1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1992 __ ld(scratch1,
1993 MemOperand(fp, ArgumentsAdaptorFrameConstants::kFunctionOffset));
1995 __ ld(scratch1, 1994 __ ld(scratch1,
1996 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); 1995 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset));
1997 __ lw(caller_args_count_reg, 1996 __ lw(caller_args_count_reg,
1998 FieldMemOperand(scratch1, 1997 FieldMemOperand(scratch1,
1999 SharedFunctionInfo::kFormalParameterCountOffset)); 1998 SharedFunctionInfo::kFormalParameterCountOffset));
2000 1999
2001 __ bind(&formal_parameter_count_loaded); 2000 __ bind(&formal_parameter_count_loaded);
2002 2001
2003 ParameterCount callee_args_count(args_reg); 2002 ParameterCount callee_args_count(args_reg);
2004 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, 2003 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2,
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
2612 } 2611 }
2613 } 2612 }
2614 2613
2615 2614
2616 #undef __ 2615 #undef __
2617 2616
2618 } // namespace internal 2617 } // namespace internal
2619 } // namespace v8 2618 } // namespace v8
2620 2619
2621 #endif // V8_TARGET_ARCH_MIPS64 2620 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698