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_CodeGenerator_h |
michael@0 | 8 | #define jit_CodeGenerator_h |
michael@0 | 9 | |
michael@0 | 10 | #include "jit/IonCaches.h" |
michael@0 | 11 | #if defined(JS_ION_PERF) |
michael@0 | 12 | # include "jit/PerfSpewer.h" |
michael@0 | 13 | #endif |
michael@0 | 14 | |
michael@0 | 15 | #if defined(JS_CODEGEN_X86) |
michael@0 | 16 | # include "jit/x86/CodeGenerator-x86.h" |
michael@0 | 17 | #elif defined(JS_CODEGEN_X64) |
michael@0 | 18 | # include "jit/x64/CodeGenerator-x64.h" |
michael@0 | 19 | #elif defined(JS_CODEGEN_ARM) |
michael@0 | 20 | # include "jit/arm/CodeGenerator-arm.h" |
michael@0 | 21 | #elif defined(JS_CODEGEN_MIPS) |
michael@0 | 22 | # include "jit/mips/CodeGenerator-mips.h" |
michael@0 | 23 | #else |
michael@0 | 24 | #error "Unknown architecture!" |
michael@0 | 25 | #endif |
michael@0 | 26 | |
michael@0 | 27 | namespace js { |
michael@0 | 28 | namespace jit { |
michael@0 | 29 | |
michael@0 | 30 | class OutOfLineTestObject; |
michael@0 | 31 | class OutOfLineNewArray; |
michael@0 | 32 | class OutOfLineNewObject; |
michael@0 | 33 | class CheckOverRecursedFailure; |
michael@0 | 34 | class CheckOverRecursedFailurePar; |
michael@0 | 35 | class OutOfLineInterruptCheckPar; |
michael@0 | 36 | class OutOfLineInterruptCheckImplicit; |
michael@0 | 37 | class OutOfLineUnboxFloatingPoint; |
michael@0 | 38 | class OutOfLineStoreElementHole; |
michael@0 | 39 | class OutOfLineTypeOfV; |
michael@0 | 40 | class OutOfLineLoadTypedArray; |
michael@0 | 41 | class OutOfLineNewGCThingPar; |
michael@0 | 42 | class OutOfLineUpdateCache; |
michael@0 | 43 | class OutOfLineCallPostWriteBarrier; |
michael@0 | 44 | |
michael@0 | 45 | class CodeGenerator : public CodeGeneratorSpecific |
michael@0 | 46 | { |
michael@0 | 47 | bool generateArgumentsChecks(bool bailout = true); |
michael@0 | 48 | bool generateBody(); |
michael@0 | 49 | |
michael@0 | 50 | public: |
michael@0 | 51 | CodeGenerator(MIRGenerator *gen, LIRGraph *graph, MacroAssembler *masm = nullptr); |
michael@0 | 52 | ~CodeGenerator(); |
michael@0 | 53 | |
michael@0 | 54 | public: |
michael@0 | 55 | bool generate(); |
michael@0 | 56 | bool generateAsmJS(Label *stackOverflowLabel); |
michael@0 | 57 | bool link(JSContext *cx, types::CompilerConstraintList *constraints); |
michael@0 | 58 | |
michael@0 | 59 | bool visitLabel(LLabel *lir); |
michael@0 | 60 | bool visitNop(LNop *lir); |
michael@0 | 61 | bool visitOsiPoint(LOsiPoint *lir); |
michael@0 | 62 | bool visitGoto(LGoto *lir); |
michael@0 | 63 | bool visitTableSwitch(LTableSwitch *ins); |
michael@0 | 64 | bool visitTableSwitchV(LTableSwitchV *ins); |
michael@0 | 65 | bool visitCloneLiteral(LCloneLiteral *lir); |
michael@0 | 66 | bool visitParameter(LParameter *lir); |
michael@0 | 67 | bool visitCallee(LCallee *lir); |
michael@0 | 68 | bool visitStart(LStart *lir); |
michael@0 | 69 | bool visitReturn(LReturn *ret); |
michael@0 | 70 | bool visitDefVar(LDefVar *lir); |
michael@0 | 71 | bool visitDefFun(LDefFun *lir); |
michael@0 | 72 | bool visitOsrEntry(LOsrEntry *lir); |
michael@0 | 73 | bool visitOsrScopeChain(LOsrScopeChain *lir); |
michael@0 | 74 | bool visitOsrValue(LOsrValue *lir); |
michael@0 | 75 | bool visitOsrReturnValue(LOsrReturnValue *lir); |
michael@0 | 76 | bool visitOsrArgumentsObject(LOsrArgumentsObject *lir); |
michael@0 | 77 | bool visitStackArgT(LStackArgT *lir); |
michael@0 | 78 | bool visitStackArgV(LStackArgV *lir); |
michael@0 | 79 | bool visitMoveGroup(LMoveGroup *group); |
michael@0 | 80 | bool visitValueToInt32(LValueToInt32 *lir); |
michael@0 | 81 | bool visitValueToDouble(LValueToDouble *lir); |
michael@0 | 82 | bool visitValueToFloat32(LValueToFloat32 *lir); |
michael@0 | 83 | bool visitFloat32ToDouble(LFloat32ToDouble *lir); |
michael@0 | 84 | bool visitDoubleToFloat32(LDoubleToFloat32 *lir); |
michael@0 | 85 | bool visitInt32ToFloat32(LInt32ToFloat32 *lir); |
michael@0 | 86 | bool visitInt32ToDouble(LInt32ToDouble *lir); |
michael@0 | 87 | void emitOOLTestObject(Register objreg, Label *ifTruthy, Label *ifFalsy, Register scratch); |
michael@0 | 88 | bool visitTestOAndBranch(LTestOAndBranch *lir); |
michael@0 | 89 | bool visitTestVAndBranch(LTestVAndBranch *lir); |
michael@0 | 90 | bool visitFunctionDispatch(LFunctionDispatch *lir); |
michael@0 | 91 | bool visitTypeObjectDispatch(LTypeObjectDispatch *lir); |
michael@0 | 92 | bool visitBooleanToString(LBooleanToString *lir); |
michael@0 | 93 | void emitIntToString(Register input, Register output, Label *ool); |
michael@0 | 94 | bool visitIntToString(LIntToString *lir); |
michael@0 | 95 | bool visitDoubleToString(LDoubleToString *lir); |
michael@0 | 96 | bool visitPrimitiveToString(LPrimitiveToString *lir); |
michael@0 | 97 | bool visitInteger(LInteger *lir); |
michael@0 | 98 | bool visitRegExp(LRegExp *lir); |
michael@0 | 99 | bool visitRegExpExec(LRegExpExec *lir); |
michael@0 | 100 | bool visitRegExpTest(LRegExpTest *lir); |
michael@0 | 101 | bool visitRegExpReplace(LRegExpReplace *lir); |
michael@0 | 102 | bool visitStringReplace(LStringReplace *lir); |
michael@0 | 103 | bool visitLambda(LLambda *lir); |
michael@0 | 104 | bool visitLambdaArrow(LLambdaArrow *lir); |
michael@0 | 105 | bool visitLambdaForSingleton(LLambdaForSingleton *lir); |
michael@0 | 106 | bool visitLambdaPar(LLambdaPar *lir); |
michael@0 | 107 | bool visitPointer(LPointer *lir); |
michael@0 | 108 | bool visitSlots(LSlots *lir); |
michael@0 | 109 | bool visitStoreSlotV(LStoreSlotV *store); |
michael@0 | 110 | bool visitElements(LElements *lir); |
michael@0 | 111 | bool visitConvertElementsToDoubles(LConvertElementsToDoubles *lir); |
michael@0 | 112 | bool visitMaybeToDoubleElement(LMaybeToDoubleElement *lir); |
michael@0 | 113 | bool visitGuardObjectIdentity(LGuardObjectIdentity *guard); |
michael@0 | 114 | bool visitTypeBarrierV(LTypeBarrierV *lir); |
michael@0 | 115 | bool visitTypeBarrierO(LTypeBarrierO *lir); |
michael@0 | 116 | bool visitMonitorTypes(LMonitorTypes *lir); |
michael@0 | 117 | bool visitPostWriteBarrierO(LPostWriteBarrierO *lir); |
michael@0 | 118 | bool visitPostWriteBarrierV(LPostWriteBarrierV *lir); |
michael@0 | 119 | bool visitOutOfLineCallPostWriteBarrier(OutOfLineCallPostWriteBarrier *ool); |
michael@0 | 120 | bool visitCallNative(LCallNative *call); |
michael@0 | 121 | bool emitCallInvokeFunction(LInstruction *call, Register callereg, |
michael@0 | 122 | uint32_t argc, uint32_t unusedStack); |
michael@0 | 123 | bool visitCallGeneric(LCallGeneric *call); |
michael@0 | 124 | bool visitCallKnown(LCallKnown *call); |
michael@0 | 125 | bool emitCallInvokeFunction(LApplyArgsGeneric *apply, Register extraStackSize); |
michael@0 | 126 | void emitPushArguments(LApplyArgsGeneric *apply, Register extraStackSpace); |
michael@0 | 127 | void emitPopArguments(LApplyArgsGeneric *apply, Register extraStackSize); |
michael@0 | 128 | bool visitApplyArgsGeneric(LApplyArgsGeneric *apply); |
michael@0 | 129 | bool visitBail(LBail *lir); |
michael@0 | 130 | bool visitGetDynamicName(LGetDynamicName *lir); |
michael@0 | 131 | bool visitFilterArgumentsOrEvalS(LFilterArgumentsOrEvalS *lir); |
michael@0 | 132 | bool visitFilterArgumentsOrEvalV(LFilterArgumentsOrEvalV *lir); |
michael@0 | 133 | bool visitCallDirectEvalS(LCallDirectEvalS *lir); |
michael@0 | 134 | bool visitCallDirectEvalV(LCallDirectEvalV *lir); |
michael@0 | 135 | bool visitDoubleToInt32(LDoubleToInt32 *lir); |
michael@0 | 136 | bool visitFloat32ToInt32(LFloat32ToInt32 *lir); |
michael@0 | 137 | bool visitNewSlots(LNewSlots *lir); |
michael@0 | 138 | bool visitNewArrayCallVM(LNewArray *lir); |
michael@0 | 139 | bool visitNewArray(LNewArray *lir); |
michael@0 | 140 | bool visitOutOfLineNewArray(OutOfLineNewArray *ool); |
michael@0 | 141 | bool visitNewObjectVMCall(LNewObject *lir); |
michael@0 | 142 | bool visitNewObject(LNewObject *lir); |
michael@0 | 143 | bool visitOutOfLineNewObject(OutOfLineNewObject *ool); |
michael@0 | 144 | bool visitNewDeclEnvObject(LNewDeclEnvObject *lir); |
michael@0 | 145 | bool visitNewCallObject(LNewCallObject *lir); |
michael@0 | 146 | bool visitNewSingletonCallObject(LNewSingletonCallObject *lir); |
michael@0 | 147 | bool visitNewCallObjectPar(LNewCallObjectPar *lir); |
michael@0 | 148 | bool visitNewStringObject(LNewStringObject *lir); |
michael@0 | 149 | bool visitNewPar(LNewPar *lir); |
michael@0 | 150 | bool visitNewDenseArrayPar(LNewDenseArrayPar *lir); |
michael@0 | 151 | bool visitNewDerivedTypedObject(LNewDerivedTypedObject *lir); |
michael@0 | 152 | bool visitAbortPar(LAbortPar *lir); |
michael@0 | 153 | bool visitInitElem(LInitElem *lir); |
michael@0 | 154 | bool visitInitElemGetterSetter(LInitElemGetterSetter *lir); |
michael@0 | 155 | bool visitMutateProto(LMutateProto *lir); |
michael@0 | 156 | bool visitInitProp(LInitProp *lir); |
michael@0 | 157 | bool visitInitPropGetterSetter(LInitPropGetterSetter *lir); |
michael@0 | 158 | bool visitCreateThis(LCreateThis *lir); |
michael@0 | 159 | bool visitCreateThisWithProto(LCreateThisWithProto *lir); |
michael@0 | 160 | bool visitCreateThisWithTemplate(LCreateThisWithTemplate *lir); |
michael@0 | 161 | bool visitCreateArgumentsObject(LCreateArgumentsObject *lir); |
michael@0 | 162 | bool visitGetArgumentsObjectArg(LGetArgumentsObjectArg *lir); |
michael@0 | 163 | bool visitSetArgumentsObjectArg(LSetArgumentsObjectArg *lir); |
michael@0 | 164 | bool visitReturnFromCtor(LReturnFromCtor *lir); |
michael@0 | 165 | bool visitComputeThis(LComputeThis *lir); |
michael@0 | 166 | bool visitLoadArrowThis(LLoadArrowThis *lir); |
michael@0 | 167 | bool visitArrayLength(LArrayLength *lir); |
michael@0 | 168 | bool visitSetArrayLength(LSetArrayLength *lir); |
michael@0 | 169 | bool visitTypedArrayLength(LTypedArrayLength *lir); |
michael@0 | 170 | bool visitTypedArrayElements(LTypedArrayElements *lir); |
michael@0 | 171 | bool visitNeuterCheck(LNeuterCheck *lir); |
michael@0 | 172 | bool visitTypedObjectElements(LTypedObjectElements *lir); |
michael@0 | 173 | bool visitSetTypedObjectOffset(LSetTypedObjectOffset *lir); |
michael@0 | 174 | bool visitStringLength(LStringLength *lir); |
michael@0 | 175 | bool visitInitializedLength(LInitializedLength *lir); |
michael@0 | 176 | bool visitSetInitializedLength(LSetInitializedLength *lir); |
michael@0 | 177 | bool visitNotO(LNotO *ins); |
michael@0 | 178 | bool visitNotV(LNotV *ins); |
michael@0 | 179 | bool visitBoundsCheck(LBoundsCheck *lir); |
michael@0 | 180 | bool visitBoundsCheckRange(LBoundsCheckRange *lir); |
michael@0 | 181 | bool visitBoundsCheckLower(LBoundsCheckLower *lir); |
michael@0 | 182 | bool visitLoadFixedSlotV(LLoadFixedSlotV *ins); |
michael@0 | 183 | bool visitLoadFixedSlotT(LLoadFixedSlotT *ins); |
michael@0 | 184 | bool visitStoreFixedSlotV(LStoreFixedSlotV *ins); |
michael@0 | 185 | bool visitStoreFixedSlotT(LStoreFixedSlotT *ins); |
michael@0 | 186 | bool emitGetPropertyPolymorphic(LInstruction *lir, Register obj, |
michael@0 | 187 | Register scratch, const TypedOrValueRegister &output); |
michael@0 | 188 | bool visitGetPropertyPolymorphicV(LGetPropertyPolymorphicV *ins); |
michael@0 | 189 | bool visitGetPropertyPolymorphicT(LGetPropertyPolymorphicT *ins); |
michael@0 | 190 | bool emitSetPropertyPolymorphic(LInstruction *lir, Register obj, |
michael@0 | 191 | Register scratch, const ConstantOrRegister &value); |
michael@0 | 192 | bool visitSetPropertyPolymorphicV(LSetPropertyPolymorphicV *ins); |
michael@0 | 193 | bool visitArraySplice(LArraySplice *splice); |
michael@0 | 194 | bool visitSetPropertyPolymorphicT(LSetPropertyPolymorphicT *ins); |
michael@0 | 195 | bool visitAbsI(LAbsI *lir); |
michael@0 | 196 | bool visitAtan2D(LAtan2D *lir); |
michael@0 | 197 | bool visitHypot(LHypot *lir); |
michael@0 | 198 | bool visitPowI(LPowI *lir); |
michael@0 | 199 | bool visitPowD(LPowD *lir); |
michael@0 | 200 | bool visitRandom(LRandom *lir); |
michael@0 | 201 | bool visitMathFunctionD(LMathFunctionD *ins); |
michael@0 | 202 | bool visitMathFunctionF(LMathFunctionF *ins); |
michael@0 | 203 | bool visitModD(LModD *ins); |
michael@0 | 204 | bool visitMinMaxI(LMinMaxI *lir); |
michael@0 | 205 | bool visitBinaryV(LBinaryV *lir); |
michael@0 | 206 | bool emitCompareS(LInstruction *lir, JSOp op, Register left, Register right, |
michael@0 | 207 | Register output, Register temp); |
michael@0 | 208 | bool visitCompareS(LCompareS *lir); |
michael@0 | 209 | bool visitCompareStrictS(LCompareStrictS *lir); |
michael@0 | 210 | bool visitCompareVM(LCompareVM *lir); |
michael@0 | 211 | bool visitIsNullOrLikeUndefined(LIsNullOrLikeUndefined *lir); |
michael@0 | 212 | bool visitIsNullOrLikeUndefinedAndBranch(LIsNullOrLikeUndefinedAndBranch *lir); |
michael@0 | 213 | bool visitEmulatesUndefined(LEmulatesUndefined *lir); |
michael@0 | 214 | bool visitEmulatesUndefinedAndBranch(LEmulatesUndefinedAndBranch *lir); |
michael@0 | 215 | bool emitConcat(LInstruction *lir, Register lhs, Register rhs, Register output); |
michael@0 | 216 | bool visitConcat(LConcat *lir); |
michael@0 | 217 | bool visitConcatPar(LConcatPar *lir); |
michael@0 | 218 | bool visitCharCodeAt(LCharCodeAt *lir); |
michael@0 | 219 | bool visitFromCharCode(LFromCharCode *lir); |
michael@0 | 220 | bool visitStringSplit(LStringSplit *lir); |
michael@0 | 221 | bool visitFunctionEnvironment(LFunctionEnvironment *lir); |
michael@0 | 222 | bool visitForkJoinContext(LForkJoinContext *lir); |
michael@0 | 223 | bool visitGuardThreadExclusive(LGuardThreadExclusive *lir); |
michael@0 | 224 | bool visitCallGetProperty(LCallGetProperty *lir); |
michael@0 | 225 | bool visitCallGetElement(LCallGetElement *lir); |
michael@0 | 226 | bool visitCallSetElement(LCallSetElement *lir); |
michael@0 | 227 | bool visitCallInitElementArray(LCallInitElementArray *lir); |
michael@0 | 228 | bool visitThrow(LThrow *lir); |
michael@0 | 229 | bool visitTypeOfV(LTypeOfV *lir); |
michael@0 | 230 | bool visitOutOfLineTypeOfV(OutOfLineTypeOfV *ool); |
michael@0 | 231 | bool visitToIdV(LToIdV *lir); |
michael@0 | 232 | bool visitLoadElementV(LLoadElementV *load); |
michael@0 | 233 | bool visitLoadElementHole(LLoadElementHole *lir); |
michael@0 | 234 | bool visitStoreElementT(LStoreElementT *lir); |
michael@0 | 235 | bool visitStoreElementV(LStoreElementV *lir); |
michael@0 | 236 | bool visitStoreElementHoleT(LStoreElementHoleT *lir); |
michael@0 | 237 | bool visitStoreElementHoleV(LStoreElementHoleV *lir); |
michael@0 | 238 | bool emitArrayPopShift(LInstruction *lir, const MArrayPopShift *mir, Register obj, |
michael@0 | 239 | Register elementsTemp, Register lengthTemp, TypedOrValueRegister out); |
michael@0 | 240 | bool visitArrayPopShiftV(LArrayPopShiftV *lir); |
michael@0 | 241 | bool visitArrayPopShiftT(LArrayPopShiftT *lir); |
michael@0 | 242 | bool emitArrayPush(LInstruction *lir, const MArrayPush *mir, Register obj, |
michael@0 | 243 | ConstantOrRegister value, Register elementsTemp, Register length); |
michael@0 | 244 | bool visitArrayPushV(LArrayPushV *lir); |
michael@0 | 245 | bool visitArrayPushT(LArrayPushT *lir); |
michael@0 | 246 | bool visitArrayConcat(LArrayConcat *lir); |
michael@0 | 247 | bool visitLoadTypedArrayElement(LLoadTypedArrayElement *lir); |
michael@0 | 248 | bool visitLoadTypedArrayElementHole(LLoadTypedArrayElementHole *lir); |
michael@0 | 249 | bool visitStoreTypedArrayElement(LStoreTypedArrayElement *lir); |
michael@0 | 250 | bool visitStoreTypedArrayElementHole(LStoreTypedArrayElementHole *lir); |
michael@0 | 251 | bool visitClampIToUint8(LClampIToUint8 *lir); |
michael@0 | 252 | bool visitClampDToUint8(LClampDToUint8 *lir); |
michael@0 | 253 | bool visitClampVToUint8(LClampVToUint8 *lir); |
michael@0 | 254 | bool visitCallIteratorStart(LCallIteratorStart *lir); |
michael@0 | 255 | bool visitIteratorStart(LIteratorStart *lir); |
michael@0 | 256 | bool visitIteratorNext(LIteratorNext *lir); |
michael@0 | 257 | bool visitIteratorMore(LIteratorMore *lir); |
michael@0 | 258 | bool visitIteratorEnd(LIteratorEnd *lir); |
michael@0 | 259 | bool visitArgumentsLength(LArgumentsLength *lir); |
michael@0 | 260 | bool visitGetFrameArgument(LGetFrameArgument *lir); |
michael@0 | 261 | bool visitSetFrameArgumentT(LSetFrameArgumentT *lir); |
michael@0 | 262 | bool visitSetFrameArgumentC(LSetFrameArgumentC *lir); |
michael@0 | 263 | bool visitSetFrameArgumentV(LSetFrameArgumentV *lir); |
michael@0 | 264 | bool visitRunOncePrologue(LRunOncePrologue *lir); |
michael@0 | 265 | bool emitRest(LInstruction *lir, Register array, Register numActuals, |
michael@0 | 266 | Register temp0, Register temp1, unsigned numFormals, |
michael@0 | 267 | JSObject *templateObject); |
michael@0 | 268 | bool visitRest(LRest *lir); |
michael@0 | 269 | bool visitRestPar(LRestPar *lir); |
michael@0 | 270 | bool visitCallSetProperty(LCallSetProperty *ins); |
michael@0 | 271 | bool visitCallDeleteProperty(LCallDeleteProperty *lir); |
michael@0 | 272 | bool visitCallDeleteElement(LCallDeleteElement *lir); |
michael@0 | 273 | bool visitBitNotV(LBitNotV *lir); |
michael@0 | 274 | bool visitBitOpV(LBitOpV *lir); |
michael@0 | 275 | bool emitInstanceOf(LInstruction *ins, JSObject *prototypeObject); |
michael@0 | 276 | bool visitIn(LIn *ins); |
michael@0 | 277 | bool visitInArray(LInArray *ins); |
michael@0 | 278 | bool visitInstanceOfO(LInstanceOfO *ins); |
michael@0 | 279 | bool visitInstanceOfV(LInstanceOfV *ins); |
michael@0 | 280 | bool visitCallInstanceOf(LCallInstanceOf *ins); |
michael@0 | 281 | bool visitProfilerStackOp(LProfilerStackOp *lir); |
michael@0 | 282 | bool visitGetDOMProperty(LGetDOMProperty *lir); |
michael@0 | 283 | bool visitGetDOMMember(LGetDOMMember *lir); |
michael@0 | 284 | bool visitSetDOMProperty(LSetDOMProperty *lir); |
michael@0 | 285 | bool visitCallDOMNative(LCallDOMNative *lir); |
michael@0 | 286 | bool visitCallGetIntrinsicValue(LCallGetIntrinsicValue *lir); |
michael@0 | 287 | bool visitIsCallable(LIsCallable *lir); |
michael@0 | 288 | bool visitHaveSameClass(LHaveSameClass *lir); |
michael@0 | 289 | bool visitHasClass(LHasClass *lir); |
michael@0 | 290 | bool visitAsmJSCall(LAsmJSCall *lir); |
michael@0 | 291 | bool visitAsmJSParameter(LAsmJSParameter *lir); |
michael@0 | 292 | bool visitAsmJSReturn(LAsmJSReturn *ret); |
michael@0 | 293 | bool visitAsmJSVoidReturn(LAsmJSVoidReturn *ret); |
michael@0 | 294 | |
michael@0 | 295 | bool visitCheckOverRecursed(LCheckOverRecursed *lir); |
michael@0 | 296 | bool visitCheckOverRecursedFailure(CheckOverRecursedFailure *ool); |
michael@0 | 297 | |
michael@0 | 298 | bool visitCheckOverRecursedPar(LCheckOverRecursedPar *lir); |
michael@0 | 299 | bool visitCheckOverRecursedFailurePar(CheckOverRecursedFailurePar *ool); |
michael@0 | 300 | |
michael@0 | 301 | bool visitInterruptCheckPar(LInterruptCheckPar *lir); |
michael@0 | 302 | bool visitOutOfLineInterruptCheckPar(OutOfLineInterruptCheckPar *ool); |
michael@0 | 303 | |
michael@0 | 304 | bool visitInterruptCheckImplicit(LInterruptCheckImplicit *ins); |
michael@0 | 305 | bool visitOutOfLineInterruptCheckImplicit(OutOfLineInterruptCheckImplicit *ins); |
michael@0 | 306 | |
michael@0 | 307 | bool visitUnboxFloatingPoint(LUnboxFloatingPoint *lir); |
michael@0 | 308 | bool visitOutOfLineUnboxFloatingPoint(OutOfLineUnboxFloatingPoint *ool); |
michael@0 | 309 | bool visitOutOfLineStoreElementHole(OutOfLineStoreElementHole *ool); |
michael@0 | 310 | |
michael@0 | 311 | bool visitOutOfLineNewGCThingPar(OutOfLineNewGCThingPar *ool); |
michael@0 | 312 | bool visitOutOfLineAbortPar(OutOfLineAbortPar *ool); |
michael@0 | 313 | bool visitOutOfLinePropagateAbortPar(OutOfLinePropagateAbortPar *ool); |
michael@0 | 314 | void loadJSScriptForBlock(MBasicBlock *block, Register reg); |
michael@0 | 315 | void loadOutermostJSScript(Register reg); |
michael@0 | 316 | |
michael@0 | 317 | // Inline caches visitors. |
michael@0 | 318 | bool visitOutOfLineCache(OutOfLineUpdateCache *ool); |
michael@0 | 319 | |
michael@0 | 320 | bool visitGetPropertyCacheV(LGetPropertyCacheV *ins); |
michael@0 | 321 | bool visitGetPropertyCacheT(LGetPropertyCacheT *ins); |
michael@0 | 322 | bool visitGetElementCacheV(LGetElementCacheV *ins); |
michael@0 | 323 | bool visitGetElementCacheT(LGetElementCacheT *ins); |
michael@0 | 324 | bool visitSetElementCacheV(LSetElementCacheV *ins); |
michael@0 | 325 | bool visitSetElementCacheT(LSetElementCacheT *ins); |
michael@0 | 326 | bool visitBindNameCache(LBindNameCache *ins); |
michael@0 | 327 | bool visitCallSetProperty(LInstruction *ins); |
michael@0 | 328 | bool visitSetPropertyCacheV(LSetPropertyCacheV *ins); |
michael@0 | 329 | bool visitSetPropertyCacheT(LSetPropertyCacheT *ins); |
michael@0 | 330 | bool visitGetNameCache(LGetNameCache *ins); |
michael@0 | 331 | bool visitCallsiteCloneCache(LCallsiteCloneCache *ins); |
michael@0 | 332 | |
michael@0 | 333 | bool visitGetPropertyIC(OutOfLineUpdateCache *ool, DataPtr<GetPropertyIC> &ic); |
michael@0 | 334 | bool visitGetPropertyParIC(OutOfLineUpdateCache *ool, DataPtr<GetPropertyParIC> &ic); |
michael@0 | 335 | bool visitSetPropertyIC(OutOfLineUpdateCache *ool, DataPtr<SetPropertyIC> &ic); |
michael@0 | 336 | bool visitSetPropertyParIC(OutOfLineUpdateCache *ool, DataPtr<SetPropertyParIC> &ic); |
michael@0 | 337 | bool visitGetElementIC(OutOfLineUpdateCache *ool, DataPtr<GetElementIC> &ic); |
michael@0 | 338 | bool visitGetElementParIC(OutOfLineUpdateCache *ool, DataPtr<GetElementParIC> &ic); |
michael@0 | 339 | bool visitSetElementIC(OutOfLineUpdateCache *ool, DataPtr<SetElementIC> &ic); |
michael@0 | 340 | bool visitSetElementParIC(OutOfLineUpdateCache *ool, DataPtr<SetElementParIC> &ic); |
michael@0 | 341 | bool visitBindNameIC(OutOfLineUpdateCache *ool, DataPtr<BindNameIC> &ic); |
michael@0 | 342 | bool visitNameIC(OutOfLineUpdateCache *ool, DataPtr<NameIC> &ic); |
michael@0 | 343 | bool visitCallsiteCloneIC(OutOfLineUpdateCache *ool, DataPtr<CallsiteCloneIC> &ic); |
michael@0 | 344 | |
michael@0 | 345 | bool visitAssertRangeI(LAssertRangeI *ins); |
michael@0 | 346 | bool visitAssertRangeD(LAssertRangeD *ins); |
michael@0 | 347 | bool visitAssertRangeF(LAssertRangeF *ins); |
michael@0 | 348 | bool visitAssertRangeV(LAssertRangeV *ins); |
michael@0 | 349 | |
michael@0 | 350 | bool visitRecompileCheck(LRecompileCheck *ins); |
michael@0 | 351 | |
michael@0 | 352 | private: |
michael@0 | 353 | bool addGetPropertyCache(LInstruction *ins, RegisterSet liveRegs, Register objReg, |
michael@0 | 354 | PropertyName *name, TypedOrValueRegister output, |
michael@0 | 355 | bool monitoredResult); |
michael@0 | 356 | bool addGetElementCache(LInstruction *ins, Register obj, ConstantOrRegister index, |
michael@0 | 357 | TypedOrValueRegister output, bool monitoredResult, |
michael@0 | 358 | bool allowDoubleResult); |
michael@0 | 359 | bool addSetPropertyCache(LInstruction *ins, RegisterSet liveRegs, Register objReg, |
michael@0 | 360 | PropertyName *name, ConstantOrRegister value, bool strict, |
michael@0 | 361 | bool needsTypeBarrier); |
michael@0 | 362 | bool addSetElementCache(LInstruction *ins, Register obj, Register unboxIndex, Register temp, |
michael@0 | 363 | FloatRegister tempFloat, ValueOperand index, ConstantOrRegister value, |
michael@0 | 364 | bool strict, bool guardHoles); |
michael@0 | 365 | bool checkForAbortPar(LInstruction *lir); |
michael@0 | 366 | |
michael@0 | 367 | bool generateBranchV(const ValueOperand &value, Label *ifTrue, Label *ifFalse, FloatRegister fr); |
michael@0 | 368 | |
michael@0 | 369 | bool emitAllocateGCThingPar(LInstruction *lir, Register objReg, Register cxReg, |
michael@0 | 370 | Register tempReg1, Register tempReg2, |
michael@0 | 371 | JSObject *templateObj); |
michael@0 | 372 | |
michael@0 | 373 | bool emitCallToUncompiledScriptPar(LInstruction *lir, Register calleeReg); |
michael@0 | 374 | |
michael@0 | 375 | void emitLambdaInit(Register resultReg, Register scopeChainReg, |
michael@0 | 376 | const LambdaFunctionInfo &info); |
michael@0 | 377 | |
michael@0 | 378 | bool emitFilterArgumentsOrEval(LInstruction *lir, Register string, Register temp1, |
michael@0 | 379 | Register temp2); |
michael@0 | 380 | |
michael@0 | 381 | IonScriptCounts *maybeCreateScriptCounts(); |
michael@0 | 382 | |
michael@0 | 383 | // This function behaves like testValueTruthy with the exception that it can |
michael@0 | 384 | // choose to let control flow fall through when the object is truthy, as |
michael@0 | 385 | // an optimization. Use testValueTruthy when it's required to branch to one |
michael@0 | 386 | // of the two labels. |
michael@0 | 387 | void testValueTruthyKernel(const ValueOperand &value, |
michael@0 | 388 | const LDefinition *scratch1, const LDefinition *scratch2, |
michael@0 | 389 | FloatRegister fr, |
michael@0 | 390 | Label *ifTruthy, Label *ifFalsy, |
michael@0 | 391 | OutOfLineTestObject *ool); |
michael@0 | 392 | |
michael@0 | 393 | // Test whether value is truthy or not and jump to the corresponding label. |
michael@0 | 394 | // If the value can be an object that emulates |undefined|, |ool| must be |
michael@0 | 395 | // non-null; otherwise it may be null (and the scratch definitions should |
michael@0 | 396 | // be bogus), in which case an object encountered here will always be |
michael@0 | 397 | // truthy. |
michael@0 | 398 | void testValueTruthy(const ValueOperand &value, |
michael@0 | 399 | const LDefinition *scratch1, const LDefinition *scratch2, |
michael@0 | 400 | FloatRegister fr, |
michael@0 | 401 | Label *ifTruthy, Label *ifFalsy, |
michael@0 | 402 | OutOfLineTestObject *ool); |
michael@0 | 403 | |
michael@0 | 404 | // This function behaves like testObjectEmulatesUndefined with the exception |
michael@0 | 405 | // that it can choose to let control flow fall through when the object |
michael@0 | 406 | // doesn't emulate undefined, as an optimization. Use the regular |
michael@0 | 407 | // testObjectEmulatesUndefined when it's required to branch to one of the |
michael@0 | 408 | // two labels. |
michael@0 | 409 | void testObjectEmulatesUndefinedKernel(Register objreg, |
michael@0 | 410 | Label *ifEmulatesUndefined, |
michael@0 | 411 | Label *ifDoesntEmulateUndefined, |
michael@0 | 412 | Register scratch, OutOfLineTestObject *ool); |
michael@0 | 413 | |
michael@0 | 414 | // Test whether an object emulates |undefined|. If it does, jump to |
michael@0 | 415 | // |ifEmulatesUndefined|; the caller is responsible for binding this label. |
michael@0 | 416 | // If it doesn't, fall through; the label |ifDoesntEmulateUndefined| (which |
michael@0 | 417 | // must be initially unbound) will be bound at this point. |
michael@0 | 418 | void branchTestObjectEmulatesUndefined(Register objreg, |
michael@0 | 419 | Label *ifEmulatesUndefined, |
michael@0 | 420 | Label *ifDoesntEmulateUndefined, |
michael@0 | 421 | Register scratch, OutOfLineTestObject *ool); |
michael@0 | 422 | |
michael@0 | 423 | // Test whether an object emulates |undefined|, and jump to the |
michael@0 | 424 | // corresponding label. |
michael@0 | 425 | // |
michael@0 | 426 | // This method should be used when subsequent code can't be laid out in a |
michael@0 | 427 | // straight line; if it can, branchTest* should be used instead. |
michael@0 | 428 | void testObjectEmulatesUndefined(Register objreg, |
michael@0 | 429 | Label *ifEmulatesUndefined, |
michael@0 | 430 | Label *ifDoesntEmulateUndefined, |
michael@0 | 431 | Register scratch, OutOfLineTestObject *ool); |
michael@0 | 432 | |
michael@0 | 433 | // Get a label for the start of block which can be used for jumping, in |
michael@0 | 434 | // place of jumpToBlock. |
michael@0 | 435 | Label *getJumpLabelForBranch(MBasicBlock *block); |
michael@0 | 436 | |
michael@0 | 437 | // Bailout if an element about to be written to is a hole. |
michael@0 | 438 | bool emitStoreHoleCheck(Register elements, const LAllocation *index, LSnapshot *snapshot); |
michael@0 | 439 | |
michael@0 | 440 | bool emitAssertRangeI(const Range *r, Register input); |
michael@0 | 441 | bool emitAssertRangeD(const Range *r, FloatRegister input, FloatRegister temp); |
michael@0 | 442 | |
michael@0 | 443 | Vector<CodeOffsetLabel, 0, IonAllocPolicy> ionScriptLabels_; |
michael@0 | 444 | #ifdef DEBUG |
michael@0 | 445 | bool branchIfInvalidated(Register temp, Label *invalidated); |
michael@0 | 446 | |
michael@0 | 447 | bool emitDebugResultChecks(LInstruction *ins); |
michael@0 | 448 | bool emitObjectOrStringResultChecks(LInstruction *lir, MDefinition *mir); |
michael@0 | 449 | bool emitValueResultChecks(LInstruction *lir, MDefinition *mir); |
michael@0 | 450 | #endif |
michael@0 | 451 | |
michael@0 | 452 | #if defined(JS_ION_PERF) |
michael@0 | 453 | PerfSpewer perfSpewer_; |
michael@0 | 454 | #endif |
michael@0 | 455 | }; |
michael@0 | 456 | |
michael@0 | 457 | } // namespace jit |
michael@0 | 458 | } // namespace js |
michael@0 | 459 | |
michael@0 | 460 | #endif /* jit_CodeGenerator_h */ |