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