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

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

Issue 1731253003: Revert of [Interpreter] Implements calls through CallICStub in the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/interface-descriptors-mips.cc ('k') | src/mips64/code-stubs-mips64.cc » ('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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 // Leave the frame (also dropping the register file). 1057 // Leave the frame (also dropping the register file).
1058 __ LeaveFrame(StackFrame::JAVA_SCRIPT); 1058 __ LeaveFrame(StackFrame::JAVA_SCRIPT);
1059 1059
1060 // Drop receiver + arguments and return. 1060 // Drop receiver + arguments and return.
1061 __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister, 1061 __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister,
1062 BytecodeArray::kParameterSizeOffset)); 1062 BytecodeArray::kParameterSizeOffset));
1063 __ Daddu(sp, sp, at); 1063 __ Daddu(sp, sp, at);
1064 __ Jump(ra); 1064 __ Jump(ra);
1065 } 1065 }
1066 1066
1067 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index,
1068 Register limit, Register scratch) {
1069 Label loop_header, loop_check;
1070 __ Branch(&loop_check);
1071 __ bind(&loop_header);
1072 __ ld(scratch, MemOperand(index));
1073 __ Daddu(index, index, Operand(-kPointerSize));
1074 __ push(scratch);
1075 __ bind(&loop_check);
1076 __ Branch(&loop_header, gt, index, Operand(limit));
1077 }
1078
1079 static void Generate_InterpreterComputeLastArgumentAddress(
1080 MacroAssembler* masm, Register num_args, Register start_address,
1081 Register output_reg) {
1082 __ Daddu(output_reg, num_args, Operand(1)); // Add one for receiver.
1083 __ dsll(output_reg, output_reg, kPointerSizeLog2);
1084 __ Dsubu(output_reg, start_address, output_reg);
1085 }
1086
1087 // static
1088 void Builtins::Generate_InterpreterPushArgsAndCallICImpl(
1089 MacroAssembler* masm, TailCallMode tail_call_mode) {
1090 // ----------- S t a t e -------------
1091 // -- a0 : the number of arguments (not including the receiver)
1092 // -- a4 : the address of the first argument to be pushed. Subsequent
1093 // arguments should be consecutive above this, in the same order as
1094 // they are to be pushed onto the stack.
1095 // -- a1 : the target to call (can be any Object).
1096 // -- a3 : feedback vector slot id
1097 // -- a2 : type feedback vector
1098 // -----------------------------------
1099
1100 {
1101 FrameScope scope(masm, StackFrame::INTERNAL);
1102
1103 // Computes the address of last argument in a5.
1104 Generate_InterpreterComputeLastArgumentAddress(masm, a0, a4, a5);
1105
1106 // Push the arguments.
1107 Generate_InterpreterPushArgs(masm, a4, a5, at);
1108
1109 // Call via the CallIC stub.
1110 CallICState call_ic_state(0, ConvertReceiverMode::kAny, tail_call_mode,
1111 true);
1112 CallICStub stub(masm->isolate(), call_ic_state);
1113 // TODO(mythria): This should be replaced by a TailCallStub, when we
1114 // update the code to find the target IC from jump instructions.
1115 __ CallStub(&stub);
1116 }
1117 __ Ret();
1118 }
1119 1067
1120 // static 1068 // static
1121 void Builtins::Generate_InterpreterPushArgsAndCallImpl( 1069 void Builtins::Generate_InterpreterPushArgsAndCallImpl(
1122 MacroAssembler* masm, TailCallMode tail_call_mode) { 1070 MacroAssembler* masm, TailCallMode tail_call_mode) {
1123 // ----------- S t a t e ------------- 1071 // ----------- S t a t e -------------
1124 // -- a0 : the number of arguments (not including the receiver) 1072 // -- a0 : the number of arguments (not including the receiver)
1125 // -- a2 : the address of the first argument to be pushed. Subsequent 1073 // -- a2 : the address of the first argument to be pushed. Subsequent
1126 // arguments should be consecutive above this, in the same order as 1074 // arguments should be consecutive above this, in the same order as
1127 // they are to be pushed onto the stack. 1075 // they are to be pushed onto the stack.
1128 // -- a1 : the target to call (can be any Object). 1076 // -- a1 : the target to call (can be any Object).
1129 // ----------------------------------- 1077 // -----------------------------------
1130 1078
1131 // Computes the address of last argument in a3. 1079 // Find the address of the last argument.
1132 Generate_InterpreterComputeLastArgumentAddress(masm, a0, a2, a3); 1080 __ Daddu(a3, a0, Operand(1)); // Add one for receiver.
1081 __ dsll(a3, a3, kPointerSizeLog2);
1082 __ Dsubu(a3, a2, Operand(a3));
1133 1083
1134 // Push the arguments. 1084 // Push the arguments.
1135 Generate_InterpreterPushArgs(masm, a2, a3, at); 1085 Label loop_header, loop_check;
1086 __ Branch(&loop_check);
1087 __ bind(&loop_header);
1088 __ ld(t0, MemOperand(a2));
1089 __ Daddu(a2, a2, Operand(-kPointerSize));
1090 __ push(t0);
1091 __ bind(&loop_check);
1092 __ Branch(&loop_header, gt, a2, Operand(a3));
1136 1093
1137 // Call the target. 1094 // Call the target.
1138 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, 1095 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny,
1139 tail_call_mode), 1096 tail_call_mode),
1140 RelocInfo::CODE_TARGET); 1097 RelocInfo::CODE_TARGET);
1141 } 1098 }
1142 1099
1143 1100
1144 // static 1101 // static
1145 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { 1102 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 Comment cmnt(masm, "[ PrepareForTailCall"); 2068 Comment cmnt(masm, "[ PrepareForTailCall");
2112 2069
2113 // Prepare for tail call only if the debugger is not active. 2070 // Prepare for tail call only if the debugger is not active.
2114 Label done; 2071 Label done;
2115 ExternalReference debug_is_active = 2072 ExternalReference debug_is_active =
2116 ExternalReference::debug_is_active_address(masm->isolate()); 2073 ExternalReference::debug_is_active_address(masm->isolate());
2117 __ li(at, Operand(debug_is_active)); 2074 __ li(at, Operand(debug_is_active));
2118 __ lb(scratch1, MemOperand(at)); 2075 __ lb(scratch1, MemOperand(at));
2119 __ Branch(&done, ne, scratch1, Operand(zero_reg)); 2076 __ Branch(&done, ne, scratch1, Operand(zero_reg));
2120 2077
2121 // Drop possible internal frame pushed for calling CallICStub.
2122 // TODO(mythria): when we tail call the CallICStub, remove this.
2123 {
2124 Label no_internal_callic_frame;
2125 __ ld(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset));
2126 __ Branch(&no_internal_callic_frame, ne, scratch3,
2127 Operand(Smi::FromInt(StackFrame::INTERNAL)));
2128 __ ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2129 __ bind(&no_internal_callic_frame);
2130 }
2131
2132 // Drop possible interpreter handler/stub frame. 2078 // Drop possible interpreter handler/stub frame.
2133 { 2079 {
2134 Label no_interpreter_frame; 2080 Label no_interpreter_frame;
2135 __ ld(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); 2081 __ ld(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset));
2136 __ Branch(&no_interpreter_frame, ne, scratch3, 2082 __ Branch(&no_interpreter_frame, ne, scratch3,
2137 Operand(Smi::FromInt(StackFrame::STUB))); 2083 Operand(Smi::FromInt(StackFrame::STUB)));
2138 __ ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 2084 __ ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2139 __ bind(&no_interpreter_frame); 2085 __ bind(&no_interpreter_frame);
2140 } 2086 }
2141 2087
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
2812 } 2758 }
2813 } 2759 }
2814 2760
2815 2761
2816 #undef __ 2762 #undef __
2817 2763
2818 } // namespace internal 2764 } // namespace internal
2819 } // namespace v8 2765 } // namespace v8
2820 2766
2821 #endif // V8_TARGET_ARCH_MIPS64 2767 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/interface-descriptors-mips.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698