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

Side by Side Diff: src/mips64/builtins-mips64.cc

Issue 1965343002: [Interpreter] Support compiling for baseline on return from interpreted function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test for nosnap build Created 4 years, 7 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
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 933
934 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { 934 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) {
935 Generate_JSEntryTrampolineHelper(masm, false); 935 Generate_JSEntryTrampolineHelper(masm, false);
936 } 936 }
937 937
938 938
939 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { 939 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
940 Generate_JSEntryTrampolineHelper(masm, true); 940 Generate_JSEntryTrampolineHelper(masm, true);
941 } 941 }
942 942
943 static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch) {
944 Register args_count = scratch;
945
946 // Get the arguments + receiver count.
947 __ ld(args_count,
948 MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp));
949 __ lw(t0, FieldMemOperand(args_count, BytecodeArray::kParameterSizeOffset));
950
951 // Leave the frame (also dropping the register file).
952 __ LeaveFrame(StackFrame::JAVA_SCRIPT);
953
954 // Drop receiver + arguments.
955 __ Daddu(sp, sp, args_count);
956 }
957
943 // Generate code for entering a JS function with the interpreter. 958 // Generate code for entering a JS function with the interpreter.
944 // On entry to the function the receiver and arguments have been pushed on the 959 // On entry to the function the receiver and arguments have been pushed on the
945 // stack left to right. The actual argument count matches the formal parameter 960 // stack left to right. The actual argument count matches the formal parameter
946 // count expected by the function. 961 // count expected by the function.
947 // 962 //
948 // The live registers are: 963 // The live registers are:
949 // o a1: the JS function object being called. 964 // o a1: the JS function object being called.
950 // o a3: the new target 965 // o a3: the new target
951 // o cp: our context 966 // o cp: our context
952 // o fp: the caller's frame pointer 967 // o fp: the caller's frame pointer
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 // Dispatch to the first bytecode handler for the function. 1050 // Dispatch to the first bytecode handler for the function.
1036 __ Daddu(a0, kInterpreterBytecodeArrayRegister, 1051 __ Daddu(a0, kInterpreterBytecodeArrayRegister,
1037 kInterpreterBytecodeOffsetRegister); 1052 kInterpreterBytecodeOffsetRegister);
1038 __ lbu(a0, MemOperand(a0)); 1053 __ lbu(a0, MemOperand(a0));
1039 __ Dlsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2); 1054 __ Dlsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2);
1040 __ ld(at, MemOperand(at)); 1055 __ ld(at, MemOperand(at));
1041 __ Call(at); 1056 __ Call(at);
1042 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); 1057 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset());
1043 1058
1044 // The return value is in v0. 1059 // The return value is in v0.
1045 1060 LeaveInterpreterFrame(masm, t0);
1046 // Get the arguments + reciever count.
1047 __ ld(t0, MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp));
1048 __ lw(t0, FieldMemOperand(t0, BytecodeArray::kParameterSizeOffset));
1049
1050 // Leave the frame (also dropping the register file).
1051 __ LeaveFrame(StackFrame::JAVA_SCRIPT);
1052
1053 // Drop receiver + arguments and return.
1054 __ Daddu(sp, sp, t0);
1055 __ Jump(ra); 1061 __ Jump(ra);
1056 1062
1057 // Load debug copy of the bytecode array. 1063 // Load debug copy of the bytecode array.
1058 __ bind(&load_debug_bytecode_array); 1064 __ bind(&load_debug_bytecode_array);
1059 __ ld(kInterpreterBytecodeArrayRegister, 1065 __ ld(kInterpreterBytecodeArrayRegister,
1060 FieldMemOperand(debug_info, DebugInfo::kAbstractCodeIndex)); 1066 FieldMemOperand(debug_info, DebugInfo::kAbstractCodeIndex));
1061 __ Branch(&bytecode_array_loaded); 1067 __ Branch(&bytecode_array_loaded);
1062 1068
1063 // If the bytecode array is no longer present, then the underlying function 1069 // If the bytecode array is no longer present, then the underlying function
1064 // has been switched to a different kind of code and we heal the closure by 1070 // has been switched to a different kind of code and we heal the closure by
1065 // switching the code entry field over to the new code object as well. 1071 // switching the code entry field over to the new code object as well.
1066 __ bind(&bytecode_array_not_present); 1072 __ bind(&bytecode_array_not_present);
1067 __ LeaveFrame(StackFrame::JAVA_SCRIPT); 1073 __ LeaveFrame(StackFrame::JAVA_SCRIPT);
1068 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 1074 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1069 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kCodeOffset)); 1075 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kCodeOffset));
1070 __ Daddu(a4, a4, Operand(Code::kHeaderSize - kHeapObjectTag)); 1076 __ Daddu(a4, a4, Operand(Code::kHeaderSize - kHeapObjectTag));
1071 __ sd(a4, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 1077 __ sd(a4, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
1072 __ RecordWriteCodeEntryField(a1, a4, a5); 1078 __ RecordWriteCodeEntryField(a1, a4, a5);
1073 __ Jump(a4); 1079 __ Jump(a4);
1074 } 1080 }
1075 1081
1082 void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) {
1083 // Save the function and context for call to CompileBaseline.
1084 __ ld(a1, MemOperand(fp, StandardFrameConstants::kFunctionOffset));
1085 __ ld(kContextRegister,
1086 MemOperand(fp, StandardFrameConstants::kContextOffset));
1087
1088 // Leave the frame before recompiling for baseline so that we don't count as
1089 // an activation on the stack.
1090 LeaveInterpreterFrame(masm, t0);
1091
1092 {
1093 FrameScope frame_scope(masm, StackFrame::INTERNAL);
1094 // Push return value.
1095 __ push(v0);
1096
1097 // Push function as argument and compile for baseline.
1098 __ push(a1);
1099 __ CallRuntime(Runtime::kCompileBaseline);
1100
1101 // Restore return value.
1102 __ pop(v0);
1103 }
1104 __ Jump(ra);
1105 }
1106
1076 // static 1107 // static
1077 void Builtins::Generate_InterpreterPushArgsAndCallImpl( 1108 void Builtins::Generate_InterpreterPushArgsAndCallImpl(
1078 MacroAssembler* masm, TailCallMode tail_call_mode) { 1109 MacroAssembler* masm, TailCallMode tail_call_mode) {
1079 // ----------- S t a t e ------------- 1110 // ----------- S t a t e -------------
1080 // -- a0 : the number of arguments (not including the receiver) 1111 // -- a0 : the number of arguments (not including the receiver)
1081 // -- a2 : the address of the first argument to be pushed. Subsequent 1112 // -- a2 : the address of the first argument to be pushed. Subsequent
1082 // arguments should be consecutive above this, in the same order as 1113 // arguments should be consecutive above this, in the same order as
1083 // they are to be pushed onto the stack. 1114 // they are to be pushed onto the stack.
1084 // -- a1 : the target to call (can be any Object). 1115 // -- a1 : the target to call (can be any Object).
1085 // ----------------------------------- 1116 // -----------------------------------
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
2819 } 2850 }
2820 } 2851 }
2821 2852
2822 2853
2823 #undef __ 2854 #undef __
2824 2855
2825 } // namespace internal 2856 } // namespace internal
2826 } // namespace v8 2857 } // namespace v8
2827 2858
2828 #endif // V8_TARGET_ARCH_MIPS64 2859 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698