|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
2 * vim: set ts=8 sts=4 et sw=4 tw=99: |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef jit_JitCommon_h |
|
8 #define jit_JitCommon_h |
|
9 |
|
10 // Various macros used by all JITs, including YARR. |
|
11 |
|
12 #ifdef JS_ARM_SIMULATOR |
|
13 #include "jit/arm/Simulator-arm.h" |
|
14 |
|
15 // Call into cross-jitted code by following the ABI of the simulated architecture. |
|
16 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7) \ |
|
17 (js::jit::Simulator::Current()->call( \ |
|
18 JS_FUNC_TO_DATA_PTR(uint8_t *, entry), 8, p0, p1, p2, p3, p4, p5, p6, p7) & 0xffffffff) |
|
19 |
|
20 #define CALL_GENERATED_YARR_CODE3(entry, p0, p1, p2) \ |
|
21 js::jit::Simulator::Current()->call(JS_FUNC_TO_DATA_PTR(uint8_t *, entry), 3, p0, p1, p2) |
|
22 |
|
23 #define CALL_GENERATED_YARR_CODE4(entry, p0, p1, p2, p3) \ |
|
24 js::jit::Simulator::Current()->call(JS_FUNC_TO_DATA_PTR(uint8_t *, entry), 4, p0, p1, p2, p3) |
|
25 |
|
26 #define CALL_GENERATED_ASMJS(entry, p0, p1) \ |
|
27 (Simulator::Current()->call(JS_FUNC_TO_DATA_PTR(uint8_t *, entry), 2, p0, p1) & 0xffffffff) |
|
28 |
|
29 #else |
|
30 |
|
31 // Call into jitted code by following the ABI of the native architecture. |
|
32 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7) \ |
|
33 entry(p0, p1, p2, p3, p4, p5, p6, p7) |
|
34 |
|
35 #define CALL_GENERATED_YARR_CODE3(entry, p0, p1, p2) \ |
|
36 entry(p0, p1, p2) |
|
37 |
|
38 #define CALL_GENERATED_YARR_CODE4(entry, p0, p1, p2, p3) \ |
|
39 entry(p0, p1, p2, p3) |
|
40 |
|
41 #define CALL_GENERATED_ASMJS(entry, p0, p1) \ |
|
42 entry(p0, p1) |
|
43 |
|
44 #endif |
|
45 |
|
46 #endif // jit_JitCommon_h |