Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * vim: set ts=8 sts=4 et sw=4 tw=99: |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef jit_Lowering_h |
michael@0 | 8 | #define jit_Lowering_h |
michael@0 | 9 | |
michael@0 | 10 | // This file declares the structures that are used for attaching LIR to a |
michael@0 | 11 | // MIRGraph. |
michael@0 | 12 | |
michael@0 | 13 | #include "jit/LIR.h" |
michael@0 | 14 | #if defined(JS_CODEGEN_X86) |
michael@0 | 15 | # include "jit/x86/Lowering-x86.h" |
michael@0 | 16 | #elif defined(JS_CODEGEN_X64) |
michael@0 | 17 | # include "jit/x64/Lowering-x64.h" |
michael@0 | 18 | #elif defined(JS_CODEGEN_ARM) |
michael@0 | 19 | # include "jit/arm/Lowering-arm.h" |
michael@0 | 20 | #elif defined(JS_CODEGEN_MIPS) |
michael@0 | 21 | # include "jit/mips/Lowering-mips.h" |
michael@0 | 22 | #else |
michael@0 | 23 | # error "Unknown architecture!" |
michael@0 | 24 | #endif |
michael@0 | 25 | |
michael@0 | 26 | namespace js { |
michael@0 | 27 | namespace jit { |
michael@0 | 28 | |
michael@0 | 29 | class LIRGenerator : public LIRGeneratorSpecific |
michael@0 | 30 | { |
michael@0 | 31 | void updateResumeState(MInstruction *ins); |
michael@0 | 32 | void updateResumeState(MBasicBlock *block); |
michael@0 | 33 | |
michael@0 | 34 | // The maximum depth, for framesizeclass determination. |
michael@0 | 35 | uint32_t maxargslots_; |
michael@0 | 36 | |
michael@0 | 37 | public: |
michael@0 | 38 | LIRGenerator(MIRGenerator *gen, MIRGraph &graph, LIRGraph &lirGraph) |
michael@0 | 39 | : LIRGeneratorSpecific(gen, graph, lirGraph), |
michael@0 | 40 | maxargslots_(0) |
michael@0 | 41 | { } |
michael@0 | 42 | |
michael@0 | 43 | bool generate(); |
michael@0 | 44 | |
michael@0 | 45 | private: |
michael@0 | 46 | |
michael@0 | 47 | bool useBoxAtStart(LInstruction *lir, size_t n, MDefinition *mir, |
michael@0 | 48 | LUse::Policy policy = LUse::REGISTER) { |
michael@0 | 49 | return useBox(lir, n, mir, policy, true); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | bool lowerBitOp(JSOp op, MInstruction *ins); |
michael@0 | 53 | bool lowerShiftOp(JSOp op, MShiftInstruction *ins); |
michael@0 | 54 | bool lowerBinaryV(JSOp op, MBinaryInstruction *ins); |
michael@0 | 55 | bool precreatePhi(LBlock *block, MPhi *phi); |
michael@0 | 56 | bool definePhis(); |
michael@0 | 57 | |
michael@0 | 58 | bool lowerCallArguments(MCall *call); |
michael@0 | 59 | |
michael@0 | 60 | public: |
michael@0 | 61 | bool visitInstruction(MInstruction *ins); |
michael@0 | 62 | bool visitBlock(MBasicBlock *block); |
michael@0 | 63 | |
michael@0 | 64 | // Visitor hooks are explicit, to give CPU-specific versions a chance to |
michael@0 | 65 | // intercept without a bunch of explicit gunk in the .cpp. |
michael@0 | 66 | bool visitCloneLiteral(MCloneLiteral *ins); |
michael@0 | 67 | bool visitParameter(MParameter *param); |
michael@0 | 68 | bool visitCallee(MCallee *callee); |
michael@0 | 69 | bool visitGoto(MGoto *ins); |
michael@0 | 70 | bool visitTableSwitch(MTableSwitch *tableswitch); |
michael@0 | 71 | bool visitNewSlots(MNewSlots *ins); |
michael@0 | 72 | bool visitNewArray(MNewArray *ins); |
michael@0 | 73 | bool visitNewObject(MNewObject *ins); |
michael@0 | 74 | bool visitNewDeclEnvObject(MNewDeclEnvObject *ins); |
michael@0 | 75 | bool visitNewCallObject(MNewCallObject *ins); |
michael@0 | 76 | bool visitNewRunOnceCallObject(MNewRunOnceCallObject *ins); |
michael@0 | 77 | bool visitNewStringObject(MNewStringObject *ins); |
michael@0 | 78 | bool visitNewDerivedTypedObject(MNewDerivedTypedObject *ins); |
michael@0 | 79 | bool visitNewPar(MNewPar *ins); |
michael@0 | 80 | bool visitNewCallObjectPar(MNewCallObjectPar *ins); |
michael@0 | 81 | bool visitNewDenseArrayPar(MNewDenseArrayPar *ins); |
michael@0 | 82 | bool visitAbortPar(MAbortPar *ins); |
michael@0 | 83 | bool visitInitElem(MInitElem *ins); |
michael@0 | 84 | bool visitInitElemGetterSetter(MInitElemGetterSetter *ins); |
michael@0 | 85 | bool visitMutateProto(MMutateProto *ins); |
michael@0 | 86 | bool visitInitProp(MInitProp *ins); |
michael@0 | 87 | bool visitInitPropGetterSetter(MInitPropGetterSetter *ins); |
michael@0 | 88 | bool visitCheckOverRecursed(MCheckOverRecursed *ins); |
michael@0 | 89 | bool visitCheckOverRecursedPar(MCheckOverRecursedPar *ins); |
michael@0 | 90 | bool visitDefVar(MDefVar *ins); |
michael@0 | 91 | bool visitDefFun(MDefFun *ins); |
michael@0 | 92 | bool visitCreateThisWithTemplate(MCreateThisWithTemplate *ins); |
michael@0 | 93 | bool visitCreateThisWithProto(MCreateThisWithProto *ins); |
michael@0 | 94 | bool visitCreateThis(MCreateThis *ins); |
michael@0 | 95 | bool visitCreateArgumentsObject(MCreateArgumentsObject *ins); |
michael@0 | 96 | bool visitGetArgumentsObjectArg(MGetArgumentsObjectArg *ins); |
michael@0 | 97 | bool visitSetArgumentsObjectArg(MSetArgumentsObjectArg *ins); |
michael@0 | 98 | bool visitReturnFromCtor(MReturnFromCtor *ins); |
michael@0 | 99 | bool visitComputeThis(MComputeThis *ins); |
michael@0 | 100 | bool visitLoadArrowThis(MLoadArrowThis *ins); |
michael@0 | 101 | bool visitCall(MCall *call); |
michael@0 | 102 | bool visitApplyArgs(MApplyArgs *apply); |
michael@0 | 103 | bool visitArraySplice(MArraySplice *splice); |
michael@0 | 104 | bool visitBail(MBail *bail); |
michael@0 | 105 | bool visitAssertFloat32(MAssertFloat32 *ins); |
michael@0 | 106 | bool visitGetDynamicName(MGetDynamicName *ins); |
michael@0 | 107 | bool visitFilterArgumentsOrEval(MFilterArgumentsOrEval *ins); |
michael@0 | 108 | bool visitCallDirectEval(MCallDirectEval *ins); |
michael@0 | 109 | bool visitTest(MTest *test); |
michael@0 | 110 | bool visitFunctionDispatch(MFunctionDispatch *ins); |
michael@0 | 111 | bool visitTypeObjectDispatch(MTypeObjectDispatch *ins); |
michael@0 | 112 | bool visitCompare(MCompare *comp); |
michael@0 | 113 | bool visitTypeOf(MTypeOf *ins); |
michael@0 | 114 | bool visitToId(MToId *ins); |
michael@0 | 115 | bool visitBitNot(MBitNot *ins); |
michael@0 | 116 | bool visitBitAnd(MBitAnd *ins); |
michael@0 | 117 | bool visitBitOr(MBitOr *ins); |
michael@0 | 118 | bool visitBitXor(MBitXor *ins); |
michael@0 | 119 | bool visitLsh(MLsh *ins); |
michael@0 | 120 | bool visitRsh(MRsh *ins); |
michael@0 | 121 | bool visitUrsh(MUrsh *ins); |
michael@0 | 122 | bool visitFloor(MFloor *ins); |
michael@0 | 123 | bool visitRound(MRound *ins); |
michael@0 | 124 | bool visitMinMax(MMinMax *ins); |
michael@0 | 125 | bool visitAbs(MAbs *ins); |
michael@0 | 126 | bool visitSqrt(MSqrt *ins); |
michael@0 | 127 | bool visitAtan2(MAtan2 *ins); |
michael@0 | 128 | bool visitHypot(MHypot *ins); |
michael@0 | 129 | bool visitPow(MPow *ins); |
michael@0 | 130 | bool visitRandom(MRandom *ins); |
michael@0 | 131 | bool visitMathFunction(MMathFunction *ins); |
michael@0 | 132 | bool visitAdd(MAdd *ins); |
michael@0 | 133 | bool visitSub(MSub *ins); |
michael@0 | 134 | bool visitMul(MMul *ins); |
michael@0 | 135 | bool visitDiv(MDiv *ins); |
michael@0 | 136 | bool visitMod(MMod *ins); |
michael@0 | 137 | bool visitConcat(MConcat *ins); |
michael@0 | 138 | bool visitConcatPar(MConcatPar *ins); |
michael@0 | 139 | bool visitCharCodeAt(MCharCodeAt *ins); |
michael@0 | 140 | bool visitFromCharCode(MFromCharCode *ins); |
michael@0 | 141 | bool visitStringSplit(MStringSplit *ins); |
michael@0 | 142 | bool visitStart(MStart *start); |
michael@0 | 143 | bool visitOsrEntry(MOsrEntry *entry); |
michael@0 | 144 | bool visitNop(MNop *nop); |
michael@0 | 145 | bool visitOsrValue(MOsrValue *value); |
michael@0 | 146 | bool visitOsrScopeChain(MOsrScopeChain *object); |
michael@0 | 147 | bool visitOsrReturnValue(MOsrReturnValue *value); |
michael@0 | 148 | bool visitOsrArgumentsObject(MOsrArgumentsObject *object); |
michael@0 | 149 | bool visitToDouble(MToDouble *convert); |
michael@0 | 150 | bool visitToFloat32(MToFloat32 *convert); |
michael@0 | 151 | bool visitToInt32(MToInt32 *convert); |
michael@0 | 152 | bool visitTruncateToInt32(MTruncateToInt32 *truncate); |
michael@0 | 153 | bool visitToString(MToString *convert); |
michael@0 | 154 | bool visitRegExp(MRegExp *ins); |
michael@0 | 155 | bool visitRegExpExec(MRegExpExec *ins); |
michael@0 | 156 | bool visitRegExpTest(MRegExpTest *ins); |
michael@0 | 157 | bool visitRegExpReplace(MRegExpReplace *ins); |
michael@0 | 158 | bool visitStringReplace(MStringReplace *ins); |
michael@0 | 159 | bool visitLambda(MLambda *ins); |
michael@0 | 160 | bool visitLambdaArrow(MLambdaArrow *ins); |
michael@0 | 161 | bool visitLambdaPar(MLambdaPar *ins); |
michael@0 | 162 | bool visitImplicitThis(MImplicitThis *ins); |
michael@0 | 163 | bool visitSlots(MSlots *ins); |
michael@0 | 164 | bool visitElements(MElements *ins); |
michael@0 | 165 | bool visitConstantElements(MConstantElements *ins); |
michael@0 | 166 | bool visitConvertElementsToDoubles(MConvertElementsToDoubles *ins); |
michael@0 | 167 | bool visitMaybeToDoubleElement(MMaybeToDoubleElement *ins); |
michael@0 | 168 | bool visitLoadSlot(MLoadSlot *ins); |
michael@0 | 169 | bool visitFunctionEnvironment(MFunctionEnvironment *ins); |
michael@0 | 170 | bool visitForkJoinContext(MForkJoinContext *ins); |
michael@0 | 171 | bool visitGuardThreadExclusive(MGuardThreadExclusive *ins); |
michael@0 | 172 | bool visitInterruptCheck(MInterruptCheck *ins); |
michael@0 | 173 | bool visitInterruptCheckPar(MInterruptCheckPar *ins); |
michael@0 | 174 | bool visitStoreSlot(MStoreSlot *ins); |
michael@0 | 175 | bool visitFilterTypeSet(MFilterTypeSet *ins); |
michael@0 | 176 | bool visitTypeBarrier(MTypeBarrier *ins); |
michael@0 | 177 | bool visitMonitorTypes(MMonitorTypes *ins); |
michael@0 | 178 | bool visitPostWriteBarrier(MPostWriteBarrier *ins); |
michael@0 | 179 | bool visitArrayLength(MArrayLength *ins); |
michael@0 | 180 | bool visitSetArrayLength(MSetArrayLength *ins); |
michael@0 | 181 | bool visitTypedArrayLength(MTypedArrayLength *ins); |
michael@0 | 182 | bool visitTypedArrayElements(MTypedArrayElements *ins); |
michael@0 | 183 | bool visitNeuterCheck(MNeuterCheck *lir); |
michael@0 | 184 | bool visitTypedObjectElements(MTypedObjectElements *ins); |
michael@0 | 185 | bool visitSetTypedObjectOffset(MSetTypedObjectOffset *ins); |
michael@0 | 186 | bool visitInitializedLength(MInitializedLength *ins); |
michael@0 | 187 | bool visitSetInitializedLength(MSetInitializedLength *ins); |
michael@0 | 188 | bool visitNot(MNot *ins); |
michael@0 | 189 | bool visitBoundsCheck(MBoundsCheck *ins); |
michael@0 | 190 | bool visitBoundsCheckLower(MBoundsCheckLower *ins); |
michael@0 | 191 | bool visitLoadElement(MLoadElement *ins); |
michael@0 | 192 | bool visitLoadElementHole(MLoadElementHole *ins); |
michael@0 | 193 | bool visitStoreElement(MStoreElement *ins); |
michael@0 | 194 | bool visitStoreElementHole(MStoreElementHole *ins); |
michael@0 | 195 | bool visitEffectiveAddress(MEffectiveAddress *ins); |
michael@0 | 196 | bool visitArrayPopShift(MArrayPopShift *ins); |
michael@0 | 197 | bool visitArrayPush(MArrayPush *ins); |
michael@0 | 198 | bool visitArrayConcat(MArrayConcat *ins); |
michael@0 | 199 | bool visitLoadTypedArrayElement(MLoadTypedArrayElement *ins); |
michael@0 | 200 | bool visitLoadTypedArrayElementHole(MLoadTypedArrayElementHole *ins); |
michael@0 | 201 | bool visitLoadTypedArrayElementStatic(MLoadTypedArrayElementStatic *ins); |
michael@0 | 202 | bool visitStoreTypedArrayElement(MStoreTypedArrayElement *ins); |
michael@0 | 203 | bool visitStoreTypedArrayElementHole(MStoreTypedArrayElementHole *ins); |
michael@0 | 204 | bool visitClampToUint8(MClampToUint8 *ins); |
michael@0 | 205 | bool visitLoadFixedSlot(MLoadFixedSlot *ins); |
michael@0 | 206 | bool visitStoreFixedSlot(MStoreFixedSlot *ins); |
michael@0 | 207 | bool visitGetPropertyCache(MGetPropertyCache *ins); |
michael@0 | 208 | bool visitGetPropertyPolymorphic(MGetPropertyPolymorphic *ins); |
michael@0 | 209 | bool visitSetPropertyPolymorphic(MSetPropertyPolymorphic *ins); |
michael@0 | 210 | bool visitGetElementCache(MGetElementCache *ins); |
michael@0 | 211 | bool visitBindNameCache(MBindNameCache *ins); |
michael@0 | 212 | bool visitGuardObjectIdentity(MGuardObjectIdentity *ins); |
michael@0 | 213 | bool visitGuardClass(MGuardClass *ins); |
michael@0 | 214 | bool visitGuardObject(MGuardObject *ins); |
michael@0 | 215 | bool visitGuardString(MGuardString *ins); |
michael@0 | 216 | bool visitAssertRange(MAssertRange *ins); |
michael@0 | 217 | bool visitCallGetProperty(MCallGetProperty *ins); |
michael@0 | 218 | bool visitDeleteProperty(MDeleteProperty *ins); |
michael@0 | 219 | bool visitDeleteElement(MDeleteElement *ins); |
michael@0 | 220 | bool visitGetNameCache(MGetNameCache *ins); |
michael@0 | 221 | bool visitCallGetIntrinsicValue(MCallGetIntrinsicValue *ins); |
michael@0 | 222 | bool visitCallsiteCloneCache(MCallsiteCloneCache *ins); |
michael@0 | 223 | bool visitCallGetElement(MCallGetElement *ins); |
michael@0 | 224 | bool visitCallSetElement(MCallSetElement *ins); |
michael@0 | 225 | bool visitCallInitElementArray(MCallInitElementArray *ins); |
michael@0 | 226 | bool visitSetPropertyCache(MSetPropertyCache *ins); |
michael@0 | 227 | bool visitSetElementCache(MSetElementCache *ins); |
michael@0 | 228 | bool visitCallSetProperty(MCallSetProperty *ins); |
michael@0 | 229 | bool visitIteratorStart(MIteratorStart *ins); |
michael@0 | 230 | bool visitIteratorNext(MIteratorNext *ins); |
michael@0 | 231 | bool visitIteratorMore(MIteratorMore *ins); |
michael@0 | 232 | bool visitIteratorEnd(MIteratorEnd *ins); |
michael@0 | 233 | bool visitStringLength(MStringLength *ins); |
michael@0 | 234 | bool visitArgumentsLength(MArgumentsLength *ins); |
michael@0 | 235 | bool visitGetFrameArgument(MGetFrameArgument *ins); |
michael@0 | 236 | bool visitSetFrameArgument(MSetFrameArgument *ins); |
michael@0 | 237 | bool visitRunOncePrologue(MRunOncePrologue *ins); |
michael@0 | 238 | bool visitRest(MRest *ins); |
michael@0 | 239 | bool visitRestPar(MRestPar *ins); |
michael@0 | 240 | bool visitThrow(MThrow *ins); |
michael@0 | 241 | bool visitIn(MIn *ins); |
michael@0 | 242 | bool visitInArray(MInArray *ins); |
michael@0 | 243 | bool visitInstanceOf(MInstanceOf *ins); |
michael@0 | 244 | bool visitCallInstanceOf(MCallInstanceOf *ins); |
michael@0 | 245 | bool visitProfilerStackOp(MProfilerStackOp *ins); |
michael@0 | 246 | bool visitIsCallable(MIsCallable *ins); |
michael@0 | 247 | bool visitHaveSameClass(MHaveSameClass *ins); |
michael@0 | 248 | bool visitHasClass(MHasClass *ins); |
michael@0 | 249 | bool visitAsmJSLoadGlobalVar(MAsmJSLoadGlobalVar *ins); |
michael@0 | 250 | bool visitAsmJSStoreGlobalVar(MAsmJSStoreGlobalVar *ins); |
michael@0 | 251 | bool visitAsmJSLoadFFIFunc(MAsmJSLoadFFIFunc *ins); |
michael@0 | 252 | bool visitAsmJSParameter(MAsmJSParameter *ins); |
michael@0 | 253 | bool visitAsmJSReturn(MAsmJSReturn *ins); |
michael@0 | 254 | bool visitAsmJSVoidReturn(MAsmJSVoidReturn *ins); |
michael@0 | 255 | bool visitAsmJSPassStackArg(MAsmJSPassStackArg *ins); |
michael@0 | 256 | bool visitAsmJSCall(MAsmJSCall *ins); |
michael@0 | 257 | bool visitSetDOMProperty(MSetDOMProperty *ins); |
michael@0 | 258 | bool visitGetDOMProperty(MGetDOMProperty *ins); |
michael@0 | 259 | bool visitGetDOMMember(MGetDOMMember *ins); |
michael@0 | 260 | bool visitRecompileCheck(MRecompileCheck *ins); |
michael@0 | 261 | }; |
michael@0 | 262 | |
michael@0 | 263 | } // namespace jit |
michael@0 | 264 | } // namespace js |
michael@0 | 265 | |
michael@0 | 266 | #endif /* jit_Lowering_h */ |