02a8e9c03a4ba6da395b6a5d75b3bb58b8ed7b5b
[platform/upstream/v8.git] / src / ia32 / simulator-ia32.h
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.
4
5 #ifndef V8_IA32_SIMULATOR_IA32_H_
6 #define V8_IA32_SIMULATOR_IA32_H_
7
8 #include "src/allocation.h"
9
10 namespace v8 {
11 namespace internal {
12
13 // Since there is no simulator for the ia32 architecture the only thing we can
14 // do is to call the entry directly.
15 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
16   (entry(p0, p1, p2, p3, p4))
17
18
19 typedef int (*regexp_matcher)(String*, int, const byte*,
20                               const byte*, int*, int, Address, int, Isolate*);
21
22 // Call the generated regexp code directly. The code at the entry address should
23 // expect eight int/pointer sized arguments and return an int.
24 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
25   (FUNCTION_CAST<regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, p8))
26
27
28 // The stack limit beyond which we will throw stack overflow errors in
29 // generated code. Because generated code on ia32 uses the C stack, we
30 // just use the C stack limit.
31 class SimulatorStack : public v8::internal::AllStatic {
32  public:
33   static inline uintptr_t JsLimitFromCLimit(Isolate* isolate,
34                                             uintptr_t c_limit) {
35     USE(isolate);
36     return c_limit;
37   }
38
39   static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) {
40     return try_catch_address;
41   }
42
43   static inline void UnregisterCTryCatch() { }
44 };
45
46 } }  // namespace v8::internal
47
48 #endif  // V8_IA32_SIMULATOR_IA32_H_