@@ -213,16 +213,23 @@ void initialize()
213213 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::jitCagePtr)] = jitCagePtrThunk ().code ().taggedPtr ();
214214#endif
215215
216+ #if ENABLE(JIT)
217+ #define INITIALIZE_JS_GATE_JIT_PATH (name, tag ) \
218+ if (Options::useJIT ()) { \
219+ codeRef8.construct (createJSGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(LLInt::getCodeFunctionPtr<CFunctionPtrTag>(name##_return_location)), tag, #name)); \
220+ codeRef16.construct (createJSGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(LLInt::getWide16CodeFunctionPtr<CFunctionPtrTag>(name##_return_location)), tag, #name " _wide16" )); \
221+ codeRef32.construct (createJSGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(LLInt::getWide32CodeFunctionPtr<CFunctionPtrTag>(name##_return_location)), tag, #name " _wide32" )); \
222+ } else
223+ #else
224+ #define INITIALIZE_JS_GATE_JIT_PATH (name, tag )
225+ #endif
226+
216227#define INITIALIZE_JS_GATE (name, tag ) \
217228 do { \
218229 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef8; \
219230 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef16; \
220231 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef32; \
221- if (Options::useJIT ()) { \
222- codeRef8.construct (createJSGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(LLInt::getCodeFunctionPtr<CFunctionPtrTag>(name##_return_location)), tag, #name)); \
223- codeRef16.construct (createJSGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(LLInt::getWide16CodeFunctionPtr<CFunctionPtrTag>(name##_return_location)), tag, #name " _wide16" )); \
224- codeRef32.construct (createJSGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(LLInt::getWide32CodeFunctionPtr<CFunctionPtrTag>(name##_return_location)), tag, #name " _wide32" )); \
225- } else { \
232+ INITIALIZE_JS_GATE_JIT_PATH (name, tag) { \
226233 codeRef8.construct (LLInt::getCodeRef<NativeToJITGatePtrTag>(js_trampoline_##name)); \
227234 codeRef16.construct (LLInt::getWide16CodeRef<NativeToJITGatePtrTag>(js_trampoline_##name)); \
228235 codeRef32.construct (LLInt::getWide32CodeRef<NativeToJITGatePtrTag>(js_trampoline_##name)); \
@@ -236,16 +243,23 @@ void initialize()
236243
237244#if ENABLE(WEBASSEMBLY)
238245
246+ #if ENABLE(JIT)
247+ #define INITIALIZE_WASM_GATE_JIT_PATH (name, tag ) \
248+ if (Options::useJIT ()) { \
249+ codeRef8.construct (createWasmGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(LLInt::getCodeFunctionPtr<CFunctionPtrTag>(name##_return_location)), tag, #name)); \
250+ codeRef16.construct (createWasmGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(LLInt::getWide16CodeFunctionPtr<CFunctionPtrTag>(name##_return_location)), tag, #name " _wide16" )); \
251+ codeRef32.construct (createWasmGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(LLInt::getWide32CodeFunctionPtr<CFunctionPtrTag>(name##_return_location)), tag, #name " _wide32" )); \
252+ } else
253+ #else
254+ #define INITIALIZE_WASM_GATE_JIT_PATH (name, tag )
255+ #endif
256+
239257#define INITIALIZE_WASM_GATE (name, tag ) \
240258 do { \
241259 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef8; \
242260 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef16; \
243261 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef32; \
244- if (Options::useJIT ()) { \
245- codeRef8.construct (createWasmGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(LLInt::getCodeFunctionPtr<CFunctionPtrTag>(name##_return_location)), tag, #name)); \
246- codeRef16.construct (createWasmGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(LLInt::getWide16CodeFunctionPtr<CFunctionPtrTag>(name##_return_location)), tag, #name " _wide16" )); \
247- codeRef32.construct (createWasmGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(LLInt::getWide32CodeFunctionPtr<CFunctionPtrTag>(name##_return_location)), tag, #name " _wide32" )); \
248- } else { \
262+ INITIALIZE_WASM_GATE_JIT_PATH (name, tag) { \
249263 codeRef8.construct (LLInt::getCodeRef<NativeToJITGatePtrTag>(wasm_trampoline_##name)); \
250264 codeRef16.construct (LLInt::getWide16CodeRef<NativeToJITGatePtrTag>(wasm_trampoline_##name)); \
251265 codeRef32.construct (LLInt::getWide32CodeRef<NativeToJITGatePtrTag>(wasm_trampoline_##name)); \
@@ -263,10 +277,12 @@ void initialize()
263277 // This is key to entering the interpreter.
264278 {
265279 static LazyNeverDestroyed<MacroAssemblerCodeRef<VMEntryToJITGatePtrTag>> codeRef;
280+ #if ENABLE(JIT)
266281 if (Options::useJIT ()) {
267282 auto gateCodeRef = createJSGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(&vmEntryToJavaScriptGateAfter), JSEntryPtrTag, " vmEntryToJavaScript" );
268283 codeRef.construct (gateCodeRef.retagged <VMEntryToJITGatePtrTag>());
269284 } else
285+ #endif
270286 codeRef.construct (MacroAssemblerCodeRef<VMEntryToJITGatePtrTag>::createSelfManagedCodeRef (CodePtr<VMEntryToJITGatePtrTag>::fromTaggedPtr (retagCodePtr<void *, CFunctionPtrTag, VMEntryToJITGatePtrTag>(&vmEntryToJavaScriptTrampoline))));
271287 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::vmEntryToJavaScript)] = codeRef.get ().code ().taggedPtr ();
272288 }
@@ -278,66 +294,83 @@ void initialize()
278294
279295 {
280296 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef;
297+ #if ENABLE(JIT)
281298 if (Options::useJIT ())
282299 codeRef.construct (createTailCallGate (JSEntryPtrTag, true ));
283300 else
301+ #endif
284302 codeRef.construct (MacroAssemblerCodeRef<NativeToJITGatePtrTag>::createSelfManagedCodeRef (CodePtr<NativeToJITGatePtrTag>::fromTaggedPtr (retagCodePtr<void *, CFunctionPtrTag, NativeToJITGatePtrTag>(&tailCallJSEntryTrampoline))));
285303 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::tailCallJSEntryPtrTag)]= codeRef.get ().code ().taggedPtr ();
286304 }
287305 {
288306 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef;
307+ #if ENABLE(JIT)
289308 if (Options::useJIT ())
290309 codeRef.construct (createTailCallGate (JSEntryPtrTag, true ));
291310 else
311+ #endif
292312 codeRef.construct (MacroAssemblerCodeRef<NativeToJITGatePtrTag>::createSelfManagedCodeRef (CodePtr<NativeToJITGatePtrTag>::fromTaggedPtr (retagCodePtr<void *, CFunctionPtrTag, NativeToJITGatePtrTag>(&tailCallJSEntrySlowPathTrampoline))));
293313 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::tailCallJSEntrySlowPathPtrTag)] = codeRef.get ().code ().taggedPtr ();
294314 }
295315 {
296316 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef;
317+ #if ENABLE(JIT)
297318 if (Options::useJIT ())
298319 codeRef.construct (createTailCallGate (JSEntryPtrTag, false ));
299320 else
321+ #endif
300322 codeRef.construct (MacroAssemblerCodeRef<NativeToJITGatePtrTag>::createSelfManagedCodeRef (CodePtr<NativeToJITGatePtrTag>::fromTaggedPtr (retagCodePtr<void *, CFunctionPtrTag, NativeToJITGatePtrTag>(&tailCallWithoutUntagJSEntryTrampoline))));
301323 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::tailCallWithoutUntagJSEntryPtrTag)]= codeRef.get ().code ().taggedPtr ();
302324 }
303325 {
304326 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef;
327+ #if ENABLE(JIT)
305328 if (Options::useJIT ())
306329 codeRef.construct (createWasmTailCallGate (WasmEntryPtrTag));
307330 else
331+ #endif
308332 codeRef.construct (MacroAssemblerCodeRef<NativeToJITGatePtrTag>::createSelfManagedCodeRef (CodePtr<NativeToJITGatePtrTag>::fromTaggedPtr (retagCodePtr<void *, CFunctionPtrTag, NativeToJITGatePtrTag>(&wasmTailCallTrampoline))));
309333 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::wasmTailCallWasmEntryPtrTag)]= codeRef.get ().code ().taggedPtr ();
310334 }
311335 {
312336 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef;
337+ #if ENABLE(JIT)
313338 if (Options::useJIT ())
314339 codeRef.construct (createWasmTailCallGate (WasmEntryPtrTag));
315340 else
341+ #endif
316342 codeRef.construct (MacroAssemblerCodeRef<NativeToJITGatePtrTag>::createSelfManagedCodeRef (CodePtr<NativeToJITGatePtrTag>::fromTaggedPtr (retagCodePtr<void *, CFunctionPtrTag, NativeToJITGatePtrTag>(&wasmTailCallTrampoline))));
317343 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::wasmIPIntTailCallWasmEntryPtrTag)]= codeRef.get ().code ().taggedPtr ();
318344 }
319345 {
320346 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef;
347+ #if ENABLE(JIT)
321348 if (Options::useJIT ())
322349 codeRef.construct (exceptionHandlerGateThunk ());
323350 else
351+ #endif
324352 codeRef.construct (MacroAssemblerCodeRef<NativeToJITGatePtrTag>::createSelfManagedCodeRef (CodePtr<NativeToJITGatePtrTag>::fromTaggedPtr (retagCodePtr<void *, CFunctionPtrTag, NativeToJITGatePtrTag>(&exceptionHandlerTrampoline))));
325353 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::exceptionHandler)] = codeRef.get ().code ().taggedPtr ();
326354 }
327355 {
328356 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> codeRef;
357+ #if ENABLE(JIT)
329358 if (Options::useJIT ())
330359 codeRef.construct (returnFromLLIntGateThunk ());
331360 else
361+ #endif
332362 codeRef.construct (MacroAssemblerCodeRef<NativeToJITGatePtrTag>::createSelfManagedCodeRef (CodePtr<NativeToJITGatePtrTag>::fromTaggedPtr (retagCodePtr<void *, CFunctionPtrTag, NativeToJITGatePtrTag>(&returnFromLLIntTrampoline))));
333363 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::returnFromLLInt)] = codeRef.get ().code ().taggedPtr ();
334364 }
335365
366+ #if ENABLE(JIT)
336367 if (Options::useJIT ()) {
337368 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::loopOSREntry)] = loopOSREntryGateThunk ().code ().taggedPtr ();
338369 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::entryOSREntry)] = entryOSREntryGateThunk ().code ().taggedPtr ();
339370 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::wasmOSREntry)] = wasmOSREntryGateThunk ().code ().taggedPtr ();
340- } else {
371+ } else
372+ #endif
373+ {
341374 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::loopOSREntry)] = LLInt::getCodeRef<NativeToJITGatePtrTag>(loop_osr_entry_gate).code ().taggedPtr ();
342375 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::entryOSREntry)] = nullptr ;
343376 g_jscConfig.llint .gateMap [static_cast <unsigned >(Gate::wasmOSREntry)] = nullptr ;
@@ -371,14 +404,21 @@ void initialize()
371404 }
372405#endif
373406
407+ #if ENABLE(JIT)
408+ #define INITIALIZE_TAG_AND_UNTAG_THUNKS_JIT_PATH (name ) \
409+ if (Options::useJIT ()) { \
410+ tagCodeRef.construct (tagGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(name##TagGateAfter))); \
411+ untagCodeRef.construct (untagGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(name##UntagGateAfter))); \
412+ } else
413+ #else
414+ #define INITIALIZE_TAG_AND_UNTAG_THUNKS_JIT_PATH (name )
415+ #endif
416+
374417#define INITIALIZE_TAG_AND_UNTAG_THUNKS (name ) \
375418 do { \
376419 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> tagCodeRef; \
377420 static LazyNeverDestroyed<MacroAssemblerCodeRef<NativeToJITGatePtrTag>> untagCodeRef; \
378- if (Options::useJIT ()) { \
379- tagCodeRef.construct (tagGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(name##TagGateAfter))); \
380- untagCodeRef.construct (untagGateThunk (retagCodePtr<void *, CFunctionPtrTag, OperationPtrTag>(name##UntagGateAfter))); \
381- } else { \
421+ INITIALIZE_TAG_AND_UNTAG_THUNKS_JIT_PATH (name) { \
382422 tagCodeRef.construct (LLInt::getCodeRef<NativeToJITGatePtrTag>(js_trampoline_##name##_tag)); \
383423 untagCodeRef.construct (LLInt::getCodeRef<NativeToJITGatePtrTag>(js_trampoline_##name##_untag)); \
384424 } \
0 commit comments