blob: 076bde83e608103bee3de1837975e56e97ab0b5e [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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 Blocka7e24c12009-10-30 11:49:00 +00004
5#ifndef V8_IA32_SIMULATOR_IA32_H_
6#define V8_IA32_SIMULATOR_IA32_H_
7
Ben Murdochb8a8cc12014-11-26 15:28:44 +00008#include "src/allocation.h"
Steve Blocka7e24c12009-10-30 11:49:00 +00009
John Reck59135872010-11-02 12:39:01 -070010namespace v8 {
11namespace internal {
12
Steve Blocka7e24c12009-10-30 11:49:00 +000013// Since there is no simulator for the ia32 architecture the only thing we can
14// do is to call the entry directly.
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000015#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
John Reck59135872010-11-02 12:39:01 -070016 (entry(p0, p1, p2, p3, p4))
17
Ben Murdoche0cee9b2011-05-25 10:26:03 +010018
19typedef int (*regexp_matcher)(String*, int, const byte*,
Ben Murdochb8a8cc12014-11-26 15:28:44 +000020 const byte*, int*, int, Address, int, Isolate*);
Ben Murdoche0cee9b2011-05-25 10:26:03 +010021
22// Call the generated regexp code directly. The code at the entry address should
Steve Block44f0eee2011-05-26 01:26:41 +010023// expect eight int/pointer sized arguments and return an int.
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000024#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
25 p7, p8) \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000026 (FUNCTION_CAST<regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, p8))
Ben Murdoche0cee9b2011-05-25 10:26:03 +010027
John Reck59135872010-11-02 12:39:01 -070028
Steve Blocka7e24c12009-10-30 11:49:00 +000029// The stack limit beyond which we will throw stack overflow errors in
30// generated code. Because generated code on ia32 uses the C stack, we
31// just use the C stack limit.
32class SimulatorStack : public v8::internal::AllStatic {
33 public:
Ben Murdoch257744e2011-11-30 15:57:28 +000034 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate,
35 uintptr_t c_limit) {
36 USE(isolate);
Steve Blocka7e24c12009-10-30 11:49:00 +000037 return c_limit;
38 }
Steve Blockd0582a62009-12-15 09:54:21 +000039
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000040 static inline uintptr_t RegisterCTryCatch(v8::internal::Isolate* isolate,
41 uintptr_t try_catch_address) {
42 USE(isolate);
Steve Blockd0582a62009-12-15 09:54:21 +000043 return try_catch_address;
44 }
45
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000046 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) {
47 USE(isolate);
48 }
Steve Blocka7e24c12009-10-30 11:49:00 +000049};
50
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000051} // namespace internal
52} // namespace v8
Steve Blockd0582a62009-12-15 09:54:21 +000053
Steve Blocka7e24c12009-10-30 11:49:00 +000054#endif // V8_IA32_SIMULATOR_IA32_H_