diff options
Diffstat (limited to 'src/3rdparty/v8/src/x64/lithium-x64.h')
-rw-r--r-- | src/3rdparty/v8/src/x64/lithium-x64.h | 605 |
1 files changed, 360 insertions, 245 deletions
diff --git a/src/3rdparty/v8/src/x64/lithium-x64.h b/src/3rdparty/v8/src/x64/lithium-x64.h index ac1a5db..a437a2b 100644 --- a/src/3rdparty/v8/src/x64/lithium-x64.h +++ b/src/3rdparty/v8/src/x64/lithium-x64.h @@ -96,6 +96,7 @@ class LCodeGen; V(ElementsKind) \ V(FastLiteral) \ V(FixedArrayBaseLength) \ + V(MapEnumLength) \ V(FunctionLiteral) \ V(GetCachedArrayIndex) \ V(GlobalObject) \ @@ -108,6 +109,7 @@ class LCodeGen; V(InstanceOfKnownGlobal) \ V(InstructionGap) \ V(Integer32ToDouble) \ + V(Uint32ToDouble) \ V(InvokeFunction) \ V(IsConstructCallAndBranch) \ V(IsNilAndBranch) \ @@ -115,7 +117,6 @@ class LCodeGen; V(IsStringAndBranch) \ V(IsSmiAndBranch) \ V(IsUndetectableAndBranch) \ - V(StringCompareAndBranch) \ V(JSArrayLength) \ V(Label) \ V(LazyBailout) \ @@ -125,17 +126,18 @@ class LCodeGen; V(LoadFunctionPrototype) \ V(LoadGlobalCell) \ V(LoadGlobalGeneric) \ - V(LoadKeyedFastDoubleElement) \ - V(LoadKeyedFastElement) \ + V(LoadKeyed) \ V(LoadKeyedGeneric) \ - V(LoadKeyedSpecializedArrayElement) \ V(LoadNamedField) \ V(LoadNamedFieldPolymorphic) \ V(LoadNamedGeneric) \ + V(MathFloorOfDiv) \ + V(MathMinMax) \ V(ModI) \ V(MulI) \ V(NumberTagD) \ V(NumberTagI) \ + V(NumberTagU) \ V(NumberUntagD) \ V(ObjectLiteral) \ V(OsrEntry) \ @@ -153,15 +155,14 @@ class LCodeGen; V(StoreContextSlot) \ V(StoreGlobalCell) \ V(StoreGlobalGeneric) \ - V(StoreKeyedFastDoubleElement) \ - V(StoreKeyedFastElement) \ + V(StoreKeyed) \ V(StoreKeyedGeneric) \ - V(StoreKeyedSpecializedArrayElement) \ V(StoreNamedField) \ V(StoreNamedGeneric) \ V(StringAdd) \ V(StringCharCodeAt) \ V(StringCharFromCode) \ + V(StringCompareAndBranch) \ V(StringLength) \ V(SubI) \ V(TaggedToI) \ @@ -257,11 +258,6 @@ class LInstruction: public ZoneObject { virtual bool HasResult() const = 0; virtual LOperand* result() = 0; - virtual int InputCount() = 0; - virtual LOperand* InputAt(int i) = 0; - virtual int TempCount() = 0; - virtual LOperand* TempAt(int i) = 0; - LOperand* FirstInput() { return InputAt(0); } LOperand* Output() { return HasResult() ? result() : NULL; } @@ -270,6 +266,15 @@ class LInstruction: public ZoneObject { #endif private: + // Iterator support. + friend class InputIterator; + virtual int InputCount() = 0; + virtual LOperand* InputAt(int i) = 0; + + friend class TempIterator; + virtual int TempCount() = 0; + virtual LOperand* TempAt(int i) = 0; + LEnvironment* environment_; SetOncePointer<LPointerMap> pointer_map_; HValue* hydrogen_value_; @@ -289,16 +294,18 @@ class LTemplateInstruction: public LInstruction { void set_result(LOperand* operand) { results_[0] = operand; } LOperand* result() { return results_[0]; } - int InputCount() { return I; } - LOperand* InputAt(int i) { return inputs_[i]; } - - int TempCount() { return T; } - LOperand* TempAt(int i) { return temps_[i]; } - protected: EmbeddedContainer<LOperand*, R> results_; EmbeddedContainer<LOperand*, I> inputs_; EmbeddedContainer<LOperand*, T> temps_; + + private: + // Iterator support. + virtual int InputCount() { return I; } + virtual LOperand* InputAt(int i) { return inputs_[i]; } + + virtual int TempCount() { return T; } + virtual LOperand* TempAt(int i) { return temps_[i]; } }; @@ -333,8 +340,11 @@ class LGap: public LTemplateInstruction<0, 0, 0> { LAST_INNER_POSITION = AFTER }; - LParallelMove* GetOrCreateParallelMove(InnerPosition pos) { - if (parallel_moves_[pos] == NULL) parallel_moves_[pos] = new LParallelMove; + LParallelMove* GetOrCreateParallelMove(InnerPosition pos, + Zone* zone) { + if (parallel_moves_[pos] == NULL) { + parallel_moves_[pos] = new(zone) LParallelMove(zone); + } return parallel_moves_[pos]; } @@ -462,10 +472,10 @@ class LWrapReceiver: public LTemplateInstruction<1, 2, 0> { inputs_[1] = function; } - DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver") - LOperand* receiver() { return inputs_[0]; } LOperand* function() { return inputs_[1]; } + + DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver") }; @@ -481,12 +491,12 @@ class LApplyArguments: public LTemplateInstruction<1, 4, 0> { inputs_[3] = elements; } - DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments") - LOperand* function() { return inputs_[0]; } LOperand* receiver() { return inputs_[1]; } LOperand* length() { return inputs_[2]; } LOperand* elements() { return inputs_[3]; } + + DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments") }; @@ -498,12 +508,12 @@ class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> { inputs_[2] = index; } - DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at") - LOperand* arguments() { return inputs_[0]; } LOperand* length() { return inputs_[1]; } LOperand* index() { return inputs_[2]; } + DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at") + virtual void PrintDataTo(StringStream* stream); }; @@ -514,6 +524,8 @@ class LArgumentsLength: public LTemplateInstruction<1, 1, 0> { inputs_[0] = elements; } + LOperand* elements() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length") }; @@ -533,6 +545,10 @@ class LModI: public LTemplateInstruction<1, 2, 1> { temps_[0] = temp; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i") DECLARE_HYDROGEN_ACCESSOR(Mod) }; @@ -546,11 +562,34 @@ class LDivI: public LTemplateInstruction<1, 2, 1> { temps_[0] = temp; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") DECLARE_HYDROGEN_ACCESSOR(Div) }; +class LMathFloorOfDiv: public LTemplateInstruction<1, 2, 1> { + public: + LMathFloorOfDiv(LOperand* left, + LOperand* right, + LOperand* temp = NULL) { + inputs_[0] = left; + inputs_[1] = right; + temps_[0] = temp; + } + + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + LOperand* temp() { return temps_[0]; } + + DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv, "math-floor-of-div") + DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) +}; + + class LMulI: public LTemplateInstruction<1, 2, 0> { public: LMulI(LOperand* left, LOperand* right) { @@ -558,6 +597,9 @@ class LMulI: public LTemplateInstruction<1, 2, 0> { inputs_[1] = right; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i") DECLARE_HYDROGEN_ACCESSOR(Mul) }; @@ -570,6 +612,9 @@ class LCmpIDAndBranch: public LControlInstruction<2, 0> { inputs_[1] = right; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch") DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch) @@ -588,6 +633,8 @@ class LUnaryMathOperation: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation") DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) @@ -603,6 +650,9 @@ class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> { inputs_[1] = right; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, "cmp-object-eq-and-branch") }; @@ -614,6 +664,8 @@ class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> { inputs_[0] = left; } + LOperand* left() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch, "cmp-constant-eq-and-branch") DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch) @@ -627,6 +679,9 @@ class LIsNilAndBranch: public LControlInstruction<1, 1> { temps_[0] = temp; } + LOperand* value() { return inputs_[0]; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch") DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch) @@ -643,6 +698,8 @@ class LIsObjectAndBranch: public LControlInstruction<1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch") DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch) @@ -657,6 +714,9 @@ class LIsStringAndBranch: public LControlInstruction<1, 1> { temps_[0] = temp; } + LOperand* value() { return inputs_[0]; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch") DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch) @@ -670,6 +730,8 @@ class LIsSmiAndBranch: public LControlInstruction<1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch") DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch) @@ -684,6 +746,9 @@ class LIsUndetectableAndBranch: public LControlInstruction<1, 1> { temps_[0] = temp; } + LOperand* value() { return inputs_[0]; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch, "is-undetectable-and-branch") DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch) @@ -699,6 +764,9 @@ class LStringCompareAndBranch: public LControlInstruction<2, 0> { inputs_[1] = right; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch, "string-compare-and-branch") DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch) @@ -715,6 +783,8 @@ class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch, "has-instance-type-and-branch") DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch) @@ -729,6 +799,8 @@ class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index") DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex) }; @@ -740,6 +812,8 @@ class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch, "has-cached-array-index-and-branch") DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch) @@ -756,6 +830,10 @@ class LClassOfTestAndBranch: public LControlInstruction<1, 2> { temps_[1] = temp2; } + LOperand* value() { return inputs_[0]; } + LOperand* temp() { return temps_[0]; } + LOperand* temp2() { return temps_[1]; } + DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch, "class-of-test-and-branch") DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch) @@ -771,6 +849,9 @@ class LCmpT: public LTemplateInstruction<1, 2, 0> { inputs_[1] = right; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") DECLARE_HYDROGEN_ACCESSOR(CompareGeneric) @@ -799,6 +880,9 @@ class LInstanceOf: public LTemplateInstruction<1, 2, 0> { inputs_[1] = right; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of") }; @@ -810,6 +894,9 @@ class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> { temps_[0] = temp; } + LOperand* value() { return inputs_[0]; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, "instance-of-known-global") DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) @@ -838,6 +925,7 @@ class LBoundsCheck: public LTemplateInstruction<0, 2, 0> { LOperand* length() { return inputs_[1]; } DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check") + DECLARE_HYDROGEN_ACCESSOR(BoundsCheck) }; @@ -848,6 +936,9 @@ class LBitI: public LTemplateInstruction<1, 2, 0> { inputs_[1] = right; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + Token::Value op() const { return hydrogen()->op(); } DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i") @@ -864,7 +955,8 @@ class LShiftI: public LTemplateInstruction<1, 2, 0> { } Token::Value op() const { return op_; } - + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } bool can_deopt() const { return can_deopt_; } DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i") @@ -882,6 +974,9 @@ class LSubI: public LTemplateInstruction<1, 2, 0> { inputs_[1] = right; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") DECLARE_HYDROGEN_ACCESSOR(Sub) }; @@ -901,6 +996,9 @@ class LConstantD: public LTemplateInstruction<1, 0, 1> { explicit LConstantD(LOperand* temp) { temps_[0] = temp; } + + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") DECLARE_HYDROGEN_ACCESSOR(Constant) @@ -923,6 +1021,8 @@ class LBranch: public LControlInstruction<1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") DECLARE_HYDROGEN_ACCESSOR(Branch) @@ -936,6 +1036,8 @@ class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") DECLARE_HYDROGEN_ACCESSOR(CompareMap) @@ -957,6 +1059,8 @@ class LJSArrayLength: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length") DECLARE_HYDROGEN_ACCESSOR(JSArrayLength) }; @@ -968,18 +1072,34 @@ class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength, "fixed-array-base-length") DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength) }; +class LMapEnumLength: public LTemplateInstruction<1, 1, 0> { + public: + explicit LMapEnumLength(LOperand* value) { + inputs_[0] = value; + } + + LOperand* value() { return inputs_[0]; } + + DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length") +}; + + class LElementsKind: public LTemplateInstruction<1, 1, 0> { public: explicit LElementsKind(LOperand* value) { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind") DECLARE_HYDROGEN_ACCESSOR(ElementsKind) }; @@ -991,6 +1111,8 @@ class LValueOf: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of") DECLARE_HYDROGEN_ACCESSOR(ValueOf) }; @@ -1002,11 +1124,12 @@ class LDateField: public LTemplateInstruction<1, 1, 0> { inputs_[0] = date; } + LOperand* date() { return inputs_[0]; } + Smi* index() const { return index_; } + DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field") DECLARE_HYDROGEN_ACCESSOR(ValueOf) - Smi* index() const { return index_; } - private: Smi* index_; }; @@ -1018,6 +1141,8 @@ class LThrow: public LTemplateInstruction<0, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") }; @@ -1028,6 +1153,8 @@ class LBitNotI: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i") }; @@ -1039,11 +1166,29 @@ class LAddI: public LTemplateInstruction<1, 2, 0> { inputs_[1] = right; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i") DECLARE_HYDROGEN_ACCESSOR(Add) }; +class LMathMinMax: public LTemplateInstruction<1, 2, 0> { + public: + LMathMinMax(LOperand* left, LOperand* right) { + inputs_[0] = left; + inputs_[1] = right; + } + + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + + DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "min-max") + DECLARE_HYDROGEN_ACCESSOR(MathMinMax) +}; + + class LPower: public LTemplateInstruction<1, 2, 0> { public: LPower(LOperand* left, LOperand* right) { @@ -1051,6 +1196,9 @@ class LPower: public LTemplateInstruction<1, 2, 0> { inputs_[1] = right; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + DECLARE_CONCRETE_INSTRUCTION(Power, "power") DECLARE_HYDROGEN_ACCESSOR(Power) }; @@ -1062,6 +1210,8 @@ class LRandom: public LTemplateInstruction<1, 1, 0> { inputs_[0] = global_object; } + LOperand* global_object() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(Random, "random") DECLARE_HYDROGEN_ACCESSOR(Random) }; @@ -1076,6 +1226,8 @@ class LArithmeticD: public LTemplateInstruction<1, 2, 0> { } Token::Value op() const { return op_; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } virtual Opcode opcode() const { return LInstruction::kArithmeticD; } virtual void CompileToNative(LCodeGen* generator); @@ -1094,12 +1246,14 @@ class LArithmeticT: public LTemplateInstruction<1, 2, 0> { inputs_[1] = right; } + Token::Value op() const { return op_; } + LOperand* left() { return inputs_[0]; } + LOperand* right() { return inputs_[1]; } + virtual Opcode opcode() const { return LInstruction::kArithmeticT; } virtual void CompileToNative(LCodeGen* generator); virtual const char* Mnemonic() const; - Token::Value op() const { return op_; } - private: Token::Value op_; }; @@ -1111,6 +1265,8 @@ class LReturn: public LTemplateInstruction<0, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(Return, "return") }; @@ -1121,6 +1277,8 @@ class LLoadNamedField: public LTemplateInstruction<1, 1, 0> { inputs_[0] = object; } + LOperand* object() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field") DECLARE_HYDROGEN_ACCESSOR(LoadNamedField) }; @@ -1172,6 +1330,8 @@ class LLoadElements: public LTemplateInstruction<1, 1, 0> { inputs_[0] = object; } + LOperand* object() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") }; @@ -1182,64 +1342,43 @@ class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> { inputs_[0] = object; } + LOperand* object() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer, "load-external-array-pointer") }; -class LLoadKeyedFastElement: public LTemplateInstruction<1, 2, 0> { +class LLoadKeyed: public LTemplateInstruction<1, 2, 0> { public: - LLoadKeyedFastElement(LOperand* elements, LOperand* key) { + LLoadKeyed(LOperand* elements, LOperand* key) { inputs_[0] = elements; inputs_[1] = key; } - DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element") - DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement) - - LOperand* elements() { return inputs_[0]; } - LOperand* key() { return inputs_[1]; } - uint32_t additional_index() const { return hydrogen()->index_offset(); } -}; - + DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed") + DECLARE_HYDROGEN_ACCESSOR(LoadKeyed) -class LLoadKeyedFastDoubleElement: public LTemplateInstruction<1, 2, 0> { - public: - LLoadKeyedFastDoubleElement(LOperand* elements, LOperand* key) { - inputs_[0] = elements; - inputs_[1] = key; + bool is_external() const { + return hydrogen()->is_external(); } - - DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement, - "load-keyed-fast-double-element") - DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastDoubleElement) - LOperand* elements() { return inputs_[0]; } LOperand* key() { return inputs_[1]; } uint32_t additional_index() const { return hydrogen()->index_offset(); } -}; - - -class LLoadKeyedSpecializedArrayElement: public LTemplateInstruction<1, 2, 0> { - public: - LLoadKeyedSpecializedArrayElement(LOperand* external_pointer, LOperand* key) { - inputs_[0] = external_pointer; - inputs_[1] = key; - } - - DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement, - "load-keyed-specialized-array-element") - DECLARE_HYDROGEN_ACCESSOR(LoadKeyedSpecializedArrayElement) - - LOperand* external_pointer() { return inputs_[0]; } - LOperand* key() { return inputs_[1]; } ElementsKind elements_kind() const { return hydrogen()->elements_kind(); } - uint32_t additional_index() const { return hydrogen()->index_offset(); } }; +template <class T> +inline static bool ArrayOpClobbersKey(T *value) { + CHECK(value->IsLoadKeyed() || value->IsStoreKeyed()); + return !value->IsConstant() && (value->key()->representation().IsTagged() + || value->IsDehoisted()); +} + + class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> { public: LLoadKeyedGeneric(LOperand* obj, LOperand* key) { @@ -1283,10 +1422,11 @@ class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> { temps_[0] = temp; } + LOperand* value() { return inputs_[0]; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell") DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell) - - LOperand* value() { return inputs_[0]; } }; @@ -1298,12 +1438,13 @@ class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> { inputs_[1] = value; } + LOperand* global_object() { return inputs_[0]; } + LOperand* value() { return inputs_[1]; } + DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic") DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric) - LOperand* global_object() { return InputAt(0); } Handle<Object> name() const { return hydrogen()->name(); } - LOperand* value() { return InputAt(1); } StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } }; @@ -1314,10 +1455,11 @@ class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> { inputs_[0] = context; } + LOperand* context() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) - LOperand* context() { return InputAt(0); } int slot_index() { return hydrogen()->slot_index(); } virtual void PrintDataTo(StringStream* stream); @@ -1332,11 +1474,13 @@ class LStoreContextSlot: public LTemplateInstruction<0, 2, 1> { temps_[0] = temp; } + LOperand* context() { return inputs_[0]; } + LOperand* value() { return inputs_[1]; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot") DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot) - LOperand* context() { return InputAt(0); } - LOperand* value() { return InputAt(1); } int slot_index() { return hydrogen()->slot_index(); } virtual void PrintDataTo(StringStream* stream); @@ -1349,6 +1493,8 @@ class LPushArgument: public LTemplateInstruction<0, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument") }; @@ -1385,9 +1531,9 @@ class LOuterContext: public LTemplateInstruction<1, 1, 0> { inputs_[0] = context; } - DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context") + LOperand* context() { return inputs_[0]; } - LOperand* context() { return InputAt(0); } + DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context") }; @@ -1416,9 +1562,9 @@ class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> { inputs_[0] = global_object; } - DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") + LOperand* global() { return inputs_[0]; } - LOperand* global() { return InputAt(0); } + DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") }; @@ -1440,11 +1586,11 @@ class LInvokeFunction: public LTemplateInstruction<1, 1, 0> { inputs_[0] = function; } + LOperand* function() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) - LOperand* function() { return inputs_[0]; } - virtual void PrintDataTo(StringStream* stream); int arity() const { return hydrogen()->argument_count() - 1; } @@ -1531,6 +1677,8 @@ class LCallNew: public LTemplateInstruction<1, 1, 0> { inputs_[0] = constructor; } + LOperand* constructor() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new") DECLARE_HYDROGEN_ACCESSOR(CallNew) @@ -1556,20 +1704,52 @@ class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double") }; +class LUint32ToDouble: public LTemplateInstruction<1, 1, 1> { + public: + explicit LUint32ToDouble(LOperand* value, LOperand* temp) { + inputs_[0] = value; + temps_[0] = temp; + } + + LOperand* value() { return inputs_[0]; } + LOperand* temp() { return temps_[0]; } + + DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double") +}; + + class LNumberTagI: public LTemplateInstruction<1, 1, 0> { public: explicit LNumberTagI(LOperand* value) { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") }; +class LNumberTagU: public LTemplateInstruction<1, 1, 1> { + public: + explicit LNumberTagU(LOperand* value, LOperand* temp) { + inputs_[0] = value; + temps_[0] = temp; + } + + LOperand* value() { return inputs_[0]; } + LOperand* temp() { return temps_[0]; } + + DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u") +}; + + class LNumberTagD: public LTemplateInstruction<1, 1, 1> { public: explicit LNumberTagD(LOperand* value, LOperand* temp) { @@ -1577,6 +1757,9 @@ class LNumberTagD: public LTemplateInstruction<1, 1, 1> { temps_[0] = temp; } + LOperand* value() { return inputs_[0]; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d") }; @@ -1588,6 +1771,8 @@ class LDoubleToI: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i") DECLARE_HYDROGEN_ACCESSOR(UnaryOperation) @@ -1603,6 +1788,9 @@ class LTaggedToI: public LTemplateInstruction<1, 1, 1> { temps_[0] = temp; } + LOperand* value() { return inputs_[0]; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i") DECLARE_HYDROGEN_ACCESSOR(UnaryOperation) @@ -1616,6 +1804,8 @@ class LSmiTag: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag") }; @@ -1626,6 +1816,8 @@ class LNumberUntagD: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag") DECLARE_HYDROGEN_ACCESSOR(Change); }; @@ -1638,10 +1830,11 @@ class LSmiUntag: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } - DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag") - + LOperand* value() { return inputs_[0]; } bool needs_check() const { return needs_check_; } + DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag") + private: bool needs_check_; }; @@ -1655,14 +1848,15 @@ class LStoreNamedField: public LTemplateInstruction<0, 2, 1> { temps_[0] = temp; } + LOperand* object() { return inputs_[0]; } + LOperand* value() { return inputs_[1]; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field") DECLARE_HYDROGEN_ACCESSOR(StoreNamedField) virtual void PrintDataTo(StringStream* stream); - LOperand* object() { return inputs_[0]; } - LOperand* value() { return inputs_[1]; } - Handle<Object> name() const { return hydrogen()->name(); } bool is_in_object() { return hydrogen()->is_in_object(); } int offset() { return hydrogen()->offset(); } @@ -1677,88 +1871,42 @@ class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> { inputs_[1] = value; } + LOperand* object() { return inputs_[0]; } + LOperand* value() { return inputs_[1]; } + DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) virtual void PrintDataTo(StringStream* stream); - LOperand* object() { return inputs_[0]; } - LOperand* value() { return inputs_[1]; } Handle<Object> name() const { return hydrogen()->name(); } StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } }; -class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> { +class LStoreKeyed: public LTemplateInstruction<0, 3, 0> { public: - LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) { - inputs_[0] = obj; + LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) { + inputs_[0] = object; inputs_[1] = key; - inputs_[2] = val; + inputs_[2] = value; } - DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, - "store-keyed-fast-element") - DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement) - - virtual void PrintDataTo(StringStream* stream); - - LOperand* object() { return inputs_[0]; } + bool is_external() const { return hydrogen()->is_external(); } + LOperand* elements() { return inputs_[0]; } LOperand* key() { return inputs_[1]; } LOperand* value() { return inputs_[2]; } - uint32_t additional_index() const { return hydrogen()->index_offset(); } -}; + ElementsKind elements_kind() const { return hydrogen()->elements_kind(); } - -class LStoreKeyedFastDoubleElement: public LTemplateInstruction<0, 3, 0> { - public: - LStoreKeyedFastDoubleElement(LOperand* elements, - LOperand* key, - LOperand* val) { - inputs_[0] = elements; - inputs_[1] = key; - inputs_[2] = val; - } - - DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement, - "store-keyed-fast-double-element") - DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastDoubleElement) + DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed") + DECLARE_HYDROGEN_ACCESSOR(StoreKeyed) virtual void PrintDataTo(StringStream* stream); - - LOperand* elements() { return inputs_[0]; } - LOperand* key() { return inputs_[1]; } - LOperand* value() { return inputs_[2]; } - bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); } uint32_t additional_index() const { return hydrogen()->index_offset(); } }; -class LStoreKeyedSpecializedArrayElement: public LTemplateInstruction<0, 3, 0> { - public: - LStoreKeyedSpecializedArrayElement(LOperand* external_pointer, - LOperand* key, - LOperand* val) { - inputs_[0] = external_pointer; - inputs_[1] = key; - inputs_[2] = val; - } - - DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement, - "store-keyed-specialized-array-element") - DECLARE_HYDROGEN_ACCESSOR(StoreKeyedSpecializedArrayElement) - - LOperand* external_pointer() { return inputs_[0]; } - LOperand* key() { return inputs_[1]; } - LOperand* value() { return inputs_[2]; } - ElementsKind elements_kind() const { - return hydrogen()->elements_kind(); - } - uint32_t additional_index() const { return hydrogen()->index_offset(); } -}; - - class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> { public: LStoreKeyedGeneric(LOperand* object, LOperand* key, LOperand* value) { @@ -1767,14 +1915,15 @@ class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> { inputs_[2] = value; } + LOperand* object() { return inputs_[0]; } + LOperand* key() { return inputs_[1]; } + LOperand* value() { return inputs_[2]; } + DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric) virtual void PrintDataTo(StringStream* stream); - LOperand* object() { return inputs_[0]; } - LOperand* key() { return inputs_[1]; } - LOperand* value() { return inputs_[2]; } StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } }; @@ -1783,21 +1932,22 @@ class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> { public: LTransitionElementsKind(LOperand* object, LOperand* new_map_temp, - LOperand* temp_reg) { + LOperand* temp) { inputs_[0] = object; temps_[0] = new_map_temp; - temps_[1] = temp_reg; + temps_[1] = temp; } + LOperand* object() { return inputs_[0]; } + LOperand* new_map_temp() { return temps_[0]; } + LOperand* temp() { return temps_[1]; } + DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind, "transition-elements-kind") DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind) virtual void PrintDataTo(StringStream* stream); - LOperand* object() { return inputs_[0]; } - LOperand* new_map_reg() { return temps_[0]; } - LOperand* temp_reg() { return temps_[1]; } Handle<Map> original_map() { return hydrogen()->original_map(); } Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); } }; @@ -1810,11 +1960,11 @@ class LStringAdd: public LTemplateInstruction<1, 2, 0> { inputs_[1] = right; } - DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add") - DECLARE_HYDROGEN_ACCESSOR(StringAdd) - LOperand* left() { return inputs_[0]; } LOperand* right() { return inputs_[1]; } + + DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add") + DECLARE_HYDROGEN_ACCESSOR(StringAdd) }; @@ -1825,11 +1975,11 @@ class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> { inputs_[1] = index; } - DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at") - DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt) - LOperand* string() { return inputs_[0]; } LOperand* index() { return inputs_[1]; } + + DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at") + DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt) }; @@ -1839,10 +1989,10 @@ class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> { inputs_[0] = char_code; } + LOperand* char_code() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code") DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode) - - LOperand* char_code() { return inputs_[0]; } }; @@ -1852,10 +2002,10 @@ class LStringLength: public LTemplateInstruction<1, 1, 0> { inputs_[0] = string; } + LOperand* string() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length") DECLARE_HYDROGEN_ACCESSOR(StringLength) - - LOperand* string() { return inputs_[0]; } }; @@ -1865,7 +2015,7 @@ class LCheckFunction: public LTemplateInstruction<0, 1, 0> { inputs_[0] = value; } - LOperand* value() { return InputAt(0); } + LOperand* value() { return inputs_[0]; } DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function") DECLARE_HYDROGEN_ACCESSOR(CheckFunction) @@ -1878,6 +2028,8 @@ class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type") DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType) }; @@ -1889,17 +2041,21 @@ class LCheckMaps: public LTemplateInstruction<0, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps") DECLARE_HYDROGEN_ACCESSOR(CheckMaps) }; -class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 1> { +class LCheckPrototypeMaps: public LTemplateInstruction<1, 0, 1> { public: explicit LCheckPrototypeMaps(LOperand* temp) { temps_[0] = temp; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps") DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps) @@ -1914,15 +2070,16 @@ class LCheckSmi: public LTemplateInstruction<0, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi") }; -class LClampDToUint8: public LTemplateInstruction<1, 1, 1> { +class LClampDToUint8: public LTemplateInstruction<1, 1, 0> { public: - LClampDToUint8(LOperand* value, LOperand* temp) { - inputs_[0] = value; - temps_[0] = temp; + explicit LClampDToUint8(LOperand* unclamped) { + inputs_[0] = unclamped; } LOperand* unclamped() { return inputs_[0]; } @@ -1933,8 +2090,8 @@ class LClampDToUint8: public LTemplateInstruction<1, 1, 1> { class LClampIToUint8: public LTemplateInstruction<1, 1, 0> { public: - explicit LClampIToUint8(LOperand* value) { - inputs_[0] = value; + explicit LClampIToUint8(LOperand* unclamped) { + inputs_[0] = unclamped; } LOperand* unclamped() { return inputs_[0]; } @@ -1943,17 +2100,16 @@ class LClampIToUint8: public LTemplateInstruction<1, 1, 0> { }; -class LClampTToUint8: public LTemplateInstruction<1, 1, 2> { +class LClampTToUint8: public LTemplateInstruction<1, 1, 1> { public: - LClampTToUint8(LOperand* value, - LOperand* temp, - LOperand* temp2) { - inputs_[0] = value; - temps_[0] = temp; - temps_[1] = temp2; + LClampTToUint8(LOperand* unclamped, + LOperand* temp_xmm) { + inputs_[0] = unclamped; + temps_[0] = temp_xmm; } LOperand* unclamped() { return inputs_[0]; } + LOperand* temp_xmm() { return temps_[0]; } DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8") }; @@ -1965,6 +2121,8 @@ class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") }; @@ -1975,6 +2133,8 @@ class LAllocateObject: public LTemplateInstruction<1, 0, 1> { temps_[0] = temp; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object") DECLARE_HYDROGEN_ACCESSOR(AllocateObject) }; @@ -2023,6 +2183,8 @@ class LToFastProperties: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties") DECLARE_HYDROGEN_ACCESSOR(ToFastProperties) }; @@ -2034,6 +2196,8 @@ class LTypeof: public LTemplateInstruction<1, 1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof") }; @@ -2044,6 +2208,8 @@ class LTypeofIsAndBranch: public LControlInstruction<1, 0> { inputs_[0] = value; } + LOperand* value() { return inputs_[0]; } + DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch") DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch) @@ -2059,6 +2225,8 @@ class LIsConstructCallAndBranch: public LControlInstruction<0, 1> { temps_[0] = temp; } + LOperand* temp() { return temps_[0]; } + DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch, "is-construct-call-and-branch") DECLARE_HYDROGEN_ACCESSOR(IsConstructCallAndBranch) @@ -2072,10 +2240,10 @@ class LDeleteProperty: public LTemplateInstruction<1, 2, 0> { inputs_[1] = key; } - DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") - LOperand* object() { return inputs_[0]; } LOperand* key() { return inputs_[1]; } + + DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") }; @@ -2171,69 +2339,13 @@ class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> { class LChunkBuilder; -class LChunk: public ZoneObject { +class LPlatformChunk: public LChunk { public: - explicit LChunk(CompilationInfo* info, HGraph* graph) - : spill_slot_count_(0), - info_(info), - graph_(graph), - instructions_(32), - pointer_maps_(8), - inlined_closures_(1) { } - - void AddInstruction(LInstruction* instruction, HBasicBlock* block); - LConstantOperand* DefineConstantOperand(HConstant* constant); - Handle<Object> LookupLiteral(LConstantOperand* operand) const; - Representation LookupLiteralRepresentation(LConstantOperand* operand) const; + LPlatformChunk(CompilationInfo* info, HGraph* graph) + : LChunk(info, graph) { } int GetNextSpillIndex(bool is_double); LOperand* GetNextSpillSlot(bool is_double); - - int ParameterAt(int index); - int GetParameterStackSlot(int index) const; - int spill_slot_count() const { return spill_slot_count_; } - CompilationInfo* info() const { return info_; } - HGraph* graph() const { return graph_; } - const ZoneList<LInstruction*>* instructions() const { return &instructions_; } - void AddGapMove(int index, LOperand* from, LOperand* to); - LGap* GetGapAt(int index) const; - bool IsGapAt(int index) const; - int NearestGapPos(int index) const; - void MarkEmptyBlocks(); - const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; } - LLabel* GetLabel(int block_id) const { - HBasicBlock* block = graph_->blocks()->at(block_id); - int first_instruction = block->first_instruction_index(); - return LLabel::cast(instructions_[first_instruction]); - } - int LookupDestination(int block_id) const { - LLabel* cur = GetLabel(block_id); - while (cur->replacement() != NULL) { - cur = cur->replacement(); - } - return cur->block_id(); - } - Label* GetAssemblyLabel(int block_id) const { - LLabel* label = GetLabel(block_id); - ASSERT(!label->HasReplacement()); - return label->label(); - } - - const ZoneList<Handle<JSFunction> >* inlined_closures() const { - return &inlined_closures_; - } - - void AddInlinedClosure(Handle<JSFunction> closure) { - inlined_closures_.Add(closure); - } - - private: - int spill_slot_count_; - CompilationInfo* info_; - HGraph* const graph_; - ZoneList<LInstruction*> instructions_; - ZoneList<LPointerMap*> pointer_maps_; - ZoneList<Handle<JSFunction> > inlined_closures_; }; @@ -2243,7 +2355,7 @@ class LChunkBuilder BASE_EMBEDDED { : chunk_(NULL), info_(info), graph_(graph), - zone_(graph->isolate()->zone()), + zone_(graph->zone()), status_(UNUSED), current_instruction_(NULL), current_block_(NULL), @@ -2252,16 +2364,19 @@ class LChunkBuilder BASE_EMBEDDED { allocator_(allocator), position_(RelocInfo::kNoPosition), instruction_pending_deoptimization_environment_(NULL), - pending_deoptimization_ast_id_(AstNode::kNoNumber) { } + pending_deoptimization_ast_id_(BailoutId::None()) { } // Build the sequence for the graph. - LChunk* Build(); + LPlatformChunk* Build(); // Declare methods that deal with the individual node types. #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) #undef DECLARE_DO + static HValue* SimplifiedDividendForMathFloorOfDiv(HValue* val); + static HValue* SimplifiedDivisorForMathFloorOfDiv(HValue* val); + private: enum Status { UNUSED, @@ -2270,7 +2385,7 @@ class LChunkBuilder BASE_EMBEDDED { ABORTED }; - LChunk* chunk() const { return chunk_; } + LPlatformChunk* chunk() const { return chunk_; } CompilationInfo* info() const { return info_; } HGraph* graph() const { return graph_; } Zone* zone() const { return zone_; } @@ -2280,7 +2395,7 @@ class LChunkBuilder BASE_EMBEDDED { bool is_done() const { return status_ == DONE; } bool is_aborted() const { return status_ == ABORTED; } - void Abort(const char* format, ...); + void Abort(const char* reason); // Methods for getting operands for Use / Define / Temp. LUnallocated* ToUnallocated(Register reg); @@ -2374,7 +2489,7 @@ class LChunkBuilder BASE_EMBEDDED { LInstruction* DoArithmeticT(Token::Value op, HArithmeticBinaryOperation* instr); - LChunk* chunk_; + LPlatformChunk* chunk_; CompilationInfo* info_; HGraph* const graph_; Zone* zone_; @@ -2386,7 +2501,7 @@ class LChunkBuilder BASE_EMBEDDED { LAllocator* allocator_; int position_; LInstruction* instruction_pending_deoptimization_environment_; - int pending_deoptimization_ast_id_; + BailoutId pending_deoptimization_ast_id_; DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); }; |