1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit/CodeGenerator.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,460 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99: 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef jit_CodeGenerator_h 1.11 +#define jit_CodeGenerator_h 1.12 + 1.13 +#include "jit/IonCaches.h" 1.14 +#if defined(JS_ION_PERF) 1.15 +# include "jit/PerfSpewer.h" 1.16 +#endif 1.17 + 1.18 +#if defined(JS_CODEGEN_X86) 1.19 +# include "jit/x86/CodeGenerator-x86.h" 1.20 +#elif defined(JS_CODEGEN_X64) 1.21 +# include "jit/x64/CodeGenerator-x64.h" 1.22 +#elif defined(JS_CODEGEN_ARM) 1.23 +# include "jit/arm/CodeGenerator-arm.h" 1.24 +#elif defined(JS_CODEGEN_MIPS) 1.25 +# include "jit/mips/CodeGenerator-mips.h" 1.26 +#else 1.27 +#error "Unknown architecture!" 1.28 +#endif 1.29 + 1.30 +namespace js { 1.31 +namespace jit { 1.32 + 1.33 +class OutOfLineTestObject; 1.34 +class OutOfLineNewArray; 1.35 +class OutOfLineNewObject; 1.36 +class CheckOverRecursedFailure; 1.37 +class CheckOverRecursedFailurePar; 1.38 +class OutOfLineInterruptCheckPar; 1.39 +class OutOfLineInterruptCheckImplicit; 1.40 +class OutOfLineUnboxFloatingPoint; 1.41 +class OutOfLineStoreElementHole; 1.42 +class OutOfLineTypeOfV; 1.43 +class OutOfLineLoadTypedArray; 1.44 +class OutOfLineNewGCThingPar; 1.45 +class OutOfLineUpdateCache; 1.46 +class OutOfLineCallPostWriteBarrier; 1.47 + 1.48 +class CodeGenerator : public CodeGeneratorSpecific 1.49 +{ 1.50 + bool generateArgumentsChecks(bool bailout = true); 1.51 + bool generateBody(); 1.52 + 1.53 + public: 1.54 + CodeGenerator(MIRGenerator *gen, LIRGraph *graph, MacroAssembler *masm = nullptr); 1.55 + ~CodeGenerator(); 1.56 + 1.57 + public: 1.58 + bool generate(); 1.59 + bool generateAsmJS(Label *stackOverflowLabel); 1.60 + bool link(JSContext *cx, types::CompilerConstraintList *constraints); 1.61 + 1.62 + bool visitLabel(LLabel *lir); 1.63 + bool visitNop(LNop *lir); 1.64 + bool visitOsiPoint(LOsiPoint *lir); 1.65 + bool visitGoto(LGoto *lir); 1.66 + bool visitTableSwitch(LTableSwitch *ins); 1.67 + bool visitTableSwitchV(LTableSwitchV *ins); 1.68 + bool visitCloneLiteral(LCloneLiteral *lir); 1.69 + bool visitParameter(LParameter *lir); 1.70 + bool visitCallee(LCallee *lir); 1.71 + bool visitStart(LStart *lir); 1.72 + bool visitReturn(LReturn *ret); 1.73 + bool visitDefVar(LDefVar *lir); 1.74 + bool visitDefFun(LDefFun *lir); 1.75 + bool visitOsrEntry(LOsrEntry *lir); 1.76 + bool visitOsrScopeChain(LOsrScopeChain *lir); 1.77 + bool visitOsrValue(LOsrValue *lir); 1.78 + bool visitOsrReturnValue(LOsrReturnValue *lir); 1.79 + bool visitOsrArgumentsObject(LOsrArgumentsObject *lir); 1.80 + bool visitStackArgT(LStackArgT *lir); 1.81 + bool visitStackArgV(LStackArgV *lir); 1.82 + bool visitMoveGroup(LMoveGroup *group); 1.83 + bool visitValueToInt32(LValueToInt32 *lir); 1.84 + bool visitValueToDouble(LValueToDouble *lir); 1.85 + bool visitValueToFloat32(LValueToFloat32 *lir); 1.86 + bool visitFloat32ToDouble(LFloat32ToDouble *lir); 1.87 + bool visitDoubleToFloat32(LDoubleToFloat32 *lir); 1.88 + bool visitInt32ToFloat32(LInt32ToFloat32 *lir); 1.89 + bool visitInt32ToDouble(LInt32ToDouble *lir); 1.90 + void emitOOLTestObject(Register objreg, Label *ifTruthy, Label *ifFalsy, Register scratch); 1.91 + bool visitTestOAndBranch(LTestOAndBranch *lir); 1.92 + bool visitTestVAndBranch(LTestVAndBranch *lir); 1.93 + bool visitFunctionDispatch(LFunctionDispatch *lir); 1.94 + bool visitTypeObjectDispatch(LTypeObjectDispatch *lir); 1.95 + bool visitBooleanToString(LBooleanToString *lir); 1.96 + void emitIntToString(Register input, Register output, Label *ool); 1.97 + bool visitIntToString(LIntToString *lir); 1.98 + bool visitDoubleToString(LDoubleToString *lir); 1.99 + bool visitPrimitiveToString(LPrimitiveToString *lir); 1.100 + bool visitInteger(LInteger *lir); 1.101 + bool visitRegExp(LRegExp *lir); 1.102 + bool visitRegExpExec(LRegExpExec *lir); 1.103 + bool visitRegExpTest(LRegExpTest *lir); 1.104 + bool visitRegExpReplace(LRegExpReplace *lir); 1.105 + bool visitStringReplace(LStringReplace *lir); 1.106 + bool visitLambda(LLambda *lir); 1.107 + bool visitLambdaArrow(LLambdaArrow *lir); 1.108 + bool visitLambdaForSingleton(LLambdaForSingleton *lir); 1.109 + bool visitLambdaPar(LLambdaPar *lir); 1.110 + bool visitPointer(LPointer *lir); 1.111 + bool visitSlots(LSlots *lir); 1.112 + bool visitStoreSlotV(LStoreSlotV *store); 1.113 + bool visitElements(LElements *lir); 1.114 + bool visitConvertElementsToDoubles(LConvertElementsToDoubles *lir); 1.115 + bool visitMaybeToDoubleElement(LMaybeToDoubleElement *lir); 1.116 + bool visitGuardObjectIdentity(LGuardObjectIdentity *guard); 1.117 + bool visitTypeBarrierV(LTypeBarrierV *lir); 1.118 + bool visitTypeBarrierO(LTypeBarrierO *lir); 1.119 + bool visitMonitorTypes(LMonitorTypes *lir); 1.120 + bool visitPostWriteBarrierO(LPostWriteBarrierO *lir); 1.121 + bool visitPostWriteBarrierV(LPostWriteBarrierV *lir); 1.122 + bool visitOutOfLineCallPostWriteBarrier(OutOfLineCallPostWriteBarrier *ool); 1.123 + bool visitCallNative(LCallNative *call); 1.124 + bool emitCallInvokeFunction(LInstruction *call, Register callereg, 1.125 + uint32_t argc, uint32_t unusedStack); 1.126 + bool visitCallGeneric(LCallGeneric *call); 1.127 + bool visitCallKnown(LCallKnown *call); 1.128 + bool emitCallInvokeFunction(LApplyArgsGeneric *apply, Register extraStackSize); 1.129 + void emitPushArguments(LApplyArgsGeneric *apply, Register extraStackSpace); 1.130 + void emitPopArguments(LApplyArgsGeneric *apply, Register extraStackSize); 1.131 + bool visitApplyArgsGeneric(LApplyArgsGeneric *apply); 1.132 + bool visitBail(LBail *lir); 1.133 + bool visitGetDynamicName(LGetDynamicName *lir); 1.134 + bool visitFilterArgumentsOrEvalS(LFilterArgumentsOrEvalS *lir); 1.135 + bool visitFilterArgumentsOrEvalV(LFilterArgumentsOrEvalV *lir); 1.136 + bool visitCallDirectEvalS(LCallDirectEvalS *lir); 1.137 + bool visitCallDirectEvalV(LCallDirectEvalV *lir); 1.138 + bool visitDoubleToInt32(LDoubleToInt32 *lir); 1.139 + bool visitFloat32ToInt32(LFloat32ToInt32 *lir); 1.140 + bool visitNewSlots(LNewSlots *lir); 1.141 + bool visitNewArrayCallVM(LNewArray *lir); 1.142 + bool visitNewArray(LNewArray *lir); 1.143 + bool visitOutOfLineNewArray(OutOfLineNewArray *ool); 1.144 + bool visitNewObjectVMCall(LNewObject *lir); 1.145 + bool visitNewObject(LNewObject *lir); 1.146 + bool visitOutOfLineNewObject(OutOfLineNewObject *ool); 1.147 + bool visitNewDeclEnvObject(LNewDeclEnvObject *lir); 1.148 + bool visitNewCallObject(LNewCallObject *lir); 1.149 + bool visitNewSingletonCallObject(LNewSingletonCallObject *lir); 1.150 + bool visitNewCallObjectPar(LNewCallObjectPar *lir); 1.151 + bool visitNewStringObject(LNewStringObject *lir); 1.152 + bool visitNewPar(LNewPar *lir); 1.153 + bool visitNewDenseArrayPar(LNewDenseArrayPar *lir); 1.154 + bool visitNewDerivedTypedObject(LNewDerivedTypedObject *lir); 1.155 + bool visitAbortPar(LAbortPar *lir); 1.156 + bool visitInitElem(LInitElem *lir); 1.157 + bool visitInitElemGetterSetter(LInitElemGetterSetter *lir); 1.158 + bool visitMutateProto(LMutateProto *lir); 1.159 + bool visitInitProp(LInitProp *lir); 1.160 + bool visitInitPropGetterSetter(LInitPropGetterSetter *lir); 1.161 + bool visitCreateThis(LCreateThis *lir); 1.162 + bool visitCreateThisWithProto(LCreateThisWithProto *lir); 1.163 + bool visitCreateThisWithTemplate(LCreateThisWithTemplate *lir); 1.164 + bool visitCreateArgumentsObject(LCreateArgumentsObject *lir); 1.165 + bool visitGetArgumentsObjectArg(LGetArgumentsObjectArg *lir); 1.166 + bool visitSetArgumentsObjectArg(LSetArgumentsObjectArg *lir); 1.167 + bool visitReturnFromCtor(LReturnFromCtor *lir); 1.168 + bool visitComputeThis(LComputeThis *lir); 1.169 + bool visitLoadArrowThis(LLoadArrowThis *lir); 1.170 + bool visitArrayLength(LArrayLength *lir); 1.171 + bool visitSetArrayLength(LSetArrayLength *lir); 1.172 + bool visitTypedArrayLength(LTypedArrayLength *lir); 1.173 + bool visitTypedArrayElements(LTypedArrayElements *lir); 1.174 + bool visitNeuterCheck(LNeuterCheck *lir); 1.175 + bool visitTypedObjectElements(LTypedObjectElements *lir); 1.176 + bool visitSetTypedObjectOffset(LSetTypedObjectOffset *lir); 1.177 + bool visitStringLength(LStringLength *lir); 1.178 + bool visitInitializedLength(LInitializedLength *lir); 1.179 + bool visitSetInitializedLength(LSetInitializedLength *lir); 1.180 + bool visitNotO(LNotO *ins); 1.181 + bool visitNotV(LNotV *ins); 1.182 + bool visitBoundsCheck(LBoundsCheck *lir); 1.183 + bool visitBoundsCheckRange(LBoundsCheckRange *lir); 1.184 + bool visitBoundsCheckLower(LBoundsCheckLower *lir); 1.185 + bool visitLoadFixedSlotV(LLoadFixedSlotV *ins); 1.186 + bool visitLoadFixedSlotT(LLoadFixedSlotT *ins); 1.187 + bool visitStoreFixedSlotV(LStoreFixedSlotV *ins); 1.188 + bool visitStoreFixedSlotT(LStoreFixedSlotT *ins); 1.189 + bool emitGetPropertyPolymorphic(LInstruction *lir, Register obj, 1.190 + Register scratch, const TypedOrValueRegister &output); 1.191 + bool visitGetPropertyPolymorphicV(LGetPropertyPolymorphicV *ins); 1.192 + bool visitGetPropertyPolymorphicT(LGetPropertyPolymorphicT *ins); 1.193 + bool emitSetPropertyPolymorphic(LInstruction *lir, Register obj, 1.194 + Register scratch, const ConstantOrRegister &value); 1.195 + bool visitSetPropertyPolymorphicV(LSetPropertyPolymorphicV *ins); 1.196 + bool visitArraySplice(LArraySplice *splice); 1.197 + bool visitSetPropertyPolymorphicT(LSetPropertyPolymorphicT *ins); 1.198 + bool visitAbsI(LAbsI *lir); 1.199 + bool visitAtan2D(LAtan2D *lir); 1.200 + bool visitHypot(LHypot *lir); 1.201 + bool visitPowI(LPowI *lir); 1.202 + bool visitPowD(LPowD *lir); 1.203 + bool visitRandom(LRandom *lir); 1.204 + bool visitMathFunctionD(LMathFunctionD *ins); 1.205 + bool visitMathFunctionF(LMathFunctionF *ins); 1.206 + bool visitModD(LModD *ins); 1.207 + bool visitMinMaxI(LMinMaxI *lir); 1.208 + bool visitBinaryV(LBinaryV *lir); 1.209 + bool emitCompareS(LInstruction *lir, JSOp op, Register left, Register right, 1.210 + Register output, Register temp); 1.211 + bool visitCompareS(LCompareS *lir); 1.212 + bool visitCompareStrictS(LCompareStrictS *lir); 1.213 + bool visitCompareVM(LCompareVM *lir); 1.214 + bool visitIsNullOrLikeUndefined(LIsNullOrLikeUndefined *lir); 1.215 + bool visitIsNullOrLikeUndefinedAndBranch(LIsNullOrLikeUndefinedAndBranch *lir); 1.216 + bool visitEmulatesUndefined(LEmulatesUndefined *lir); 1.217 + bool visitEmulatesUndefinedAndBranch(LEmulatesUndefinedAndBranch *lir); 1.218 + bool emitConcat(LInstruction *lir, Register lhs, Register rhs, Register output); 1.219 + bool visitConcat(LConcat *lir); 1.220 + bool visitConcatPar(LConcatPar *lir); 1.221 + bool visitCharCodeAt(LCharCodeAt *lir); 1.222 + bool visitFromCharCode(LFromCharCode *lir); 1.223 + bool visitStringSplit(LStringSplit *lir); 1.224 + bool visitFunctionEnvironment(LFunctionEnvironment *lir); 1.225 + bool visitForkJoinContext(LForkJoinContext *lir); 1.226 + bool visitGuardThreadExclusive(LGuardThreadExclusive *lir); 1.227 + bool visitCallGetProperty(LCallGetProperty *lir); 1.228 + bool visitCallGetElement(LCallGetElement *lir); 1.229 + bool visitCallSetElement(LCallSetElement *lir); 1.230 + bool visitCallInitElementArray(LCallInitElementArray *lir); 1.231 + bool visitThrow(LThrow *lir); 1.232 + bool visitTypeOfV(LTypeOfV *lir); 1.233 + bool visitOutOfLineTypeOfV(OutOfLineTypeOfV *ool); 1.234 + bool visitToIdV(LToIdV *lir); 1.235 + bool visitLoadElementV(LLoadElementV *load); 1.236 + bool visitLoadElementHole(LLoadElementHole *lir); 1.237 + bool visitStoreElementT(LStoreElementT *lir); 1.238 + bool visitStoreElementV(LStoreElementV *lir); 1.239 + bool visitStoreElementHoleT(LStoreElementHoleT *lir); 1.240 + bool visitStoreElementHoleV(LStoreElementHoleV *lir); 1.241 + bool emitArrayPopShift(LInstruction *lir, const MArrayPopShift *mir, Register obj, 1.242 + Register elementsTemp, Register lengthTemp, TypedOrValueRegister out); 1.243 + bool visitArrayPopShiftV(LArrayPopShiftV *lir); 1.244 + bool visitArrayPopShiftT(LArrayPopShiftT *lir); 1.245 + bool emitArrayPush(LInstruction *lir, const MArrayPush *mir, Register obj, 1.246 + ConstantOrRegister value, Register elementsTemp, Register length); 1.247 + bool visitArrayPushV(LArrayPushV *lir); 1.248 + bool visitArrayPushT(LArrayPushT *lir); 1.249 + bool visitArrayConcat(LArrayConcat *lir); 1.250 + bool visitLoadTypedArrayElement(LLoadTypedArrayElement *lir); 1.251 + bool visitLoadTypedArrayElementHole(LLoadTypedArrayElementHole *lir); 1.252 + bool visitStoreTypedArrayElement(LStoreTypedArrayElement *lir); 1.253 + bool visitStoreTypedArrayElementHole(LStoreTypedArrayElementHole *lir); 1.254 + bool visitClampIToUint8(LClampIToUint8 *lir); 1.255 + bool visitClampDToUint8(LClampDToUint8 *lir); 1.256 + bool visitClampVToUint8(LClampVToUint8 *lir); 1.257 + bool visitCallIteratorStart(LCallIteratorStart *lir); 1.258 + bool visitIteratorStart(LIteratorStart *lir); 1.259 + bool visitIteratorNext(LIteratorNext *lir); 1.260 + bool visitIteratorMore(LIteratorMore *lir); 1.261 + bool visitIteratorEnd(LIteratorEnd *lir); 1.262 + bool visitArgumentsLength(LArgumentsLength *lir); 1.263 + bool visitGetFrameArgument(LGetFrameArgument *lir); 1.264 + bool visitSetFrameArgumentT(LSetFrameArgumentT *lir); 1.265 + bool visitSetFrameArgumentC(LSetFrameArgumentC *lir); 1.266 + bool visitSetFrameArgumentV(LSetFrameArgumentV *lir); 1.267 + bool visitRunOncePrologue(LRunOncePrologue *lir); 1.268 + bool emitRest(LInstruction *lir, Register array, Register numActuals, 1.269 + Register temp0, Register temp1, unsigned numFormals, 1.270 + JSObject *templateObject); 1.271 + bool visitRest(LRest *lir); 1.272 + bool visitRestPar(LRestPar *lir); 1.273 + bool visitCallSetProperty(LCallSetProperty *ins); 1.274 + bool visitCallDeleteProperty(LCallDeleteProperty *lir); 1.275 + bool visitCallDeleteElement(LCallDeleteElement *lir); 1.276 + bool visitBitNotV(LBitNotV *lir); 1.277 + bool visitBitOpV(LBitOpV *lir); 1.278 + bool emitInstanceOf(LInstruction *ins, JSObject *prototypeObject); 1.279 + bool visitIn(LIn *ins); 1.280 + bool visitInArray(LInArray *ins); 1.281 + bool visitInstanceOfO(LInstanceOfO *ins); 1.282 + bool visitInstanceOfV(LInstanceOfV *ins); 1.283 + bool visitCallInstanceOf(LCallInstanceOf *ins); 1.284 + bool visitProfilerStackOp(LProfilerStackOp *lir); 1.285 + bool visitGetDOMProperty(LGetDOMProperty *lir); 1.286 + bool visitGetDOMMember(LGetDOMMember *lir); 1.287 + bool visitSetDOMProperty(LSetDOMProperty *lir); 1.288 + bool visitCallDOMNative(LCallDOMNative *lir); 1.289 + bool visitCallGetIntrinsicValue(LCallGetIntrinsicValue *lir); 1.290 + bool visitIsCallable(LIsCallable *lir); 1.291 + bool visitHaveSameClass(LHaveSameClass *lir); 1.292 + bool visitHasClass(LHasClass *lir); 1.293 + bool visitAsmJSCall(LAsmJSCall *lir); 1.294 + bool visitAsmJSParameter(LAsmJSParameter *lir); 1.295 + bool visitAsmJSReturn(LAsmJSReturn *ret); 1.296 + bool visitAsmJSVoidReturn(LAsmJSVoidReturn *ret); 1.297 + 1.298 + bool visitCheckOverRecursed(LCheckOverRecursed *lir); 1.299 + bool visitCheckOverRecursedFailure(CheckOverRecursedFailure *ool); 1.300 + 1.301 + bool visitCheckOverRecursedPar(LCheckOverRecursedPar *lir); 1.302 + bool visitCheckOverRecursedFailurePar(CheckOverRecursedFailurePar *ool); 1.303 + 1.304 + bool visitInterruptCheckPar(LInterruptCheckPar *lir); 1.305 + bool visitOutOfLineInterruptCheckPar(OutOfLineInterruptCheckPar *ool); 1.306 + 1.307 + bool visitInterruptCheckImplicit(LInterruptCheckImplicit *ins); 1.308 + bool visitOutOfLineInterruptCheckImplicit(OutOfLineInterruptCheckImplicit *ins); 1.309 + 1.310 + bool visitUnboxFloatingPoint(LUnboxFloatingPoint *lir); 1.311 + bool visitOutOfLineUnboxFloatingPoint(OutOfLineUnboxFloatingPoint *ool); 1.312 + bool visitOutOfLineStoreElementHole(OutOfLineStoreElementHole *ool); 1.313 + 1.314 + bool visitOutOfLineNewGCThingPar(OutOfLineNewGCThingPar *ool); 1.315 + bool visitOutOfLineAbortPar(OutOfLineAbortPar *ool); 1.316 + bool visitOutOfLinePropagateAbortPar(OutOfLinePropagateAbortPar *ool); 1.317 + void loadJSScriptForBlock(MBasicBlock *block, Register reg); 1.318 + void loadOutermostJSScript(Register reg); 1.319 + 1.320 + // Inline caches visitors. 1.321 + bool visitOutOfLineCache(OutOfLineUpdateCache *ool); 1.322 + 1.323 + bool visitGetPropertyCacheV(LGetPropertyCacheV *ins); 1.324 + bool visitGetPropertyCacheT(LGetPropertyCacheT *ins); 1.325 + bool visitGetElementCacheV(LGetElementCacheV *ins); 1.326 + bool visitGetElementCacheT(LGetElementCacheT *ins); 1.327 + bool visitSetElementCacheV(LSetElementCacheV *ins); 1.328 + bool visitSetElementCacheT(LSetElementCacheT *ins); 1.329 + bool visitBindNameCache(LBindNameCache *ins); 1.330 + bool visitCallSetProperty(LInstruction *ins); 1.331 + bool visitSetPropertyCacheV(LSetPropertyCacheV *ins); 1.332 + bool visitSetPropertyCacheT(LSetPropertyCacheT *ins); 1.333 + bool visitGetNameCache(LGetNameCache *ins); 1.334 + bool visitCallsiteCloneCache(LCallsiteCloneCache *ins); 1.335 + 1.336 + bool visitGetPropertyIC(OutOfLineUpdateCache *ool, DataPtr<GetPropertyIC> &ic); 1.337 + bool visitGetPropertyParIC(OutOfLineUpdateCache *ool, DataPtr<GetPropertyParIC> &ic); 1.338 + bool visitSetPropertyIC(OutOfLineUpdateCache *ool, DataPtr<SetPropertyIC> &ic); 1.339 + bool visitSetPropertyParIC(OutOfLineUpdateCache *ool, DataPtr<SetPropertyParIC> &ic); 1.340 + bool visitGetElementIC(OutOfLineUpdateCache *ool, DataPtr<GetElementIC> &ic); 1.341 + bool visitGetElementParIC(OutOfLineUpdateCache *ool, DataPtr<GetElementParIC> &ic); 1.342 + bool visitSetElementIC(OutOfLineUpdateCache *ool, DataPtr<SetElementIC> &ic); 1.343 + bool visitSetElementParIC(OutOfLineUpdateCache *ool, DataPtr<SetElementParIC> &ic); 1.344 + bool visitBindNameIC(OutOfLineUpdateCache *ool, DataPtr<BindNameIC> &ic); 1.345 + bool visitNameIC(OutOfLineUpdateCache *ool, DataPtr<NameIC> &ic); 1.346 + bool visitCallsiteCloneIC(OutOfLineUpdateCache *ool, DataPtr<CallsiteCloneIC> &ic); 1.347 + 1.348 + bool visitAssertRangeI(LAssertRangeI *ins); 1.349 + bool visitAssertRangeD(LAssertRangeD *ins); 1.350 + bool visitAssertRangeF(LAssertRangeF *ins); 1.351 + bool visitAssertRangeV(LAssertRangeV *ins); 1.352 + 1.353 + bool visitRecompileCheck(LRecompileCheck *ins); 1.354 + 1.355 + private: 1.356 + bool addGetPropertyCache(LInstruction *ins, RegisterSet liveRegs, Register objReg, 1.357 + PropertyName *name, TypedOrValueRegister output, 1.358 + bool monitoredResult); 1.359 + bool addGetElementCache(LInstruction *ins, Register obj, ConstantOrRegister index, 1.360 + TypedOrValueRegister output, bool monitoredResult, 1.361 + bool allowDoubleResult); 1.362 + bool addSetPropertyCache(LInstruction *ins, RegisterSet liveRegs, Register objReg, 1.363 + PropertyName *name, ConstantOrRegister value, bool strict, 1.364 + bool needsTypeBarrier); 1.365 + bool addSetElementCache(LInstruction *ins, Register obj, Register unboxIndex, Register temp, 1.366 + FloatRegister tempFloat, ValueOperand index, ConstantOrRegister value, 1.367 + bool strict, bool guardHoles); 1.368 + bool checkForAbortPar(LInstruction *lir); 1.369 + 1.370 + bool generateBranchV(const ValueOperand &value, Label *ifTrue, Label *ifFalse, FloatRegister fr); 1.371 + 1.372 + bool emitAllocateGCThingPar(LInstruction *lir, Register objReg, Register cxReg, 1.373 + Register tempReg1, Register tempReg2, 1.374 + JSObject *templateObj); 1.375 + 1.376 + bool emitCallToUncompiledScriptPar(LInstruction *lir, Register calleeReg); 1.377 + 1.378 + void emitLambdaInit(Register resultReg, Register scopeChainReg, 1.379 + const LambdaFunctionInfo &info); 1.380 + 1.381 + bool emitFilterArgumentsOrEval(LInstruction *lir, Register string, Register temp1, 1.382 + Register temp2); 1.383 + 1.384 + IonScriptCounts *maybeCreateScriptCounts(); 1.385 + 1.386 + // This function behaves like testValueTruthy with the exception that it can 1.387 + // choose to let control flow fall through when the object is truthy, as 1.388 + // an optimization. Use testValueTruthy when it's required to branch to one 1.389 + // of the two labels. 1.390 + void testValueTruthyKernel(const ValueOperand &value, 1.391 + const LDefinition *scratch1, const LDefinition *scratch2, 1.392 + FloatRegister fr, 1.393 + Label *ifTruthy, Label *ifFalsy, 1.394 + OutOfLineTestObject *ool); 1.395 + 1.396 + // Test whether value is truthy or not and jump to the corresponding label. 1.397 + // If the value can be an object that emulates |undefined|, |ool| must be 1.398 + // non-null; otherwise it may be null (and the scratch definitions should 1.399 + // be bogus), in which case an object encountered here will always be 1.400 + // truthy. 1.401 + void testValueTruthy(const ValueOperand &value, 1.402 + const LDefinition *scratch1, const LDefinition *scratch2, 1.403 + FloatRegister fr, 1.404 + Label *ifTruthy, Label *ifFalsy, 1.405 + OutOfLineTestObject *ool); 1.406 + 1.407 + // This function behaves like testObjectEmulatesUndefined with the exception 1.408 + // that it can choose to let control flow fall through when the object 1.409 + // doesn't emulate undefined, as an optimization. Use the regular 1.410 + // testObjectEmulatesUndefined when it's required to branch to one of the 1.411 + // two labels. 1.412 + void testObjectEmulatesUndefinedKernel(Register objreg, 1.413 + Label *ifEmulatesUndefined, 1.414 + Label *ifDoesntEmulateUndefined, 1.415 + Register scratch, OutOfLineTestObject *ool); 1.416 + 1.417 + // Test whether an object emulates |undefined|. If it does, jump to 1.418 + // |ifEmulatesUndefined|; the caller is responsible for binding this label. 1.419 + // If it doesn't, fall through; the label |ifDoesntEmulateUndefined| (which 1.420 + // must be initially unbound) will be bound at this point. 1.421 + void branchTestObjectEmulatesUndefined(Register objreg, 1.422 + Label *ifEmulatesUndefined, 1.423 + Label *ifDoesntEmulateUndefined, 1.424 + Register scratch, OutOfLineTestObject *ool); 1.425 + 1.426 + // Test whether an object emulates |undefined|, and jump to the 1.427 + // corresponding label. 1.428 + // 1.429 + // This method should be used when subsequent code can't be laid out in a 1.430 + // straight line; if it can, branchTest* should be used instead. 1.431 + void testObjectEmulatesUndefined(Register objreg, 1.432 + Label *ifEmulatesUndefined, 1.433 + Label *ifDoesntEmulateUndefined, 1.434 + Register scratch, OutOfLineTestObject *ool); 1.435 + 1.436 + // Get a label for the start of block which can be used for jumping, in 1.437 + // place of jumpToBlock. 1.438 + Label *getJumpLabelForBranch(MBasicBlock *block); 1.439 + 1.440 + // Bailout if an element about to be written to is a hole. 1.441 + bool emitStoreHoleCheck(Register elements, const LAllocation *index, LSnapshot *snapshot); 1.442 + 1.443 + bool emitAssertRangeI(const Range *r, Register input); 1.444 + bool emitAssertRangeD(const Range *r, FloatRegister input, FloatRegister temp); 1.445 + 1.446 + Vector<CodeOffsetLabel, 0, IonAllocPolicy> ionScriptLabels_; 1.447 +#ifdef DEBUG 1.448 + bool branchIfInvalidated(Register temp, Label *invalidated); 1.449 + 1.450 + bool emitDebugResultChecks(LInstruction *ins); 1.451 + bool emitObjectOrStringResultChecks(LInstruction *lir, MDefinition *mir); 1.452 + bool emitValueResultChecks(LInstruction *lir, MDefinition *mir); 1.453 +#endif 1.454 + 1.455 +#if defined(JS_ION_PERF) 1.456 + PerfSpewer perfSpewer_; 1.457 +#endif 1.458 +}; 1.459 + 1.460 +} // namespace jit 1.461 +} // namespace js 1.462 + 1.463 +#endif /* jit_CodeGenerator_h */