1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
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/. */
7 #ifndef jit_JitCommon_h
8 #define jit_JitCommon_h
10 // Various macros used by all JITs.
12 #if defined(JS_SIMULATOR_ARM)
13 # include "jit/arm/Simulator-arm.h"
14 #elif defined(JS_SIMULATOR_ARM64)
15 # include "jit/arm64/vixl/Simulator-vixl.h"
16 #elif defined(JS_SIMULATOR_MIPS32)
17 # include "jit/mips32/Simulator-mips32.h"
18 #elif defined(JS_SIMULATOR_MIPS64)
19 # include "jit/mips64/Simulator-mips64.h"
23 // Call into cross-jitted code by following the ABI of the simulated
25 # define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7) \
26 (js::jit::Simulator::Current()->call( \
27 JS_FUNC_TO_DATA_PTR(uint8_t*, entry), 8, intptr_t(p0), intptr_t(p1), \
28 intptr_t(p2), intptr_t(p3), intptr_t(p4), intptr_t(p5), intptr_t(p6), \
31 # define CALL_GENERATED_1(entry, p0) \
32 (js::jit::Simulator::Current()->call(JS_FUNC_TO_DATA_PTR(uint8_t*, entry), \
35 # define CALL_GENERATED_2(entry, p0, p1) \
36 (js::jit::Simulator::Current()->call(JS_FUNC_TO_DATA_PTR(uint8_t*, entry), \
37 2, intptr_t(p0), intptr_t(p1)))
39 # define CALL_GENERATED_3(entry, p0, p1, p2) \
40 (js::jit::Simulator::Current()->call(JS_FUNC_TO_DATA_PTR(uint8_t*, entry), \
41 3, intptr_t(p0), intptr_t(p1), \
46 // Call into jitted code by following the ABI of the native architecture.
47 # define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7) \
48 entry(p0, p1, p2, p3, p4, p5, p6, p7)
50 # define CALL_GENERATED_1(entry, p0) entry(p0)
51 # define CALL_GENERATED_2(entry, p0, p1) entry(p0, p1)
52 # define CALL_GENERATED_3(entry, p0, p1, p2) entry(p0, p1, p2)
56 #endif // jit_JitCommon_h