blob: f1351c88cfe3b9d96d0c7134dc807cf3a2e8c5dc [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_X64_SIMULATOR_X64_H_
6#define V8_X64_SIMULATOR_X64_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
13// Since there is no simulator for the x64 architecture the only thing we can
Steve Blocka7e24c12009-10-30 11:49:00 +000014// do is to call the entry directly.
15// TODO(X64): Don't pass p0, since it isn't used?
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000016#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
John Reck59135872010-11-02 12:39:01 -070017 (entry(p0, p1, p2, p3, p4))
18
Ben Murdoche0cee9b2011-05-25 10:26:03 +010019typedef 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))
Steve Blocka7e24c12009-10-30 11:49:00 +000027
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.
31class SimulatorStack : public v8::internal::AllStatic {
32 public:
Ben Murdoch257744e2011-11-30 15:57:28 +000033 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate,
34 uintptr_t c_limit) {
Steve Blocka7e24c12009-10-30 11:49:00 +000035 return c_limit;
36 }
Steve Blockd0582a62009-12-15 09:54:21 +000037
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000038 static inline uintptr_t RegisterCTryCatch(Isolate* isolate,
39 uintptr_t try_catch_address) {
40 USE(isolate);
Steve Blockd0582a62009-12-15 09:54:21 +000041 return try_catch_address;
42 }
43
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000044 static inline void UnregisterCTryCatch(Isolate* isolate) { USE(isolate); }
Steve Blocka7e24c12009-10-30 11:49:00 +000045};
46
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000047} // namespace internal
48} // namespace v8
Steve Blockd0582a62009-12-15 09:54:21 +000049
Steve Blocka7e24c12009-10-30 11:49:00 +000050#endif // V8_X64_SIMULATOR_X64_H_