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

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

Powered by Google App Engine
This is Rietveld 408576698