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