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

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

Issue 2813563006: Reland: PPC/s390 [ignition] Add call bytecodes for undefined receiver (Closed)
Patch Set: Created 3 years, 8 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/ppc/builtins-ppc.cc ('k') | no next file » | 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_S390 5 #if V8_TARGET_ARCH_S390
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 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 // here which will cause scratch to become negative. 1094 // here which will cause scratch to become negative.
1095 __ SubP(scratch, sp, scratch); 1095 __ SubP(scratch, sp, scratch);
1096 // Check if the arguments will overflow the stack. 1096 // Check if the arguments will overflow the stack.
1097 __ ShiftLeftP(r0, num_args, Operand(kPointerSizeLog2)); 1097 __ ShiftLeftP(r0, num_args, Operand(kPointerSizeLog2));
1098 __ CmpP(scratch, r0); 1098 __ CmpP(scratch, r0);
1099 __ ble(stack_overflow); // Signed comparison. 1099 __ ble(stack_overflow); // Signed comparison.
1100 } 1100 }
1101 1101
1102 static void Generate_InterpreterPushArgs(MacroAssembler* masm, 1102 static void Generate_InterpreterPushArgs(MacroAssembler* masm,
1103 Register num_args, Register index, 1103 Register num_args, Register index,
1104 Register count, Register scratch, 1104 Register count, Register scratch) {
1105 Label* stack_overflow) {
1106 // Add a stack check before pushing arguments.
1107 Generate_StackOverflowCheck(masm, num_args, scratch, stack_overflow);
1108
1109 Label loop; 1105 Label loop;
1110 __ AddP(index, index, Operand(kPointerSize)); // Bias up for LoadPU 1106 __ AddP(index, index, Operand(kPointerSize)); // Bias up for LoadPU
1111 __ LoadRR(r0, count); 1107 __ LoadRR(r0, count);
1112 __ bind(&loop); 1108 __ bind(&loop);
1113 __ LoadP(scratch, MemOperand(index, -kPointerSize)); 1109 __ LoadP(scratch, MemOperand(index, -kPointerSize));
1114 __ lay(index, MemOperand(index, -kPointerSize)); 1110 __ lay(index, MemOperand(index, -kPointerSize));
1115 __ push(scratch); 1111 __ push(scratch);
1116 __ SubP(r0, Operand(1)); 1112 __ SubP(r0, Operand(1));
1117 __ bne(&loop); 1113 __ bne(&loop);
1118 } 1114 }
1119 1115
1120 // static 1116 // static
1121 void Builtins::Generate_InterpreterPushArgsThenCallImpl( 1117 void Builtins::Generate_InterpreterPushArgsThenCallImpl(
1122 MacroAssembler* masm, TailCallMode tail_call_mode, 1118 MacroAssembler* masm, ConvertReceiverMode receiver_mode,
1123 InterpreterPushArgsMode mode) { 1119 TailCallMode tail_call_mode, InterpreterPushArgsMode mode) {
1124 // ----------- S t a t e ------------- 1120 // ----------- S t a t e -------------
1125 // -- r2 : the number of arguments (not including the receiver) 1121 // -- r2 : the number of arguments (not including the receiver)
1126 // -- r4 : the address of the first argument to be pushed. Subsequent 1122 // -- r4 : the address of the first argument to be pushed. Subsequent
1127 // arguments should be consecutive above this, in the same order as 1123 // arguments should be consecutive above this, in the same order as
1128 // they are to be pushed onto the stack. 1124 // they are to be pushed onto the stack.
1129 // -- r3 : the target to call (can be any Object). 1125 // -- r3 : the target to call (can be any Object).
1130 // ----------------------------------- 1126 // -----------------------------------
1131 Label stack_overflow; 1127 Label stack_overflow;
1132 1128
1133 // Calculate number of arguments (AddP one for receiver). 1129 // Calculate number of arguments (AddP one for receiver).
1134 __ AddP(r5, r2, Operand(1)); 1130 __ AddP(r5, r2, Operand(1));
1131 Generate_StackOverflowCheck(masm, r5, ip, &stack_overflow);
1132
1133 // Push "undefined" as the receiver arg if we need to.
1134 if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) {
1135 __ PushRoot(Heap::kUndefinedValueRootIndex);
1136 __ LoadRR(r5, r2); // Argument count is correct.
1137 }
1135 1138
1136 // Push the arguments. 1139 // Push the arguments.
1137 Generate_InterpreterPushArgs(masm, r5, r4, r5, r6, &stack_overflow); 1140 Generate_InterpreterPushArgs(masm, r5, r4, r5, r6);
1138 1141
1139 // Call the target. 1142 // Call the target.
1140 if (mode == InterpreterPushArgsMode::kJSFunction) { 1143 if (mode == InterpreterPushArgsMode::kJSFunction) {
1141 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, 1144 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny,
1142 tail_call_mode), 1145 tail_call_mode),
1143 RelocInfo::CODE_TARGET); 1146 RelocInfo::CODE_TARGET);
1144 } else if (mode == InterpreterPushArgsMode::kWithFinalSpread) { 1147 } else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
1145 __ Jump(masm->isolate()->builtins()->CallWithSpread(), 1148 __ Jump(masm->isolate()->builtins()->CallWithSpread(),
1146 RelocInfo::CODE_TARGET); 1149 RelocInfo::CODE_TARGET);
1147 } else { 1150 } else {
(...skipping 23 matching lines...) Expand all
1171 Label stack_overflow; 1174 Label stack_overflow;
1172 1175
1173 // Push a slot for the receiver to be constructed. 1176 // Push a slot for the receiver to be constructed.
1174 __ LoadImmP(r0, Operand::Zero()); 1177 __ LoadImmP(r0, Operand::Zero());
1175 __ push(r0); 1178 __ push(r0);
1176 1179
1177 // Push the arguments (skip if none). 1180 // Push the arguments (skip if none).
1178 Label skip; 1181 Label skip;
1179 __ CmpP(r2, Operand::Zero()); 1182 __ CmpP(r2, Operand::Zero());
1180 __ beq(&skip); 1183 __ beq(&skip);
1181 Generate_InterpreterPushArgs(masm, r2, r6, r2, r7, &stack_overflow); 1184 Generate_StackOverflowCheck(masm, r2, ip, &stack_overflow);
1185 Generate_InterpreterPushArgs(masm, r2, r6, r2, r7);
1182 __ bind(&skip); 1186 __ bind(&skip);
1183 1187
1184 __ AssertUndefinedOrAllocationSite(r4, r7); 1188 __ AssertUndefinedOrAllocationSite(r4, r7);
1185 if (mode == InterpreterPushArgsMode::kJSFunction) { 1189 if (mode == InterpreterPushArgsMode::kJSFunction) {
1186 __ AssertFunction(r3); 1190 __ AssertFunction(r3);
1187 1191
1188 // Tail call to the function-specific construct stub (still in the caller 1192 // Tail call to the function-specific construct stub (still in the caller
1189 // context at this point). 1193 // context at this point).
1190 __ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); 1194 __ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset));
1191 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kConstructStubOffset)); 1195 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kConstructStubOffset));
(...skipping 22 matching lines...) Expand all
1214 void Builtins::Generate_InterpreterPushArgsThenConstructArray( 1218 void Builtins::Generate_InterpreterPushArgsThenConstructArray(
1215 MacroAssembler* masm) { 1219 MacroAssembler* masm) {
1216 // ----------- S t a t e ------------- 1220 // ----------- S t a t e -------------
1217 // -- r2 : argument count (not including receiver) 1221 // -- r2 : argument count (not including receiver)
1218 // -- r3 : target to call verified to be Array function 1222 // -- r3 : target to call verified to be Array function
1219 // -- r4 : allocation site feedback if available, undefined otherwise. 1223 // -- r4 : allocation site feedback if available, undefined otherwise.
1220 // -- r5 : address of the first argument 1224 // -- r5 : address of the first argument
1221 // ----------------------------------- 1225 // -----------------------------------
1222 Label stack_overflow; 1226 Label stack_overflow;
1223 1227
1224 __ AddP(r6, r2, Operand(1)); // Add one for receiver. 1228 // Push a slot for the receiver to be constructed.
1229 __ LoadImmP(r0, Operand::Zero());
1230 __ push(r0);
1231
1232 Generate_StackOverflowCheck(masm, r2, ip, &stack_overflow);
1225 1233
1226 // Push the arguments. r6, r8, r3 will be modified. 1234 // Push the arguments. r6, r8, r3 will be modified.
1227 Generate_InterpreterPushArgs(masm, r6, r5, r6, r7, &stack_overflow); 1235 Generate_InterpreterPushArgs(masm, r6, r5, r2, r7);
1228 1236
1229 // Array constructor expects constructor in r5. It is same as r3 here. 1237 // Array constructor expects constructor in r5. It is same as r3 here.
1230 __ LoadRR(r5, r3); 1238 __ LoadRR(r5, r3);
1231 1239
1232 ArrayConstructorStub stub(masm->isolate()); 1240 ArrayConstructorStub stub(masm->isolate());
1233 __ TailCallStub(&stub); 1241 __ TailCallStub(&stub);
1234 1242
1235 __ bind(&stack_overflow); 1243 __ bind(&stack_overflow);
1236 { 1244 {
1237 __ TailCallRuntime(Runtime::kThrowStackOverflow); 1245 __ TailCallRuntime(Runtime::kThrowStackOverflow);
(...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after
3092 // Now jump to the instructions of the returned code object. 3100 // Now jump to the instructions of the returned code object.
3093 __ Jump(ip); 3101 __ Jump(ip);
3094 } 3102 }
3095 3103
3096 #undef __ 3104 #undef __
3097 3105
3098 } // namespace internal 3106 } // namespace internal
3099 } // namespace v8 3107 } // namespace v8
3100 3108
3101 #endif // V8_TARGET_ARCH_S390 3109 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/builtins/ppc/builtins-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698