| 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 CodeLocation_h |
| 27 | #define CodeLocation_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/assembler/CodeLocation.h:27:9`! |
| 28 | |
| 29 | #include <wtf/Platform.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h`/ |
| 30 | |
| 31 | #include <MacroAssemblerCodeRef.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h`/ |
| 32 | |
| 33 | #if ENABLEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:57:9`!(ASSEMBLER) |
| 34 | |
| 35 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 36 | |
| 37 | class CodeLocationInstructioncxx . . $ QTJSC/CodeLocationInstruction#; |
| 38 | class CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel#; |
| 39 | class CodeLocationJumpcxx . . $ QTJSC/CodeLocationJump#; |
| 40 | class CodeLocationCallcxx . . $ QTJSC/CodeLocationCall#; |
| 41 | class CodeLocationNearCallcxx . . $ QTJSC/CodeLocationNearCall#; |
| 42 | class CodeLocationDataLabel32cxx . . $ QTJSC/CodeLocationDataLabel32#; |
| 43 | class CodeLocationDataLabelPtrcxx . . $ QTJSC/CodeLocationDataLabelPtr#; |
| 44 | |
| 45 | // The CodeLocation* types are all pretty much do-nothing wrappers around |
| 46 | // CodePtr (or MacroAssemblerCodePtr, to give it its full name). These |
| 47 | // classes only exist to provide type-safety when linking and patching code. |
| 48 | // |
| 49 | // The one new piece of functionallity introduced by these classes is the |
| 50 | // ability to create (or put another way, to re-discover) another CodeLocation |
| 51 | // at an offset from one you already know. When patching code to optimize it |
| 52 | // we often want to patch a number of instructions that are short, fixed |
| 53 | // offsets apart. To reduce memory overhead we will only retain a pointer to |
| 54 | // one of the instructions, and we will use the *AtOffset methods provided by |
| 55 | // CodeLocationCommon to find the other points in the code to modify. |
| 56 | class CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon# : public MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr# { |
| 57 | public: |
| 58 | CodeLocationInstructioncxx . . $ QTJSC/CodeLocationInstruction# instructionAtOffsetcxx . . $ QTJSC/CodeLocationCommon#instructionAtOffset(f56b5ad3a122cd17).(int offset); |
| 59 | CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel# labelAtOffsetcxx . . $ QTJSC/CodeLocationCommon#labelAtOffset(3e9f8056418e175b).(int offset); |
| 60 | CodeLocationJumpcxx . . $ QTJSC/CodeLocationJump# jumpAtOffsetcxx . . $ QTJSC/CodeLocationCommon#jumpAtOffset(1e22d9afbd76c02f).(int offset); |
| 61 | CodeLocationCallcxx . . $ QTJSC/CodeLocationCall# callAtOffsetcxx . . $ QTJSC/CodeLocationCommon#callAtOffset(9c800df4b359ec60).(int offset); |
| 62 | CodeLocationNearCallcxx . . $ QTJSC/CodeLocationNearCall# nearCallAtOffsetcxx . . $ QTJSC/CodeLocationCommon#nearCallAtOffset(efdfc153700bf92f).(int offset); |
| 63 | CodeLocationDataLabelPtrcxx . . $ QTJSC/CodeLocationDataLabelPtr# dataLabelPtrAtOffsetcxx . . $ QTJSC/CodeLocationCommon#dataLabelPtrAtOffset(d5aa6e4b803a9c02).(int offset); |
| 64 | CodeLocationDataLabel32cxx . . $ QTJSC/CodeLocationDataLabel32# dataLabel32AtOffsetcxx . . $ QTJSC/CodeLocationCommon#dataLabel32AtOffset(1a69f8685b0bd7ff).(int offset); |
| 65 | |
| 66 | protected: |
| 67 | CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#CodeLocationCommon(49f6e7a06ebc5aa8).() |
| 68 | { |
| 69 | } |
| 70 | |
| 71 | CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#CodeLocationCommon(58f0aa8fe5bb76ca).(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr# location) |
| 72 | : MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr#(location) |
| 73 | { |
| 74 | } |
| 75 | }; |
| 76 | |
| 77 | class CodeLocationInstructioncxx . . $ QTJSC/CodeLocationInstruction# : public CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon# { |
| 78 | public: |
| 79 | CodeLocationInstructioncxx . . $ QTJSC/CodeLocationInstruction#CodeLocationInstruction(49f6e7a06ebc5aa8).() {} |
| 80 | explicit CodeLocationInstructioncxx . . $ QTJSC/CodeLocationInstruction#CodeLocationInstruction(58f0aa8fe5bb76ca).(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr# location) |
| 81 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(location) {} |
| 82 | explicit CodeLocationInstructioncxx . . $ QTJSC/CodeLocationInstruction#CodeLocationInstruction(5d22bdacc48458e8).(void* location) |
| 83 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr#(location)) {} |
| 84 | }; |
| 85 | |
| 86 | class CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel# : public CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon# { |
| 87 | public: |
| 88 | CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel#CodeLocationLabel(49f6e7a06ebc5aa8).() {} |
| 89 | explicit CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel#CodeLocationLabel(58f0aa8fe5bb76ca).(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr# location) |
| 90 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(location) {} |
| 91 | explicit CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel#CodeLocationLabel(5d22bdacc48458e8).(void* location) |
| 92 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr#(location)) {} |
| 93 | }; |
| 94 | |
| 95 | class CodeLocationJumpcxx . . $ QTJSC/CodeLocationJump# : public CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon# { |
| 96 | public: |
| 97 | CodeLocationJumpcxx . . $ QTJSC/CodeLocationJump#CodeLocationJump(49f6e7a06ebc5aa8).() {} |
| 98 | explicit CodeLocationJumpcxx . . $ QTJSC/CodeLocationJump#CodeLocationJump(58f0aa8fe5bb76ca).(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr# location) |
| 99 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(location) {} |
| 100 | explicit CodeLocationJumpcxx . . $ QTJSC/CodeLocationJump#CodeLocationJump(5d22bdacc48458e8).(void* location) |
| 101 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr#(location)) {} |
| 102 | }; |
| 103 | |
| 104 | class CodeLocationCallcxx . . $ QTJSC/CodeLocationCall# : public CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon# { |
| 105 | public: |
| 106 | CodeLocationCallcxx . . $ QTJSC/CodeLocationCall#CodeLocationCall(49f6e7a06ebc5aa8).() {} |
| 107 | explicit CodeLocationCallcxx . . $ QTJSC/CodeLocationCall#CodeLocationCall(58f0aa8fe5bb76ca).(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr# location) |
| 108 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(location) {} |
| 109 | explicit CodeLocationCallcxx . . $ QTJSC/CodeLocationCall#CodeLocationCall(5d22bdacc48458e8).(void* location) |
| 110 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr#(location)) {} |
| 111 | }; |
| 112 | |
| 113 | class CodeLocationNearCallcxx . . $ QTJSC/CodeLocationNearCall# : public CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon# { |
| 114 | public: |
| 115 | CodeLocationNearCallcxx . . $ QTJSC/CodeLocationNearCall#CodeLocationNearCall(49f6e7a06ebc5aa8).() {} |
| 116 | explicit CodeLocationNearCallcxx . . $ QTJSC/CodeLocationNearCall#CodeLocationNearCall(58f0aa8fe5bb76ca).(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr# location) |
| 117 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(location) {} |
| 118 | explicit CodeLocationNearCallcxx . . $ QTJSC/CodeLocationNearCall#CodeLocationNearCall(5d22bdacc48458e8).(void* location) |
| 119 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr#(location)) {} |
| 120 | }; |
| 121 | |
| 122 | class CodeLocationDataLabel32cxx . . $ QTJSC/CodeLocationDataLabel32# : public CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon# { |
| 123 | public: |
| 124 | CodeLocationDataLabel32cxx . . $ QTJSC/CodeLocationDataLabel32#CodeLocationDataLabel32(49f6e7a06ebc5aa8).() {} |
| 125 | explicit CodeLocationDataLabel32cxx . . $ QTJSC/CodeLocationDataLabel32#CodeLocationDataLabel32(58f0aa8fe5bb76ca).(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr# location) |
| 126 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(location) {} |
| 127 | explicit CodeLocationDataLabel32cxx . . $ QTJSC/CodeLocationDataLabel32#CodeLocationDataLabel32(5d22bdacc48458e8).(void* location) |
| 128 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr#(location)) {} |
| 129 | }; |
| 130 | |
| 131 | class CodeLocationDataLabelPtrcxx . . $ QTJSC/CodeLocationDataLabelPtr# : public CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon# { |
| 132 | public: |
| 133 | CodeLocationDataLabelPtrcxx . . $ QTJSC/CodeLocationDataLabelPtr#CodeLocationDataLabelPtr(49f6e7a06ebc5aa8).() {} |
| 134 | explicit CodeLocationDataLabelPtrcxx . . $ QTJSC/CodeLocationDataLabelPtr#CodeLocationDataLabelPtr(58f0aa8fe5bb76ca).(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr# location) |
| 135 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(location) {} |
| 136 | explicit CodeLocationDataLabelPtrcxx . . $ QTJSC/CodeLocationDataLabelPtr#CodeLocationDataLabelPtr(5d22bdacc48458e8).(void* location) |
| 137 | : CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#(MacroAssemblerCodePtrcxx . . $ QTJSC/MacroAssemblerCodePtr#(location)) {} |
| 138 | }; |
| 139 | |
| 140 | inline CodeLocationInstructioncxx . . $ QTJSC/CodeLocationInstruction# CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#::instructionAtOffsetcxx . . $ QTJSC/CodeLocationCommon#instructionAtOffset(f56b5ad3a122cd17).(int offset) |
| 141 | { |
| 142 | ASSERT_VALID_CODE_OFFSETcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:54:9`!(offset); |
| 143 | return CodeLocationInstructioncxx . . $ QTJSC/CodeLocationInstruction#CodeLocationInstruction(5d22bdacc48458e8).(reinterpret_cast<char*>(dataLocationcxx . . $ QTJSC/MacroAssemblerCodePtr#dataLocation(45a5c5ac6be858a8).()) + offset); |
| 144 | } |
| 145 | |
| 146 | inline CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel# CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#::labelAtOffsetcxx . . $ QTJSC/CodeLocationCommon#labelAtOffset(3e9f8056418e175b).(int offset) |
| 147 | { |
| 148 | ASSERT_VALID_CODE_OFFSETcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:54:9`!(offset); |
| 149 | return CodeLocationLabelcxx . . $ QTJSC/CodeLocationLabel#CodeLocationLabel(5d22bdacc48458e8).(reinterpret_cast<char*>(dataLocationcxx . . $ QTJSC/MacroAssemblerCodePtr#dataLocation(45a5c5ac6be858a8).()) + offset); |
| 150 | } |
| 151 | |
| 152 | inline CodeLocationJumpcxx . . $ QTJSC/CodeLocationJump# CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#::jumpAtOffsetcxx . . $ QTJSC/CodeLocationCommon#jumpAtOffset(1e22d9afbd76c02f).(int offset) |
| 153 | { |
| 154 | ASSERT_VALID_CODE_OFFSETcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:54:9`!(offset); |
| 155 | return CodeLocationJumpcxx . . $ QTJSC/CodeLocationJump#CodeLocationJump(5d22bdacc48458e8).(reinterpret_cast<char*>(dataLocationcxx . . $ QTJSC/MacroAssemblerCodePtr#dataLocation(45a5c5ac6be858a8).()) + offset); |
| 156 | } |
| 157 | |
| 158 | inline CodeLocationCallcxx . . $ QTJSC/CodeLocationCall# CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#::callAtOffsetcxx . . $ QTJSC/CodeLocationCommon#callAtOffset(9c800df4b359ec60).(int offset) |
| 159 | { |
| 160 | ASSERT_VALID_CODE_OFFSETcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:54:9`!(offset); |
| 161 | return CodeLocationCallcxx . . $ QTJSC/CodeLocationCall#CodeLocationCall(5d22bdacc48458e8).(reinterpret_cast<char*>(dataLocationcxx . . $ QTJSC/MacroAssemblerCodePtr#dataLocation(45a5c5ac6be858a8).()) + offset); |
| 162 | } |
| 163 | |
| 164 | inline CodeLocationNearCallcxx . . $ QTJSC/CodeLocationNearCall# CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#::nearCallAtOffsetcxx . . $ QTJSC/CodeLocationCommon#nearCallAtOffset(efdfc153700bf92f).(int offset) |
| 165 | { |
| 166 | ASSERT_VALID_CODE_OFFSETcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:54:9`!(offset); |
| 167 | return CodeLocationNearCallcxx . . $ QTJSC/CodeLocationNearCall#CodeLocationNearCall(5d22bdacc48458e8).(reinterpret_cast<char*>(dataLocationcxx . . $ QTJSC/MacroAssemblerCodePtr#dataLocation(45a5c5ac6be858a8).()) + offset); |
| 168 | } |
| 169 | |
| 170 | inline CodeLocationDataLabelPtrcxx . . $ QTJSC/CodeLocationDataLabelPtr# CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#::dataLabelPtrAtOffsetcxx . . $ QTJSC/CodeLocationCommon#dataLabelPtrAtOffset(d5aa6e4b803a9c02).(int offset) |
| 171 | { |
| 172 | ASSERT_VALID_CODE_OFFSETcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:54:9`!(offset); |
| 173 | return CodeLocationDataLabelPtrcxx . . $ QTJSC/CodeLocationDataLabelPtr#CodeLocationDataLabelPtr(5d22bdacc48458e8).(reinterpret_cast<char*>(dataLocationcxx . . $ QTJSC/MacroAssemblerCodePtr#dataLocation(45a5c5ac6be858a8).()) + offset); |
| 174 | } |
| 175 | |
| 176 | inline CodeLocationDataLabel32cxx . . $ QTJSC/CodeLocationDataLabel32# CodeLocationCommoncxx . . $ QTJSC/CodeLocationCommon#::dataLabel32AtOffsetcxx . . $ QTJSC/CodeLocationCommon#dataLabel32AtOffset(1a69f8685b0bd7ff).(int offset) |
| 177 | { |
| 178 | ASSERT_VALID_CODE_OFFSETcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:54:9`!(offset); |
| 179 | return CodeLocationDataLabel32cxx . . $ QTJSC/CodeLocationDataLabel32#CodeLocationDataLabel32(5d22bdacc48458e8).(reinterpret_cast<char*>(dataLocationcxx . . $ QTJSC/MacroAssemblerCodePtr#dataLocation(45a5c5ac6be858a8).()) + offset); |
| 180 | } |
| 181 | |
| 182 | } // namespace JSC |
| 183 | |
| 184 | #endif // ENABLE(ASSEMBLER) |
| 185 | |
| 186 | #endif // CodeLocation_h |