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_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 Loading... |
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 Loading... |
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 Loading... |
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 Loading... |
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 Loading... |
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 Loading... |
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 Label no_arguments_adaptor, formal_parameter_count_loaded; | 1975 Label no_arguments_adaptor, formal_parameter_count_loaded; |
1979 __ ld(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1976 __ ld(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1980 __ ld(scratch3, MemOperand(scratch2, StandardFrameConstants::kContextOffset)); | 1977 __ ld(scratch3, |
| 1978 MemOperand(scratch2, CommonFrameConstants::kContextOrFrameTypeOffset)); |
1981 __ Branch(&no_arguments_adaptor, ne, scratch3, | 1979 __ Branch(&no_arguments_adaptor, ne, scratch3, |
1982 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 1980 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
1983 | 1981 |
1984 // Drop arguments adaptor frame and load arguments count. | 1982 // Drop arguments adaptor frame and load arguments count. |
1985 __ mov(fp, scratch2); | 1983 __ mov(fp, scratch2); |
1986 __ ld(scratch1, | 1984 __ ld(scratch1, |
1987 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 1985 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
1988 __ SmiUntag(scratch1); | 1986 __ SmiUntag(scratch1); |
1989 __ Branch(&formal_parameter_count_loaded); | 1987 __ Branch(&formal_parameter_count_loaded); |
1990 | 1988 |
1991 __ bind(&no_arguments_adaptor); | 1989 __ bind(&no_arguments_adaptor); |
1992 // Load caller's formal parameter count | 1990 // Load caller's formal parameter count |
1993 __ ld(scratch1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1991 __ ld(scratch1, |
| 1992 MemOperand(fp, ArgumentsAdaptorFrameConstants::kFunctionOffset)); |
1994 __ ld(scratch1, | 1993 __ ld(scratch1, |
1995 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); | 1994 FieldMemOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); |
1996 __ lw(scratch1, | 1995 __ lw(scratch1, |
1997 FieldMemOperand(scratch1, | 1996 FieldMemOperand(scratch1, |
1998 SharedFunctionInfo::kFormalParameterCountOffset)); | 1997 SharedFunctionInfo::kFormalParameterCountOffset)); |
1999 | 1998 |
2000 __ bind(&formal_parameter_count_loaded); | 1999 __ bind(&formal_parameter_count_loaded); |
2001 | 2000 |
2002 // Calculate the end of destination area where we will put the arguments | 2001 // Calculate the end of destination area where we will put the arguments |
2003 // after we drop current frame. We add kPointerSize to count the receiver | 2002 // after we drop current frame. We add kPointerSize to count the receiver |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2647 } | 2646 } |
2648 } | 2647 } |
2649 | 2648 |
2650 | 2649 |
2651 #undef __ | 2650 #undef __ |
2652 | 2651 |
2653 } // namespace internal | 2652 } // namespace internal |
2654 } // namespace v8 | 2653 } // namespace v8 |
2655 | 2654 |
2656 #endif // V8_TARGET_ARCH_MIPS64 | 2655 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |