JitCommon.h (2292B)
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/. */ 6 7 #ifndef jit_JitCommon_h 8 #define jit_JitCommon_h 9 10 // Various macros used by all JITs. 11 12 #include "jit/Simulator.h" 13 14 #ifdef JS_SIMULATOR 15 // Call into cross-jitted code by following the ABI of the simulated 16 // architecture. 17 # define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7) \ 18 (js::jit::Simulator::Current()->call( \ 19 JS_FUNC_TO_DATA_PTR(uint8_t*, entry), 8, intptr_t(p0), intptr_t(p1), \ 20 intptr_t(p2), intptr_t(p3), intptr_t(p4), intptr_t(p5), intptr_t(p6), \ 21 intptr_t(p7))) 22 23 # define CALL_GENERATED_0(entry) \ 24 (js::jit::Simulator::Current()->call(JS_FUNC_TO_DATA_PTR(uint8_t*, entry), \ 25 0)) 26 27 # define CALL_GENERATED_1(entry, p0) \ 28 (js::jit::Simulator::Current()->call(JS_FUNC_TO_DATA_PTR(uint8_t*, entry), \ 29 1, intptr_t(p0))) 30 31 # define CALL_GENERATED_2(entry, p0, p1) \ 32 (js::jit::Simulator::Current()->call(JS_FUNC_TO_DATA_PTR(uint8_t*, entry), \ 33 2, intptr_t(p0), intptr_t(p1))) 34 35 # define CALL_GENERATED_3(entry, p0, p1, p2) \ 36 (js::jit::Simulator::Current()->call(JS_FUNC_TO_DATA_PTR(uint8_t*, entry), \ 37 3, intptr_t(p0), intptr_t(p1), \ 38 intptr_t(p2))) 39 40 #else 41 42 // Call into jitted code by following the ABI of the native architecture. 43 # define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7) \ 44 entry(p0, p1, p2, p3, p4, p5, p6, p7) 45 46 # define CALL_GENERATED_0(entry) entry() 47 # define CALL_GENERATED_1(entry, p0) entry(p0) 48 # define CALL_GENERATED_2(entry, p0, p1) entry(p0, p1) 49 # define CALL_GENERATED_3(entry, p0, p1, p2) entry(p0, p1, p2) 50 51 #endif 52 53 #endif // jit_JitCommon_h