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

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

Issue 2649143002: [Turbofan] Implement call with spread bytecode in assembly code. (Closed)
Patch Set: Rename PushArgsMode to InterpreterPushArgsMode Created 3 years, 11 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/builtins/mips64/builtins-mips64.cc ('k') | src/builtins/s390/builtins-s390.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 __ mtctr(count); 1156 __ mtctr(count);
1157 __ bind(&loop); 1157 __ bind(&loop);
1158 __ LoadPU(scratch, MemOperand(index, -kPointerSize)); 1158 __ LoadPU(scratch, MemOperand(index, -kPointerSize));
1159 __ push(scratch); 1159 __ push(scratch);
1160 __ bdnz(&loop); 1160 __ bdnz(&loop);
1161 } 1161 }
1162 1162
1163 // static 1163 // static
1164 void Builtins::Generate_InterpreterPushArgsAndCallImpl( 1164 void Builtins::Generate_InterpreterPushArgsAndCallImpl(
1165 MacroAssembler* masm, TailCallMode tail_call_mode, 1165 MacroAssembler* masm, TailCallMode tail_call_mode,
1166 CallableType function_type) { 1166 InterpreterPushArgsMode mode) {
1167 // ----------- S t a t e ------------- 1167 // ----------- S t a t e -------------
1168 // -- r3 : the number of arguments (not including the receiver) 1168 // -- r3 : the number of arguments (not including the receiver)
1169 // -- r5 : the address of the first argument to be pushed. Subsequent 1169 // -- r5 : the address of the first argument to be pushed. Subsequent
1170 // arguments should be consecutive above this, in the same order as 1170 // arguments should be consecutive above this, in the same order as
1171 // they are to be pushed onto the stack. 1171 // they are to be pushed onto the stack.
1172 // -- r4 : the target to call (can be any Object). 1172 // -- r4 : the target to call (can be any Object).
1173 // ----------------------------------- 1173 // -----------------------------------
1174 Label stack_overflow; 1174 Label stack_overflow;
1175 1175
1176 // Calculate number of arguments (add one for receiver). 1176 // Calculate number of arguments (add one for receiver).
1177 __ addi(r6, r3, Operand(1)); 1177 __ addi(r6, r3, Operand(1));
1178 1178
1179 // Push the arguments. r5, r6, r7 will be modified. 1179 // Push the arguments. r5, r6, r7 will be modified.
1180 Generate_InterpreterPushArgs(masm, r6, r5, r6, r7, &stack_overflow); 1180 Generate_InterpreterPushArgs(masm, r6, r5, r6, r7, &stack_overflow);
1181 1181
1182 // Call the target. 1182 // Call the target.
1183 if (function_type == CallableType::kJSFunction) { 1183 if (mode == InterpreterPushArgsMode::kJSFunction) {
1184 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, 1184 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny,
1185 tail_call_mode), 1185 tail_call_mode),
1186 RelocInfo::CODE_TARGET); 1186 RelocInfo::CODE_TARGET);
1187 } else { 1187 } else {
1188 DCHECK_EQ(function_type, CallableType::kAny); 1188 DCHECK_EQ(mode, InterpreterPushArgsMode::kOther);
1189 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, 1189 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny,
1190 tail_call_mode), 1190 tail_call_mode),
1191 RelocInfo::CODE_TARGET); 1191 RelocInfo::CODE_TARGET);
1192 } 1192 }
1193 1193
1194 __ bind(&stack_overflow); 1194 __ bind(&stack_overflow);
1195 { 1195 {
1196 __ TailCallRuntime(Runtime::kThrowStackOverflow); 1196 __ TailCallRuntime(Runtime::kThrowStackOverflow);
1197 // Unreachable Code. 1197 // Unreachable Code.
1198 __ bkpt(0); 1198 __ bkpt(0);
1199 } 1199 }
1200 } 1200 }
1201 1201
1202 // static 1202 // static
1203 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( 1203 void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
1204 MacroAssembler* masm, PushArgsConstructMode mode) { 1204 MacroAssembler* masm, InterpreterPushArgsMode mode) {
1205 // ----------- S t a t e ------------- 1205 // ----------- S t a t e -------------
1206 // -- r3 : argument count (not including receiver) 1206 // -- r3 : argument count (not including receiver)
1207 // -- r6 : new target 1207 // -- r6 : new target
1208 // -- r4 : constructor to call 1208 // -- r4 : constructor to call
1209 // -- r5 : allocation site feedback if available, undefined otherwise. 1209 // -- r5 : allocation site feedback if available, undefined otherwise.
1210 // -- r7 : address of the first argument 1210 // -- r7 : address of the first argument
1211 // ----------------------------------- 1211 // -----------------------------------
1212 Label stack_overflow; 1212 Label stack_overflow;
1213 1213
1214 // Push a slot for the receiver to be constructed. 1214 // Push a slot for the receiver to be constructed.
1215 __ li(r0, Operand::Zero()); 1215 __ li(r0, Operand::Zero());
1216 __ push(r0); 1216 __ push(r0);
1217 1217
1218 // Push the arguments (skip if none). 1218 // Push the arguments (skip if none).
1219 Label skip; 1219 Label skip;
1220 __ cmpi(r3, Operand::Zero()); 1220 __ cmpi(r3, Operand::Zero());
1221 __ beq(&skip); 1221 __ beq(&skip);
1222 // Push the arguments. r8, r7, r9 will be modified. 1222 // Push the arguments. r8, r7, r9 will be modified.
1223 Generate_InterpreterPushArgs(masm, r3, r7, r3, r8, &stack_overflow); 1223 Generate_InterpreterPushArgs(masm, r3, r7, r3, r8, &stack_overflow);
1224 __ bind(&skip); 1224 __ bind(&skip);
1225 1225
1226 __ AssertUndefinedOrAllocationSite(r5, r8); 1226 __ AssertUndefinedOrAllocationSite(r5, r8);
1227 if (mode == PushArgsConstructMode::kJSFunction) { 1227 if (mode == InterpreterPushArgsMode::kJSFunction) {
1228 __ AssertFunction(r4); 1228 __ AssertFunction(r4);
1229 1229
1230 // Tail call to the function-specific construct stub (still in the caller 1230 // Tail call to the function-specific construct stub (still in the caller
1231 // context at this point). 1231 // context at this point).
1232 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); 1232 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
1233 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); 1233 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset));
1234 // Jump to the construct function. 1234 // Jump to the construct function.
1235 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); 1235 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag));
1236 __ Jump(ip); 1236 __ Jump(ip);
1237 } else if (mode == PushArgsConstructMode::kWithFinalSpread) { 1237 } else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
1238 // Call the constructor with r3, r4, and r6 unmodified. 1238 // Call the constructor with r3, r4, and r6 unmodified.
1239 __ Jump(masm->isolate()->builtins()->ConstructWithSpread(), 1239 __ Jump(masm->isolate()->builtins()->ConstructWithSpread(),
1240 RelocInfo::CODE_TARGET); 1240 RelocInfo::CODE_TARGET);
1241 } else { 1241 } else {
1242 DCHECK_EQ(PushArgsConstructMode::kOther, mode); 1242 DCHECK_EQ(InterpreterPushArgsMode::kOther, mode);
1243 // Call the constructor with r3, r4, and r6 unmodified. 1243 // Call the constructor with r3, r4, and r6 unmodified.
1244 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 1244 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
1245 } 1245 }
1246 1246
1247 __ bind(&stack_overflow); 1247 __ bind(&stack_overflow);
1248 { 1248 {
1249 __ TailCallRuntime(Runtime::kThrowStackOverflow); 1249 __ TailCallRuntime(Runtime::kThrowStackOverflow);
1250 // Unreachable Code. 1250 // Unreachable Code.
1251 __ bkpt(0); 1251 __ bkpt(0);
1252 } 1252 }
(...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after
3111 __ CallRuntime(Runtime::kThrowStackOverflow); 3111 __ CallRuntime(Runtime::kThrowStackOverflow);
3112 __ bkpt(0); 3112 __ bkpt(0);
3113 } 3113 }
3114 } 3114 }
3115 3115
3116 #undef __ 3116 #undef __
3117 } // namespace internal 3117 } // namespace internal
3118 } // namespace v8 3118 } // namespace v8
3119 3119
3120 #endif // V8_TARGET_ARCH_PPC 3120 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/builtins/s390/builtins-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698