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_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 Loading... |
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 Loading... |
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 Loading... |
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 Loading... |
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 Loading... |
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 Loading... |
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 Label no_arguments_adaptor, formal_parameter_count_loaded; | 1979 Label no_arguments_adaptor, formal_parameter_count_loaded; |
1984 __ lw(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1980 __ lw(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1985 __ lw(scratch3, MemOperand(scratch2, StandardFrameConstants::kContextOffset)); | 1981 __ lw(scratch3, |
| 1982 MemOperand(scratch2, CommonFrameConstants::kContextOrFrameTypeOffset)); |
1986 __ Branch(&no_arguments_adaptor, ne, scratch3, | 1983 __ Branch(&no_arguments_adaptor, ne, scratch3, |
1987 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 1984 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
1988 | 1985 |
1989 // Drop arguments adaptor frame and load arguments count. | 1986 // Drop arguments adaptor frame and load arguments count. |
1990 __ mov(fp, scratch2); | 1987 __ mov(fp, scratch2); |
1991 __ lw(scratch1, | 1988 __ lw(scratch1, |
1992 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 1989 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
1993 __ SmiUntag(scratch1); | 1990 __ SmiUntag(scratch1); |
1994 __ Branch(&formal_parameter_count_loaded); | 1991 __ Branch(&formal_parameter_count_loaded); |
1995 | 1992 |
1996 __ bind(&no_arguments_adaptor); | 1993 __ bind(&no_arguments_adaptor); |
1997 // Load caller's formal parameter count | 1994 // Load caller's formal parameter count |
1998 __ lw(scratch1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1995 __ lw(scratch1, |
| 1996 MemOperand(fp, ArgumentsAdaptorFrameConstants::kFunctionOffset)); |
1999 __ lw(scratch1, | 1997 __ lw(scratch1, |
2000 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); | 1998 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); |
2001 __ lw(scratch1, | 1999 __ lw(scratch1, |
2002 FieldMemOperand(scratch1, | 2000 FieldMemOperand(scratch1, |
2003 SharedFunctionInfo::kFormalParameterCountOffset)); | 2001 SharedFunctionInfo::kFormalParameterCountOffset)); |
2004 __ SmiUntag(scratch1); | 2002 __ SmiUntag(scratch1); |
2005 | 2003 |
2006 __ bind(&formal_parameter_count_loaded); | 2004 __ bind(&formal_parameter_count_loaded); |
2007 | 2005 |
2008 // Calculate the end of destination area where we will put the arguments | 2006 // Calculate the end of destination area where we will put the arguments |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2653 } | 2651 } |
2654 } | 2652 } |
2655 | 2653 |
2656 | 2654 |
2657 #undef __ | 2655 #undef __ |
2658 | 2656 |
2659 } // namespace internal | 2657 } // namespace internal |
2660 } // namespace v8 | 2658 } // namespace v8 |
2661 | 2659 |
2662 #endif // V8_TARGET_ARCH_MIPS | 2660 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |