Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 4 | |
| 5 | #ifndef V8_X64_SIMULATOR_X64_H_ |
| 6 | #define V8_X64_SIMULATOR_X64_H_ |
| 7 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 8 | #include "src/allocation.h" |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 9 | |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 10 | namespace v8 { |
| 11 | namespace internal { |
| 12 | |
| 13 | // Since there is no simulator for the x64 architecture the only thing we can |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 14 | // do is to call the entry directly. |
| 15 | // TODO(X64): Don't pass p0, since it isn't used? |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 16 | #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \ |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 17 | (entry(p0, p1, p2, p3, p4)) |
| 18 | |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 19 | typedef int (*regexp_matcher)(String*, int, const byte*, |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 20 | const byte*, int*, int, Address, int, Isolate*); |
Ben Murdoch | e0cee9b | 2011-05-25 10:26:03 +0100 | [diff] [blame] | 21 | |
| 22 | // Call the generated regexp code directly. The code at the entry address should |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 23 | // expect eight int/pointer sized arguments and return an int. |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 24 | #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ |
| 25 | p7, p8) \ |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 26 | (FUNCTION_CAST<regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, p8)) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 27 | |
| 28 | // The stack limit beyond which we will throw stack overflow errors in |
| 29 | // generated code. Because generated code on x64 uses the C stack, we |
| 30 | // just use the C stack limit. |
| 31 | class SimulatorStack : public v8::internal::AllStatic { |
| 32 | public: |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 33 | static inline uintptr_t JsLimitFromCLimit(Isolate* isolate, |
| 34 | uintptr_t c_limit) { |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 35 | return c_limit; |
| 36 | } |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 37 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 38 | static inline uintptr_t RegisterCTryCatch(Isolate* isolate, |
| 39 | uintptr_t try_catch_address) { |
| 40 | USE(isolate); |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 41 | return try_catch_address; |
| 42 | } |
| 43 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 44 | static inline void UnregisterCTryCatch(Isolate* isolate) { USE(isolate); } |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 45 | }; |
| 46 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 47 | } // namespace internal |
| 48 | } // namespace v8 |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 49 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 50 | #endif // V8_X64_SIMULATOR_X64_H_ |