"Fossies" - the Fresh Open Source Software Archive

Member "UXP-2019.06.08/js/src/jit/Lowering.h" (8 Jun 2019, 15490 Bytes) of package /linux/www/UXP-2019.06.08.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Lowering.h": 2019.03.27_vs_2019.06.08.

    1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
    2  * vim: set ts=8 sts=4 et sw=4 tw=99:
    3  * This Source Code Form is subject to the terms of the Mozilla Public
    4  * License, v. 2.0. If a copy of the MPL was not distributed with this
    5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    6 
    7 #ifndef jit_Lowering_h
    8 #define jit_Lowering_h
    9 
   10 // This file declares the structures that are used for attaching LIR to a
   11 // MIRGraph.
   12 
   13 #include "jit/LIR.h"
   14 #if defined(JS_CODEGEN_X86)
   15 # include "jit/x86/Lowering-x86.h"
   16 #elif defined(JS_CODEGEN_X64)
   17 # include "jit/x64/Lowering-x64.h"
   18 #elif defined(JS_CODEGEN_ARM)
   19 # include "jit/arm/Lowering-arm.h"
   20 #elif defined(JS_CODEGEN_ARM64)
   21 # include "jit/arm64/Lowering-arm64.h"
   22 #elif defined(JS_CODEGEN_MIPS32)
   23 # include "jit/mips32/Lowering-mips32.h"
   24 #elif defined(JS_CODEGEN_MIPS64)
   25 # include "jit/mips64/Lowering-mips64.h"
   26 #elif defined(JS_CODEGEN_NONE)
   27 # include "jit/none/Lowering-none.h"
   28 #else
   29 # error "Unknown architecture!"
   30 #endif
   31 
   32 namespace js {
   33 namespace jit {
   34 
   35 class LIRGenerator : public LIRGeneratorSpecific
   36 {
   37     void updateResumeState(MInstruction* ins);
   38     void updateResumeState(MBasicBlock* block);
   39 
   40     // The maximum depth, for framesizeclass determination.
   41     uint32_t maxargslots_;
   42 
   43   public:
   44     LIRGenerator(MIRGenerator* gen, MIRGraph& graph, LIRGraph& lirGraph)
   45       : LIRGeneratorSpecific(gen, graph, lirGraph),
   46         maxargslots_(0)
   47     { }
   48 
   49     MOZ_MUST_USE bool generate();
   50 
   51   private:
   52     LBoxAllocation useBoxFixedAtStart(MDefinition* mir, Register reg1, Register reg2) {
   53         return useBoxFixed(mir, reg1, reg2, /* useAtStart = */ true);
   54     }
   55 
   56     LBoxAllocation useBoxFixedAtStart(MDefinition* mir, ValueOperand op);
   57     LBoxAllocation useBoxAtStart(MDefinition* mir, LUse::Policy policy = LUse::REGISTER);
   58 
   59     void lowerBitOp(JSOp op, MInstruction* ins);
   60     void lowerShiftOp(JSOp op, MShiftInstruction* ins);
   61     void lowerBinaryV(JSOp op, MBinaryInstruction* ins);
   62     void definePhis();
   63 
   64     MOZ_MUST_USE bool lowerCallArguments(MCall* call);
   65 
   66   public:
   67     MOZ_MUST_USE bool visitInstruction(MInstruction* ins);
   68     MOZ_MUST_USE bool visitBlock(MBasicBlock* block);
   69 
   70     // Visitor hooks are explicit, to give CPU-specific versions a chance to
   71     // intercept without a bunch of explicit gunk in the .cpp.
   72     void visitCloneLiteral(MCloneLiteral* ins);
   73     void visitParameter(MParameter* param);
   74     void visitCallee(MCallee* callee);
   75     void visitIsConstructing(MIsConstructing* ins);
   76     void visitGoto(MGoto* ins);
   77     void visitTableSwitch(MTableSwitch* tableswitch);
   78     void visitNewArray(MNewArray* ins);
   79     void visitNewArrayCopyOnWrite(MNewArrayCopyOnWrite* ins);
   80     void visitNewArrayDynamicLength(MNewArrayDynamicLength* ins);
   81     void visitNewTypedArray(MNewTypedArray* ins);
   82     void visitNewTypedArrayDynamicLength(MNewTypedArrayDynamicLength* ins);
   83     void visitNewObject(MNewObject* ins);
   84     void visitNewTypedObject(MNewTypedObject* ins);
   85     void visitNewNamedLambdaObject(MNewNamedLambdaObject* ins);
   86     void visitNewCallObject(MNewCallObject* ins);
   87     void visitNewSingletonCallObject(MNewSingletonCallObject* ins);
   88     void visitNewStringObject(MNewStringObject* ins);
   89     void visitNewDerivedTypedObject(MNewDerivedTypedObject* ins);
   90     void visitInitElem(MInitElem* ins);
   91     void visitInitElemGetterSetter(MInitElemGetterSetter* ins);
   92     void visitMutateProto(MMutateProto* ins);
   93     void visitInitProp(MInitProp* ins);
   94     void visitInitPropGetterSetter(MInitPropGetterSetter* ins);
   95     void visitCheckOverRecursed(MCheckOverRecursed* ins);
   96     void visitDefVar(MDefVar* ins);
   97     void visitDefLexical(MDefLexical* ins);
   98     void visitDefFun(MDefFun* ins);
   99     void visitCreateThisWithTemplate(MCreateThisWithTemplate* ins);
  100     void visitCreateThisWithProto(MCreateThisWithProto* ins);
  101     void visitCreateThis(MCreateThis* ins);
  102     void visitCreateArgumentsObject(MCreateArgumentsObject* ins);
  103     void visitGetArgumentsObjectArg(MGetArgumentsObjectArg* ins);
  104     void visitSetArgumentsObjectArg(MSetArgumentsObjectArg* ins);
  105     void visitReturnFromCtor(MReturnFromCtor* ins);
  106     void visitComputeThis(MComputeThis* ins);
  107     void visitCall(MCall* call);
  108     void visitApplyArgs(MApplyArgs* apply);
  109     void visitApplyArray(MApplyArray* apply);
  110     void visitArraySplice(MArraySplice* splice);
  111     void visitBail(MBail* bail);
  112     void visitUnreachable(MUnreachable* unreachable);
  113     void visitEncodeSnapshot(MEncodeSnapshot* ins);
  114     void visitAssertFloat32(MAssertFloat32* ins);
  115     void visitAssertRecoveredOnBailout(MAssertRecoveredOnBailout* ins);
  116     void visitGetDynamicName(MGetDynamicName* ins);
  117     void visitCallDirectEval(MCallDirectEval* ins);
  118     void visitTest(MTest* test);
  119     void visitGotoWithFake(MGotoWithFake* ins);
  120     void visitFunctionDispatch(MFunctionDispatch* ins);
  121     void visitObjectGroupDispatch(MObjectGroupDispatch* ins);
  122     void visitCompare(MCompare* comp);
  123     void visitTypeOf(MTypeOf* ins);
  124     void visitToAsync(MToAsync* ins);
  125     void visitToId(MToId* ins);
  126     void visitBitNot(MBitNot* ins);
  127     void visitBitAnd(MBitAnd* ins);
  128     void visitBitOr(MBitOr* ins);
  129     void visitBitXor(MBitXor* ins);
  130     void visitLsh(MLsh* ins);
  131     void visitRsh(MRsh* ins);
  132     void visitUrsh(MUrsh* ins);
  133     void visitSignExtend(MSignExtend* ins);
  134     void visitRotate(MRotate* ins);
  135     void visitFloor(MFloor* ins);
  136     void visitCeil(MCeil* ins);
  137     void visitRound(MRound* ins);
  138     void visitMinMax(MMinMax* ins);
  139     void visitAbs(MAbs* ins);
  140     void visitClz(MClz* ins);
  141     void visitCtz(MCtz* ins);
  142     void visitSqrt(MSqrt* ins);
  143     void visitPopcnt(MPopcnt* ins);
  144     void visitAtan2(MAtan2* ins);
  145     void visitHypot(MHypot* ins);
  146     void visitPow(MPow* ins);
  147     void visitMathFunction(MMathFunction* ins);
  148     void visitAdd(MAdd* ins);
  149     void visitSub(MSub* ins);
  150     void visitMul(MMul* ins);
  151     void visitDiv(MDiv* ins);
  152     void visitMod(MMod* ins);
  153     void visitConcat(MConcat* ins);
  154     void visitCharCodeAt(MCharCodeAt* ins);
  155     void visitFromCharCode(MFromCharCode* ins);
  156     void visitFromCodePoint(MFromCodePoint* ins);
  157     void visitSinCos(MSinCos *ins);
  158     void visitStringSplit(MStringSplit* ins);
  159     void visitStart(MStart* start);
  160     void visitOsrEntry(MOsrEntry* entry);
  161     void visitNop(MNop* nop);
  162     void visitLimitedTruncate(MLimitedTruncate* nop);
  163     void visitOsrValue(MOsrValue* value);
  164     void visitOsrEnvironmentChain(MOsrEnvironmentChain* object);
  165     void visitOsrReturnValue(MOsrReturnValue* value);
  166     void visitOsrArgumentsObject(MOsrArgumentsObject* object);
  167     void visitToDouble(MToDouble* convert);
  168     void visitToFloat32(MToFloat32* convert);
  169     void visitToInt32(MToInt32* convert);
  170     void visitTruncateToInt32(MTruncateToInt32* truncate);
  171     void visitWasmTruncateToInt32(MWasmTruncateToInt32* truncate);
  172     void visitWrapInt64ToInt32(MWrapInt64ToInt32* ins);
  173     void visitToString(MToString* convert);
  174     void visitToObjectOrNull(MToObjectOrNull* convert);
  175     void visitRegExp(MRegExp* ins);
  176     void visitRegExpMatcher(MRegExpMatcher* ins);
  177     void visitRegExpSearcher(MRegExpSearcher* ins);
  178     void visitRegExpTester(MRegExpTester* ins);
  179     void visitRegExpPrototypeOptimizable(MRegExpPrototypeOptimizable* ins);
  180     void visitRegExpInstanceOptimizable(MRegExpInstanceOptimizable* ins);
  181     void visitGetFirstDollarIndex(MGetFirstDollarIndex* ins);
  182     void visitStringReplace(MStringReplace* ins);
  183     void visitBinarySharedStub(MBinarySharedStub* ins);
  184     void visitUnarySharedStub(MUnarySharedStub* ins);
  185     void visitNullarySharedStub(MNullarySharedStub* ins);
  186     void visitLambda(MLambda* ins);
  187     void visitLambdaArrow(MLambdaArrow* ins);
  188     void visitSetFunName(MSetFunName* ins);
  189     void visitKeepAliveObject(MKeepAliveObject* ins);
  190     void visitSlots(MSlots* ins);
  191     void visitElements(MElements* ins);
  192     void visitConstantElements(MConstantElements* ins);
  193     void visitConvertElementsToDoubles(MConvertElementsToDoubles* ins);
  194     void visitMaybeToDoubleElement(MMaybeToDoubleElement* ins);
  195     void visitMaybeCopyElementsForWrite(MMaybeCopyElementsForWrite* ins);
  196     void visitLoadSlot(MLoadSlot* ins);
  197     void visitLoadFixedSlotAndUnbox(MLoadFixedSlotAndUnbox* ins);
  198     void visitFunctionEnvironment(MFunctionEnvironment* ins);
  199     void visitInterruptCheck(MInterruptCheck* ins);
  200     void visitWasmTrap(MWasmTrap* ins);
  201     void visitWasmReinterpret(MWasmReinterpret* ins);
  202     void visitStoreSlot(MStoreSlot* ins);
  203     void visitFilterTypeSet(MFilterTypeSet* ins);
  204     void visitTypeBarrier(MTypeBarrier* ins);
  205     void visitMonitorTypes(MMonitorTypes* ins);
  206     void visitPostWriteBarrier(MPostWriteBarrier* ins);
  207     void visitPostWriteElementBarrier(MPostWriteElementBarrier* ins);
  208     void visitArrayLength(MArrayLength* ins);
  209     void visitSetArrayLength(MSetArrayLength* ins);
  210     void visitGetNextEntryForIterator(MGetNextEntryForIterator* ins);
  211     void visitTypedArrayLength(MTypedArrayLength* ins);
  212     void visitTypedArrayElements(MTypedArrayElements* ins);
  213     void visitSetDisjointTypedElements(MSetDisjointTypedElements* ins);
  214     void visitTypedObjectElements(MTypedObjectElements* ins);
  215     void visitSetTypedObjectOffset(MSetTypedObjectOffset* ins);
  216     void visitTypedObjectDescr(MTypedObjectDescr* ins);
  217     void visitInitializedLength(MInitializedLength* ins);
  218     void visitSetInitializedLength(MSetInitializedLength* ins);
  219     void visitUnboxedArrayLength(MUnboxedArrayLength* ins);
  220     void visitUnboxedArrayInitializedLength(MUnboxedArrayInitializedLength* ins);
  221     void visitIncrementUnboxedArrayInitializedLength(MIncrementUnboxedArrayInitializedLength* ins);
  222     void visitSetUnboxedArrayInitializedLength(MSetUnboxedArrayInitializedLength* ins);
  223     void visitNot(MNot* ins);
  224     void visitBoundsCheck(MBoundsCheck* ins);
  225     void visitBoundsCheckLower(MBoundsCheckLower* ins);
  226     void visitLoadElement(MLoadElement* ins);
  227     void visitLoadElementHole(MLoadElementHole* ins);
  228     void visitLoadUnboxedObjectOrNull(MLoadUnboxedObjectOrNull* ins);
  229     void visitLoadUnboxedString(MLoadUnboxedString* ins);
  230     void visitStoreElement(MStoreElement* ins);
  231     void visitStoreElementHole(MStoreElementHole* ins);
  232     void visitFallibleStoreElement(MFallibleStoreElement* ins);
  233     void visitStoreUnboxedObjectOrNull(MStoreUnboxedObjectOrNull* ins);
  234     void visitStoreUnboxedString(MStoreUnboxedString* ins);
  235     void visitEffectiveAddress(MEffectiveAddress* ins);
  236     void visitArrayPopShift(MArrayPopShift* ins);
  237     void visitArrayPush(MArrayPush* ins);
  238     void visitArraySlice(MArraySlice* ins);
  239     void visitArrayJoin(MArrayJoin* ins);
  240     void visitLoadUnboxedScalar(MLoadUnboxedScalar* ins);
  241     void visitLoadTypedArrayElementHole(MLoadTypedArrayElementHole* ins);
  242     void visitLoadTypedArrayElementStatic(MLoadTypedArrayElementStatic* ins);
  243     void visitStoreUnboxedScalar(MStoreUnboxedScalar* ins);
  244     void visitStoreTypedArrayElementHole(MStoreTypedArrayElementHole* ins);
  245     void visitClampToUint8(MClampToUint8* ins);
  246     void visitLoadFixedSlot(MLoadFixedSlot* ins);
  247     void visitStoreFixedSlot(MStoreFixedSlot* ins);
  248     void visitGetPropertyCache(MGetPropertyCache* ins);
  249     void visitGetPropertyPolymorphic(MGetPropertyPolymorphic* ins);
  250     void visitSetPropertyPolymorphic(MSetPropertyPolymorphic* ins);
  251     void visitBindNameCache(MBindNameCache* ins);
  252     void visitCallBindVar(MCallBindVar* ins);
  253     void visitGuardObjectIdentity(MGuardObjectIdentity* ins);
  254     void visitGuardClass(MGuardClass* ins);
  255     void visitGuardObject(MGuardObject* ins);
  256     void visitGuardString(MGuardString* ins);
  257     void visitGuardReceiverPolymorphic(MGuardReceiverPolymorphic* ins);
  258     void visitPolyInlineGuard(MPolyInlineGuard* ins);
  259     void visitAssertRange(MAssertRange* ins);
  260     void visitCallGetProperty(MCallGetProperty* ins);
  261     void visitDeleteProperty(MDeleteProperty* ins);
  262     void visitDeleteElement(MDeleteElement* ins);
  263     void visitGetNameCache(MGetNameCache* ins);
  264     void visitCallGetIntrinsicValue(MCallGetIntrinsicValue* ins);
  265     void visitCallGetElement(MCallGetElement* ins);
  266     void visitCallSetElement(MCallSetElement* ins);
  267     void visitCallInitElementArray(MCallInitElementArray* ins);
  268     void visitSetPropertyCache(MSetPropertyCache* ins);
  269     void visitCallSetProperty(MCallSetProperty* ins);
  270     void visitIteratorStart(MIteratorStart* ins);
  271     void visitIteratorMore(MIteratorMore* ins);
  272     void visitIsNoIter(MIsNoIter* ins);
  273     void visitIteratorEnd(MIteratorEnd* ins);
  274     void visitStringLength(MStringLength* ins);
  275     void visitArgumentsLength(MArgumentsLength* ins);
  276     void visitGetFrameArgument(MGetFrameArgument* ins);
  277     void visitSetFrameArgument(MSetFrameArgument* ins);
  278     void visitRunOncePrologue(MRunOncePrologue* ins);
  279     void visitRest(MRest* ins);
  280     void visitThrow(MThrow* ins);
  281     void visitIn(MIn* ins);
  282     void visitInArray(MInArray* ins);
  283     void visitInstanceOf(MInstanceOf* ins);
  284     void visitCallInstanceOf(MCallInstanceOf* ins);
  285     void visitIsCallable(MIsCallable* ins);
  286     void visitIsConstructor(MIsConstructor* ins);
  287     void visitIsObject(MIsObject* ins);
  288     void visitHasClass(MHasClass* ins);
  289     void visitGuardToClass(MGuardToClass* ins);
  290     void visitWasmAddOffset(MWasmAddOffset* ins);
  291     void visitWasmBoundsCheck(MWasmBoundsCheck* ins);
  292     void visitWasmLoadGlobalVar(MWasmLoadGlobalVar* ins);
  293     void visitWasmStoreGlobalVar(MWasmStoreGlobalVar* ins);
  294     void visitWasmParameter(MWasmParameter* ins);
  295     void visitWasmReturn(MWasmReturn* ins);
  296     void visitWasmReturnVoid(MWasmReturnVoid* ins);
  297     void visitWasmStackArg(MWasmStackArg* ins);
  298     void visitWasmCall(MWasmCall* ins);
  299     void visitSetDOMProperty(MSetDOMProperty* ins);
  300     void visitGetDOMProperty(MGetDOMProperty* ins);
  301     void visitGetDOMMember(MGetDOMMember* ins);
  302     void visitRecompileCheck(MRecompileCheck* ins);
  303     void visitSimdBox(MSimdBox* ins);
  304     void visitSimdUnbox(MSimdUnbox* ins);
  305     void visitSimdUnaryArith(MSimdUnaryArith* ins);
  306     void visitSimdBinaryComp(MSimdBinaryComp* ins);
  307     void visitSimdBinaryBitwise(MSimdBinaryBitwise* ins);
  308     void visitSimdShift(MSimdShift* ins);
  309     void visitSimdConstant(MSimdConstant* ins);
  310     void visitSimdConvert(MSimdConvert* ins);
  311     void visitSimdReinterpretCast(MSimdReinterpretCast* ins);
  312     void visitSimdAllTrue(MSimdAllTrue* ins);
  313     void visitSimdAnyTrue(MSimdAnyTrue* ins);
  314     void visitPhi(MPhi* ins);
  315     void visitBeta(MBeta* ins);
  316     void visitObjectState(MObjectState* ins);
  317     void visitArrayState(MArrayState* ins);
  318     void visitUnknownValue(MUnknownValue* ins);
  319     void visitLexicalCheck(MLexicalCheck* ins);
  320     void visitThrowRuntimeLexicalError(MThrowRuntimeLexicalError* ins);
  321     void visitGlobalNameConflictsCheck(MGlobalNameConflictsCheck* ins);
  322     void visitDebugger(MDebugger* ins);
  323     void visitNewTarget(MNewTarget* ins);
  324     void visitArrowNewTarget(MArrowNewTarget* ins);
  325     void visitNaNToZero(MNaNToZero *ins);
  326     void visitAtomicIsLockFree(MAtomicIsLockFree* ins);
  327     void visitGuardSharedTypedArray(MGuardSharedTypedArray* ins);
  328     void visitCheckReturn(MCheckReturn* ins);
  329     void visitCheckIsObj(MCheckIsObj* ins);
  330     void visitCheckIsCallable(MCheckIsCallable* ins);
  331     void visitCheckObjCoercible(MCheckObjCoercible* ins);
  332     void visitDebugCheckSelfHosted(MDebugCheckSelfHosted* ins);
  333 };
  334 
  335 } // namespace jit
  336 } // namespace js
  337 
  338 #endif /* jit_Lowering_h */