OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ | 5 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ |
6 #define V8_ARM64_SIMULATOR_ARM64_H_ | 6 #define V8_ARM64_SIMULATOR_ARM64_H_ |
7 | 7 |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 (entry(p0, p1, p2, p3, p4)) | 29 (entry(p0, p1, p2, p3, p4)) |
30 | 30 |
31 typedef int (*arm64_regexp_matcher)(String* input, | 31 typedef int (*arm64_regexp_matcher)(String* input, |
32 int64_t start_offset, | 32 int64_t start_offset, |
33 const byte* input_start, | 33 const byte* input_start, |
34 const byte* input_end, | 34 const byte* input_end, |
35 int* output, | 35 int* output, |
36 int64_t output_size, | 36 int64_t output_size, |
37 Address stack_base, | 37 Address stack_base, |
38 int64_t direct_call, | 38 int64_t direct_call, |
39 void* return_address, | |
40 Isolate* isolate); | 39 Isolate* isolate); |
41 | 40 |
42 // Call the generated regexp code directly. The code at the entry address | 41 // Call the generated regexp code directly. The code at the entry address |
43 // should act as a function matching the type arm64_regexp_matcher. | 42 // should act as a function matching the type arm64_regexp_matcher. |
44 // The ninth argument is a dummy that reserves the space used for | |
45 // the return address added by the ExitFrame in native calls. | |
46 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ | 43 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ |
47 p7, p8) \ | 44 p7, p8) \ |
48 (FUNCTION_CAST<arm64_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \ | 45 (FUNCTION_CAST<arm64_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \ |
49 NULL, p8)) | 46 p8)) |
50 | 47 |
51 // Running without a simulator there is nothing to do. | 48 // Running without a simulator there is nothing to do. |
52 class SimulatorStack : public v8::internal::AllStatic { | 49 class SimulatorStack : public v8::internal::AllStatic { |
53 public: | 50 public: |
54 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, | 51 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, |
55 uintptr_t c_limit) { | 52 uintptr_t c_limit) { |
56 USE(isolate); | 53 USE(isolate); |
57 return c_limit; | 54 return c_limit; |
58 } | 55 } |
59 | 56 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 Object*** argv); | 191 Object*** argv); |
195 int64_t CallRegExp(byte* entry, | 192 int64_t CallRegExp(byte* entry, |
196 String* input, | 193 String* input, |
197 int64_t start_offset, | 194 int64_t start_offset, |
198 const byte* input_start, | 195 const byte* input_start, |
199 const byte* input_end, | 196 const byte* input_end, |
200 int* output, | 197 int* output, |
201 int64_t output_size, | 198 int64_t output_size, |
202 Address stack_base, | 199 Address stack_base, |
203 int64_t direct_call, | 200 int64_t direct_call, |
204 void* return_address, | |
205 Isolate* isolate); | 201 Isolate* isolate); |
206 | 202 |
207 // A wrapper class that stores an argument for one of the above Call | 203 // A wrapper class that stores an argument for one of the above Call |
208 // functions. | 204 // functions. |
209 // | 205 // |
210 // Only arguments up to 64 bits in size are supported. | 206 // Only arguments up to 64 bits in size are supported. |
211 class CallArgument { | 207 class CallArgument { |
212 public: | 208 public: |
213 template<typename T> | 209 template<typename T> |
214 explicit CallArgument(T argument) { | 210 explicit CallArgument(T argument) { |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 | 962 |
967 // When running with the simulator transition into simulated execution at this | 963 // When running with the simulator transition into simulated execution at this |
968 // point. | 964 // point. |
969 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \ | 965 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \ |
970 reinterpret_cast<Object*>(Simulator::current(isolate)->CallJS( \ | 966 reinterpret_cast<Object*>(Simulator::current(isolate)->CallJS( \ |
971 FUNCTION_ADDR(entry), p0, p1, p2, p3, p4)) | 967 FUNCTION_ADDR(entry), p0, p1, p2, p3, p4)) |
972 | 968 |
973 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ | 969 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ |
974 p7, p8) \ | 970 p7, p8) \ |
975 static_cast<int>(Simulator::current(isolate)->CallRegExp( \ | 971 static_cast<int>(Simulator::current(isolate)->CallRegExp( \ |
976 entry, p0, p1, p2, p3, p4, p5, p6, p7, NULL, p8)) | 972 entry, p0, p1, p2, p3, p4, p5, p6, p7, p8)) |
977 | |
978 | 973 |
979 // The simulator has its own stack. Thus it has a different stack limit from | 974 // The simulator has its own stack. Thus it has a different stack limit from |
980 // the C-based native code. The JS-based limit normally points near the end of | 975 // the C-based native code. The JS-based limit normally points near the end of |
981 // the simulator stack. When the C-based limit is exhausted we reflect that by | 976 // the simulator stack. When the C-based limit is exhausted we reflect that by |
982 // lowering the JS-based limit as well, to make stack checks trigger. | 977 // lowering the JS-based limit as well, to make stack checks trigger. |
983 class SimulatorStack : public v8::internal::AllStatic { | 978 class SimulatorStack : public v8::internal::AllStatic { |
984 public: | 979 public: |
985 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, | 980 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, |
986 uintptr_t c_limit) { | 981 uintptr_t c_limit) { |
987 return Simulator::current(isolate)->StackLimit(c_limit); | 982 return Simulator::current(isolate)->StackLimit(c_limit); |
988 } | 983 } |
989 | 984 |
990 static uintptr_t RegisterCTryCatch(v8::internal::Isolate* isolate, | 985 static uintptr_t RegisterCTryCatch(v8::internal::Isolate* isolate, |
991 uintptr_t try_catch_address) { | 986 uintptr_t try_catch_address) { |
992 Simulator* sim = Simulator::current(isolate); | 987 Simulator* sim = Simulator::current(isolate); |
993 return sim->PushAddress(try_catch_address); | 988 return sim->PushAddress(try_catch_address); |
994 } | 989 } |
995 | 990 |
996 static void UnregisterCTryCatch(v8::internal::Isolate* isolate) { | 991 static void UnregisterCTryCatch(v8::internal::Isolate* isolate) { |
997 Simulator::current(isolate)->PopAddress(); | 992 Simulator::current(isolate)->PopAddress(); |
998 } | 993 } |
999 }; | 994 }; |
1000 | 995 |
1001 #endif // !defined(USE_SIMULATOR) | 996 #endif // !defined(USE_SIMULATOR) |
1002 | 997 |
1003 } // namespace internal | 998 } // namespace internal |
1004 } // namespace v8 | 999 } // namespace v8 |
1005 | 1000 |
1006 #endif // V8_ARM64_SIMULATOR_ARM64_H_ | 1001 #endif // V8_ARM64_SIMULATOR_ARM64_H_ |
OLD | NEW |