source: webkit/trunk/Source/JavaScriptCore/llint/LLIntThunks.h

Last change on this file was 286901, checked in by ysuzuki@apple.com, 3 years ago

[JSC] Wasm catch thunk should be JIT code to use ExceptionHandlerPtrTag
https://bugs.webkit.org/show_bug.cgi?id=234183

Reviewed by Tadeu Zagallo.

ExceptionHandlerPtrTag is only usable for JITCode. Thus, we should not tag wasm catch LLInt code with it.
This patch fixes it by using trampoline. This is the same to normal LLInt's handleCatchThunk.

  • assembler/JITOperationList.cpp:

(JSC::JITOperationList::populatePointersInJavaScriptCoreForLLInt):

  • llint/LLIntExceptions.cpp:

(JSC::LLInt::handleWasmCatch):
(JSC::LLInt::handleWasmCatchAll):

  • llint/LLIntThunks.cpp:

(JSC::LLInt::handleWasmCatchThunk):
(JSC::LLInt::handleWasmCatchAllThunk):

  • llint/LLIntThunks.h:
File size: 5.0 KB
Line 
1/*
2 * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#pragma once
27
28#include "MacroAssemblerCodeRef.h"
29#include "OpcodeSize.h"
30#include "VM.h"
31#include <wtf/Scope.h>
32
33namespace JSC {
34
35struct ProtoCallFrame;
36typedef int64_t EncodedJSValue;
37
38extern "C" {
39 EncodedJSValue vmEntryToJavaScript(void*, VM*, ProtoCallFrame*);
40 EncodedJSValue vmEntryToNative(void*, VM*, ProtoCallFrame*);
41 EncodedJSValue vmEntryCustomGetter(CPURegister, CPURegister, CPURegister, CPURegister);
42 EncodedJSValue vmEntryCustomSetter(CPURegister, CPURegister, CPURegister, CPURegister, CPURegister);
43 EncodedJSValue vmEntryHostFunction(JSGlobalObject*, CallFrame*, void*);
44}
45
46#if CPU(ARM64E)
47extern "C" {
48 void jitCagePtrGateAfter(void);
49 void vmEntryToJavaScriptGateAfter(void);
50
51 void llint_function_for_call_arity_checkUntagGateAfter(void);
52 void llint_function_for_call_arity_checkTagGateAfter(void);
53 void llint_function_for_construct_arity_checkUntagGateAfter(void);
54 void llint_function_for_construct_arity_checkTagGateAfter(void);
55}
56#endif
57
58inline EncodedJSValue vmEntryToWasm(void* code, VM* vm, ProtoCallFrame* frame)
59{
60 auto clobberizeValidator = makeScopeExit([&] {
61 vm->didEnterVM = true;
62 });
63 code = retagCodePtr<WasmEntryPtrTag, JSEntryPtrTag>(code);
64 return vmEntryToJavaScript(code, vm, frame);
65}
66
67namespace LLInt {
68
69MacroAssemblerCodeRef<JSEntryPtrTag> functionForCallEntryThunk();
70MacroAssemblerCodeRef<JSEntryPtrTag> functionForConstructEntryThunk();
71MacroAssemblerCodeRef<JSEntryPtrTag> functionForCallArityCheckThunk();
72MacroAssemblerCodeRef<JSEntryPtrTag> functionForConstructArityCheckThunk();
73MacroAssemblerCodeRef<JSEntryPtrTag> evalEntryThunk();
74MacroAssemblerCodeRef<JSEntryPtrTag> programEntryThunk();
75MacroAssemblerCodeRef<JSEntryPtrTag> moduleProgramEntryThunk();
76MacroAssemblerCodeRef<JSEntryPtrTag> getHostCallReturnValueThunk();
77MacroAssemblerCodeRef<JSEntryPtrTag> genericReturnPointThunk(OpcodeSize);
78MacroAssemblerCodeRef<JSEntryPtrTag> fuzzerReturnEarlyFromLoopHintThunk();
79
80MacroAssemblerCodeRef<ExceptionHandlerPtrTag> callToThrowThunk();
81MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleUncaughtExceptionThunk();
82MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleCatchThunk(OpcodeSize);
83
84#if ENABLE(WEBASSEMBLY)
85MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleWasmCatchThunk(OpcodeSize);
86MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleWasmCatchAllThunk(OpcodeSize);
87#endif
88
89#if ENABLE(JIT_CAGE)
90MacroAssemblerCodeRef<NativeToJITGatePtrTag> jitCagePtrThunk();
91#endif
92
93#if CPU(ARM64E)
94MacroAssemblerCodeRef<NativeToJITGatePtrTag> createJSGateThunk(void*, PtrTag, const char*);
95MacroAssemblerCodeRef<NativeToJITGatePtrTag> createWasmGateThunk(void*, PtrTag, const char*);
96MacroAssemblerCodeRef<NativeToJITGatePtrTag> createTailCallGate(PtrTag, bool);
97MacroAssemblerCodeRef<NativeToJITGatePtrTag> loopOSREntryGateThunk();
98MacroAssemblerCodeRef<NativeToJITGatePtrTag> entryOSREntryGateThunk();
99MacroAssemblerCodeRef<NativeToJITGatePtrTag> wasmOSREntryGateThunk();
100MacroAssemblerCodeRef<NativeToJITGatePtrTag> exceptionHandlerGateThunk();
101MacroAssemblerCodeRef<NativeToJITGatePtrTag> returnFromLLIntGateThunk();
102MacroAssemblerCodeRef<NativeToJITGatePtrTag> untagGateThunk(void*);
103MacroAssemblerCodeRef<NativeToJITGatePtrTag> tagGateThunk(void*);
104#endif
105
106MacroAssemblerCodeRef<JSEntryPtrTag> normalOSRExitTrampolineThunk();
107#if ENABLE(DFG_JIT)
108MacroAssemblerCodeRef<JSEntryPtrTag> checkpointOSRExitTrampolineThunk();
109MacroAssemblerCodeRef<JSEntryPtrTag> checkpointOSRExitFromInlinedCallTrampolineThunk();
110MacroAssemblerCodeRef<JSEntryPtrTag> returnLocationThunk(OpcodeID, OpcodeSize);
111#endif
112
113#if ENABLE(WEBASSEMBLY)
114MacroAssemblerCodeRef<JITThunkPtrTag> wasmFunctionEntryThunk();
115#endif // ENABLE(WEBASSEMBLY)
116
117} } // namespace JSC::LLInt
Note: See TracBrowser for help on using the repository browser.