| 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_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 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 // -- r3 : the number of arguments (not including the receiver) | 1206 // -- r3 : the number of arguments (not including the receiver) |
| 1207 // -- r5 : the address of the first argument to be pushed. Subsequent | 1207 // -- r5 : the address of the first argument to be pushed. Subsequent |
| 1208 // arguments should be consecutive above this, in the same order as | 1208 // arguments should be consecutive above this, in the same order as |
| 1209 // they are to be pushed onto the stack. | 1209 // they are to be pushed onto the stack. |
| 1210 // -- r4 : the target to call (can be any Object). | 1210 // -- r4 : the target to call (can be any Object). |
| 1211 // ----------------------------------- | 1211 // ----------------------------------- |
| 1212 | 1212 |
| 1213 // Calculate number of arguments (add one for receiver). | 1213 // Calculate number of arguments (add one for receiver). |
| 1214 __ addi(r6, r3, Operand(1)); | 1214 __ addi(r6, r3, Operand(1)); |
| 1215 | 1215 |
| 1216 // TODO(mythria): Add a stack check before pushing arguments. |
| 1216 // Push the arguments. | 1217 // Push the arguments. |
| 1217 Generate_InterpreterPushArgs(masm, r5, r6, r7); | 1218 Generate_InterpreterPushArgs(masm, r5, r6, r7); |
| 1218 | 1219 |
| 1219 // Call the target. | 1220 // Call the target. |
| 1220 if (function_type == CallableType::kJSFunction) { | 1221 if (function_type == CallableType::kJSFunction) { |
| 1221 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, | 1222 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, |
| 1222 tail_call_mode), | 1223 tail_call_mode), |
| 1223 RelocInfo::CODE_TARGET); | 1224 RelocInfo::CODE_TARGET); |
| 1224 } else { | 1225 } else { |
| 1225 DCHECK_EQ(function_type, CallableType::kAny); | 1226 DCHECK_EQ(function_type, CallableType::kAny); |
| 1226 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 1227 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 1227 tail_call_mode), | 1228 tail_call_mode), |
| 1228 RelocInfo::CODE_TARGET); | 1229 RelocInfo::CODE_TARGET); |
| 1229 } | 1230 } |
| 1230 } | 1231 } |
| 1231 | 1232 |
| 1232 // static | 1233 // static |
| 1233 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1234 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
| 1235 MacroAssembler* masm, CallableType construct_type) { |
| 1234 // ----------- S t a t e ------------- | 1236 // ----------- S t a t e ------------- |
| 1235 // -- r3 : argument count (not including receiver) | 1237 // -- r3 : argument count (not including receiver) |
| 1236 // -- r6 : new target | 1238 // -- r6 : new target |
| 1237 // -- r4 : constructor to call | 1239 // -- r4 : constructor to call |
| 1238 // -- r5 : address of the first argument | 1240 // -- r5 : allocation site feedback if available, undefined otherwise. |
| 1241 // -- r7 : address of the first argument |
| 1239 // ----------------------------------- | 1242 // ----------------------------------- |
| 1240 | 1243 |
| 1241 // Push a slot for the receiver to be constructed. | 1244 // Push a slot for the receiver to be constructed. |
| 1242 __ li(r0, Operand::Zero()); | 1245 __ li(r0, Operand::Zero()); |
| 1243 __ push(r0); | 1246 __ push(r0); |
| 1244 | 1247 |
| 1245 // Push the arguments (skip if none). | 1248 // Push the arguments (skip if none). |
| 1246 Label skip; | 1249 Label skip; |
| 1247 __ cmpi(r3, Operand::Zero()); | 1250 __ cmpi(r3, Operand::Zero()); |
| 1248 __ beq(&skip); | 1251 __ beq(&skip); |
| 1249 Generate_InterpreterPushArgs(masm, r5, r3, r7); | 1252 Generate_InterpreterPushArgs(masm, r7, r3, r8); |
| 1250 __ bind(&skip); | 1253 __ bind(&skip); |
| 1251 | 1254 |
| 1252 // Call the constructor with r3, r4, and r6 unmodified. | 1255 __ AssertUndefinedOrAllocationSite(r5, r8); |
| 1253 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1256 if (construct_type == CallableType::kJSFunction) { |
| 1257 __ AssertFunction(r4); |
| 1258 |
| 1259 // Tail call to the function-specific construct stub (still in the caller |
| 1260 // context at this point). |
| 1261 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 1262 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); |
| 1263 // Jump to the construct function. |
| 1264 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1265 __ Jump(ip); |
| 1266 |
| 1267 } else { |
| 1268 DCHECK_EQ(construct_type, CallableType::kAny); |
| 1269 // Call the constructor with r3, r4, and r6 unmodified. |
| 1270 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
| 1271 } |
| 1254 } | 1272 } |
| 1255 | 1273 |
| 1256 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1274 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
| 1257 // Set the return address to the correct point in the interpreter entry | 1275 // Set the return address to the correct point in the interpreter entry |
| 1258 // trampoline. | 1276 // trampoline. |
| 1259 Smi* interpreter_entry_return_pc_offset( | 1277 Smi* interpreter_entry_return_pc_offset( |
| 1260 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1278 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
| 1261 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); | 1279 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
| 1262 __ Move(r5, masm->isolate()->builtins()->InterpreterEntryTrampoline()); | 1280 __ Move(r5, masm->isolate()->builtins()->InterpreterEntryTrampoline()); |
| 1263 __ addi(r0, r5, Operand(interpreter_entry_return_pc_offset->value() + | 1281 __ addi(r0, r5, Operand(interpreter_entry_return_pc_offset->value() + |
| (...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3017 __ CallRuntime(Runtime::kThrowStackOverflow); | 3035 __ CallRuntime(Runtime::kThrowStackOverflow); |
| 3018 __ bkpt(0); | 3036 __ bkpt(0); |
| 3019 } | 3037 } |
| 3020 } | 3038 } |
| 3021 | 3039 |
| 3022 #undef __ | 3040 #undef __ |
| 3023 } // namespace internal | 3041 } // namespace internal |
| 3024 } // namespace v8 | 3042 } // namespace v8 |
| 3025 | 3043 |
| 3026 #endif // V8_TARGET_ARCH_PPC | 3044 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |