| 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 // Declares a Simulator for S390 instructions if we are not generating a native | 5 // Declares a Simulator for S390 instructions if we are not generating a native |
| 6 // S390 binary. This Simulator allows us to run and debug S390 code generation | 6 // S390 binary. This Simulator allows us to run and debug S390 code generation |
| 7 // on regular desktop machines. | 7 // on regular desktop machines. |
| 8 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, | 8 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, |
| 9 // which will start execution in the Simulator or forwards to the real entry | 9 // which will start execution in the Simulator or forwards to the real entry |
| 10 // on a S390 hardware platform. | 10 // on a S390 hardware platform. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 typedef int (*s390_regexp_matcher)(String*, int, const byte*, const byte*, int*, | 27 typedef int (*s390_regexp_matcher)(String*, int, const byte*, const byte*, int*, |
| 28 int, Address, int, void*, Isolate*); | 28 int, Address, int, void*, Isolate*); |
| 29 | 29 |
| 30 // Call the generated regexp code directly. The code at the entry address | 30 // Call the generated regexp code directly. The code at the entry address |
| 31 // should act as a function matching the type ppc_regexp_matcher. | 31 // should act as a function matching the type ppc_regexp_matcher. |
| 32 // The ninth argument is a dummy that reserves the space used for | 32 // The ninth argument is a dummy that reserves the space used for |
| 33 // the return address added by the ExitFrame in native calls. | 33 // the return address added by the ExitFrame in native calls. |
| 34 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ | 34 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ |
| 35 p7, p8) \ | 35 p7, p8) \ |
| 36 (FUNCTION_CAST<s390_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \ | 36 (FUNCTION_CAST<s390_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \ |
| 37 NULL, p8)) | 37 p8)) |
| 38 | 38 |
| 39 // The stack limit beyond which we will throw stack overflow errors in | 39 // The stack limit beyond which we will throw stack overflow errors in |
| 40 // generated code. Because generated code on s390 uses the C stack, we | 40 // generated code. Because generated code on s390 uses the C stack, we |
| 41 // just use the C stack limit. | 41 // just use the C stack limit. |
| 42 class SimulatorStack : public v8::internal::AllStatic { | 42 class SimulatorStack : public v8::internal::AllStatic { |
| 43 public: | 43 public: |
| 44 static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, | 44 static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, |
| 45 uintptr_t c_limit) { | 45 uintptr_t c_limit) { |
| 46 USE(isolate); | 46 USE(isolate); |
| 47 return c_limit; | 47 return c_limit; |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 | 1252 |
| 1253 // When running with the simulator transition into simulated execution at this | 1253 // When running with the simulator transition into simulated execution at this |
| 1254 // point. | 1254 // point. |
| 1255 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \ | 1255 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \ |
| 1256 reinterpret_cast<Object*>(Simulator::current(isolate)->Call( \ | 1256 reinterpret_cast<Object*>(Simulator::current(isolate)->Call( \ |
| 1257 FUNCTION_ADDR(entry), 5, (intptr_t)p0, (intptr_t)p1, (intptr_t)p2, \ | 1257 FUNCTION_ADDR(entry), 5, (intptr_t)p0, (intptr_t)p1, (intptr_t)p2, \ |
| 1258 (intptr_t)p3, (intptr_t)p4)) | 1258 (intptr_t)p3, (intptr_t)p4)) |
| 1259 | 1259 |
| 1260 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ | 1260 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ |
| 1261 p7, p8) \ | 1261 p7, p8) \ |
| 1262 Simulator::current(isolate)->Call(entry, 10, (intptr_t)p0, (intptr_t)p1, \ | 1262 Simulator::current(isolate)->Call( \ |
| 1263 (intptr_t)p2, (intptr_t)p3, (intptr_t)p4, \ | 1263 entry, 10, (intptr_t)p0, (intptr_t)p1, (intptr_t)p2, (intptr_t)p3, \ |
| 1264 (intptr_t)p5, (intptr_t)p6, (intptr_t)p7, \ | 1264 (intptr_t)p4, (intptr_t)p5, (intptr_t)p6, (intptr_t)p7, (intptr_t)p8) |
| 1265 (intptr_t)NULL, (intptr_t)p8) | |
| 1266 | 1265 |
| 1267 // The simulator has its own stack. Thus it has a different stack limit from | 1266 // The simulator has its own stack. Thus it has a different stack limit from |
| 1268 // the C-based native code. The JS-based limit normally points near the end of | 1267 // the C-based native code. The JS-based limit normally points near the end of |
| 1269 // the simulator stack. When the C-based limit is exhausted we reflect that by | 1268 // the simulator stack. When the C-based limit is exhausted we reflect that by |
| 1270 // lowering the JS-based limit as well, to make stack checks trigger. | 1269 // lowering the JS-based limit as well, to make stack checks trigger. |
| 1271 class SimulatorStack : public v8::internal::AllStatic { | 1270 class SimulatorStack : public v8::internal::AllStatic { |
| 1272 public: | 1271 public: |
| 1273 static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, | 1272 static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, |
| 1274 uintptr_t c_limit) { | 1273 uintptr_t c_limit) { |
| 1275 return Simulator::current(isolate)->StackLimit(c_limit); | 1274 return Simulator::current(isolate)->StackLimit(c_limit); |
| 1276 } | 1275 } |
| 1277 | 1276 |
| 1278 static inline uintptr_t RegisterCTryCatch(v8::internal::Isolate* isolate, | 1277 static inline uintptr_t RegisterCTryCatch(v8::internal::Isolate* isolate, |
| 1279 uintptr_t try_catch_address) { | 1278 uintptr_t try_catch_address) { |
| 1280 Simulator* sim = Simulator::current(isolate); | 1279 Simulator* sim = Simulator::current(isolate); |
| 1281 return sim->PushAddress(try_catch_address); | 1280 return sim->PushAddress(try_catch_address); |
| 1282 } | 1281 } |
| 1283 | 1282 |
| 1284 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { | 1283 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { |
| 1285 Simulator::current(isolate)->PopAddress(); | 1284 Simulator::current(isolate)->PopAddress(); |
| 1286 } | 1285 } |
| 1287 }; | 1286 }; |
| 1288 | 1287 |
| 1289 } // namespace internal | 1288 } // namespace internal |
| 1290 } // namespace v8 | 1289 } // namespace v8 |
| 1291 | 1290 |
| 1292 #endif // !defined(USE_SIMULATOR) | 1291 #endif // !defined(USE_SIMULATOR) |
| 1293 #endif // V8_S390_SIMULATOR_S390_H_ | 1292 #endif // V8_S390_SIMULATOR_S390_H_ |
| OLD | NEW |