Debian Codegraph @

src/3rdparty/javascriptcore/JavaScriptCore/assembler/RepatchBuffer.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2009 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 #ifndef RepatchBuffer_h
27 #define RepatchBuffer_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/assembler/RepatchBuffer.h:27:9`!
28
29 #include <wtf/Platform.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h`/
30
31 #if ENABLEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:57:9`!(ASSEMBLER)
32
33 #include <MacroAssembler.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssembler.h`/
34 #include <wtf/Noncopyable.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Noncopyable.h`/
35
36 namespace JSCcxx . . $ `<built-in>:463:9`! {
37
38 // RepatchBuffer:
39 //
40 // This class is used to modify code after code generation has been completed,
41 // and after the code has potentially already been executed. This mechanism is
42 // used to apply optimizations to the code.
43 //
44 class RepatchBuffercxx . . $ QTJSC/RepatchBuffer# {
45 typedef MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr# CodePtrcxx . . $ QTJSC/RepatchBuffer#CodePtr#;
46
47 public:
48 RepatchBuffercxx . . $ QTJSC/RepatchBuffer#RepatchBuffer(d4989c577739c98f).(CodeBlockcxx . . $ QTJSC/CodeBlock#* codeBlock)
49 {
50 JITCodecxx . . $ QTJSC/JITCode#& code = codeBlock->getJITCodecxx . . $ QTJSC/CodeBlock#getJITCode(6fad7ba5423f99e7).();
51 m_startcxx . . $ QTJSC/RepatchBuffer#m_start. = code.startcxx . . $ QTJSC/JITCode#start(50c7df7de5344ebb).();
52 m_sizecxx . . $ QTJSC/RepatchBuffer#m_size. = code.sizecxx . . $ QTJSC/JITCode#size(f708dce9a8856c70).();
53
54 ExecutableAllocatorcxx . . $ QTJSC/ExecutableAllocator#::makeWritablecxx . . $ QTJSC/ExecutableAllocator#makeWritable(5500c4293b1bbef0).(m_startcxx . . $ QTJSC/RepatchBuffer#m_start., m_sizecxx . . $ QTJSC/RepatchBuffer#m_size.);
55 }
56
57 ~cxx . . $ QTJSC/RepatchBuffer#`~RepatchBuffer`(49f6e7a06ebc5aa8).RepatchBuffercxx . . $ QTJSC/RepatchBuffer#()
58 {
59 ExecutableAllocatorcxx . . $ QTJSC/ExecutableAllocator#::makeExecutablecxx . . $ QTJSC/ExecutableAllocator#makeExecutable(5500c4293b1bbef0).(m_startcxx . . $ QTJSC/RepatchBuffer#m_start., m_sizecxx . . $ QTJSC/RepatchBuffer#m_size.);
60 }
61
62 void relinkcxx . . $ QTJSC/RepatchBuffer#relink(2366b7d59c99e47d).(CodeLocationJumpcxx . . $ QTJSC/CodeLocationJump# jump, CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel# destination)
63 {
64 MacroAssembler::repatchJump(jump, destination);
65 }
66
67 void relinkcxx . . $ QTJSC/RepatchBuffer#relink(c0a36f2c54cfa778).(CodeLocationCallcxx . . $ QTJSC/CodeLocationCall# call, CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel# destination)
68 {
69 MacroAssemblercxx . . $ QTJSC/MacroAssembler#::repatchCallcxx . . $ QTJSC/MacroAssemblerX86_64#repatchCall(c0a36f2c54cfa778).(call, destination);
70 }
71
72 void relinkcxx . . $ QTJSC/RepatchBuffer#relink(4410bb8fe0667bc4).(CodeLocationCallcxx . . $ QTJSC/CodeLocationCall# call, FunctionPtrcxx . . $ QTJSC/FunctionPtr# destination)
73 {
74 MacroAssemblercxx . . $ QTJSC/MacroAssembler#::repatchCallcxx . . $ QTJSC/MacroAssemblerX86_64#repatchCall(4410bb8fe0667bc4).(call, destination);
75 }
76
77 void relinkcxx . . $ QTJSC/RepatchBuffer#relink(a82365429be6f13f).(CodeLocationNearCallcxx . . $ QTJSC/CodeLocationNearCall# nearCall, CodePtrcxx . . $ QTJSC/RepatchBuffer#CodePtr# destination)
78 {
79 MacroAssembler::repatchNearCall(nearCall, CodeLocationLabel(destination));
80 }
81
82 void relinkcxx . . $ QTJSC/RepatchBuffer#relink(fbf2b88e8fe425ac).(CodeLocationNearCallcxx . . $ QTJSC/CodeLocationNearCall# nearCall, CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel# destination)
83 {
84 MacroAssembler::repatchNearCall(nearCall, destination);
85 }
86
87 void repatchcxx . . $ QTJSC/RepatchBuffer#repatch(47dcbb7fcb9ba697).(CodeLocationDataLabel32cxx . . $ QTJSC/CodeLocationDataLabel32# dataLabel32, int32_tcxx . . $ int32_t# value)
88 {
89 MacroAssembler::repatchInt32(dataLabel32, value);
90 }
91
92 void repatchcxx . . $ QTJSC/RepatchBuffer#repatch(b183d0f6b14e417b).(CodeLocationDataLabelPtrcxx . . $ QTJSC/CodeLocationDataLabelPtr# dataLabelPtr, void* value)
93 {
94 MacroAssembler::repatchPointer(dataLabelPtr, value);
95 }
96
97 void repatchLoadPtrToLEAcxx . . $ QTJSC/RepatchBuffer#repatchLoadPtrToLEA(65a88ce681c6fecd).(CodeLocationInstructioncxx . . $ QTJSC/CodeLocationInstruction# instruction)
98 {
99 MacroAssembler::repatchLoadPtrToLEA(instruction);
100 }
101
102 void relinkCallerToTrampolinecxx . . $ QTJSC/RepatchBuffer#relinkCallerToTrampoline(a222bd1f27863e62).(ReturnAddressPtrcxx . . $ QTJSC/ReturnAddressPtr# returnAddress, CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel# label)
103 {
104 relinkcxx . . $ QTJSC/RepatchBuffer#relink(c0a36f2c54cfa778).(CodeLocationCallcxx . . $ QTJSC/CodeLocationCall#CodeLocationCall(58f0aa8fe5bb76ca).(CodePtrcxx . . $ QTJSC/RepatchBuffer#CodePtr#(returnAddress)), label);
105 }
106
107 void relinkCallerToTrampolinecxx . . $ QTJSC/RepatchBuffer#relinkCallerToTrampoline(64bc749b1d48dc5f).(ReturnAddressPtrcxx . . $ QTJSC/ReturnAddressPtr# returnAddress, CodePtrcxx . . $ QTJSC/RepatchBuffer#CodePtr# newCalleeFunction)
108 {
109 relinkCallerToTrampolinecxx . . $ QTJSC/RepatchBuffer#relinkCallerToTrampoline(a222bd1f27863e62).(returnAddress, CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel#CodeLocationLabel(58f0aa8fe5bb76ca).(newCalleeFunction));
110 }
111
112 void relinkCallerToFunctioncxx . . $ QTJSC/RepatchBuffer#relinkCallerToFunction(ecbd7ab454a6c949).(ReturnAddressPtrcxx . . $ QTJSC/ReturnAddressPtr# returnAddress, FunctionPtrcxx . . $ QTJSC/FunctionPtr# function)
113 {
114 relinkcxx . . $ QTJSC/RepatchBuffer#relink(4410bb8fe0667bc4).(CodeLocationCallcxx . . $ QTJSC/CodeLocationCall#CodeLocationCall(58f0aa8fe5bb76ca).(CodePtrcxx . . $ QTJSC/RepatchBuffer#CodePtr#(returnAddress)), function);
115 }
116
117 void relinkNearCallerToTrampolinecxx . . $ QTJSC/RepatchBuffer#relinkNearCallerToTrampoline(a222bd1f27863e62).(ReturnAddressPtrcxx . . $ QTJSC/ReturnAddressPtr# returnAddress, CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel# label)
118 {
119 relinkcxx . . $ QTJSC/RepatchBuffer#relink(fbf2b88e8fe425ac).(CodeLocationNearCallcxx . . $ QTJSC/CodeLocationNearCall#CodeLocationNearCall(58f0aa8fe5bb76ca).(CodePtrcxx . . $ QTJSC/RepatchBuffer#CodePtr#(returnAddress)), label);
120 }
121
122 void relinkNearCallerToTrampolinecxx . . $ QTJSC/RepatchBuffer#relinkNearCallerToTrampoline(64bc749b1d48dc5f).(ReturnAddressPtrcxx . . $ QTJSC/ReturnAddressPtr# returnAddress, CodePtrcxx . . $ QTJSC/RepatchBuffer#CodePtr# newCalleeFunction)
123 {
124 relinkNearCallerToTrampolinecxx . . $ QTJSC/RepatchBuffer#relinkNearCallerToTrampoline(a222bd1f27863e62).(returnAddress, CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel#CodeLocationLabel(58f0aa8fe5bb76ca).(newCalleeFunction));
125 }
126
127 private:
128 void* m_startcxx . . $ QTJSC/RepatchBuffer#m_start.;
129 size_t m_sizecxx . . $ QTJSC/RepatchBuffer#m_size.;
130 };
131
132 } // namespace JSC
133
134 #endif // ENABLE(ASSEMBLER)
135
136 #endif // RepatchBuffer_h