Chromium Code Reviews| Index: src/hydrogen-instructions.h |
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
| index 21994839d1dd14f01b5cce6a7afa7662ea8ee8d4..b780532517c6f4d2323af3f8c6cb458d9b2ac5e8 100644 |
| --- a/src/hydrogen-instructions.h |
| +++ b/src/hydrogen-instructions.h |
| @@ -94,11 +94,13 @@ class LChunkBuilder; |
| V(CompareJSObjectEq) \ |
| V(CompareMap) \ |
| V(CompareSymbolEq) \ |
| + V(CompareWithConstant) \ |
| V(Constant) \ |
| V(Context) \ |
| V(DeleteProperty) \ |
| V(Deoptimize) \ |
| V(Div) \ |
| + V(ElementsKind) \ |
| V(EnterInlined) \ |
| V(ExternalArrayLength) \ |
| V(FixedArrayLength) \ |
| @@ -402,7 +404,7 @@ class HType { |
| kBoolean = 0x85, // 0000 0000 1000 0101 |
| kNonPrimitive = 0x101, // 0000 0001 0000 0001 |
| kJSObject = 0x301, // 0000 0011 0000 0001 |
| - kJSArray = 0x701, // 0000 0111 1000 0001 |
| + kJSArray = 0x701, // 0000 0111 0000 0001 |
| kUninitialized = 0x1fff // 0001 1111 1111 1111 |
| }; |
| @@ -484,6 +486,10 @@ class HValue: public ZoneObject { |
| GVN_FLAG_LIST(DECLARE_DO) |
| #undef DECLARE_DO |
| kFlexibleRepresentation, |
| + // Participate in Global Value Numbering, i.e. elimination of |
| + // unnecessary recomputations. If an instruction sets this flag, it must |
| + // implement DataEquals(), which will be used to determine if other |
| + // occurrences of the instruction are indeed the same. |
| kUseGVN, |
| kCanOverflow, |
| kBailoutOnMinusZero, |
| @@ -1707,6 +1713,25 @@ class HExternalArrayLength: public HUnaryOperation { |
| }; |
| +class HElementsKind: public HUnaryOperation { |
| + public: |
| + explicit HElementsKind(HValue* value) : HUnaryOperation(value) { |
| + set_representation(Representation::Integer32()); |
| + SetFlag(kUseGVN); |
| + SetFlag(kDependsOnMaps); |
| + } |
| + |
| + virtual Representation RequiredInputRepresentation(int index) const { |
| + return Representation::Tagged(); |
| + } |
| + |
| + DECLARE_CONCRETE_INSTRUCTION(ElementsKind) |
| + |
| + protected: |
| + virtual bool DataEquals(HValue* other) { return true; } |
| +}; |
| + |
| + |
| class HBitNot: public HUnaryOperation { |
| public: |
| explicit HBitNot(HValue* value) : HUnaryOperation(value) { |
| @@ -2589,6 +2614,43 @@ class HCompareSymbolEq: public HBinaryOperation { |
| }; |
| +class HCompareWithConstant: public HUnaryOperation { |
|
fschneider
2011/06/17 08:59:34
Maybe name this HCompareConstantEq to indicate tha
Jakob Kummerow
2011/06/17 17:43:14
Done.
|
| + public: |
| + HCompareWithConstant(HValue* left, int right, Token::Value op) |
| + : HUnaryOperation(left), op_(op), right_(right) { |
| + ASSERT(op == Token::EQ || op == Token::EQ_STRICT); |
|
fschneider
2011/06/17 08:59:34
I think you should for consistency with the other
Jakob Kummerow
2011/06/17 17:43:14
Done.
|
| + set_representation(Representation::Tagged()); |
| + SetFlag(kUseGVN); |
| + } |
| + |
| + Token::Value op() const { return op_; } |
| + int right() const { return right_; } |
| + |
| + virtual bool EmitAtUses() { |
| + return !HasSideEffects() && !HasMultipleUses(); |
| + } |
| + |
| + virtual Representation RequiredInputRepresentation(int index) const { |
| + return Representation::Integer32(); |
| + } |
| + |
| + virtual HType CalculateInferredType() { return HType::Boolean(); } |
| + |
| + DECLARE_CONCRETE_INSTRUCTION(CompareWithConstant); |
| + |
| + protected: |
| + virtual bool DataEquals(HValue* other) { |
| + HCompareWithConstant* other_instr = HCompareWithConstant::cast(other); |
| + return (op_ == other_instr->op_ && |
| + right_ == other_instr->right_); |
| + } |
| + |
| + private: |
| + const Token::Value op_; |
| + const int right_; |
| +}; |
| + |
| + |
| class HUnaryPredicate: public HUnaryOperation { |
| public: |
| explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { |
| @@ -2694,6 +2756,10 @@ class HHasInstanceType: public HUnaryPredicate { |
| InstanceType from() { return from_; } |
| InstanceType to() { return to_; } |
| + virtual bool EmitAtUses() { |
| + return !HasSideEffects() && !HasMultipleUses(); |
| + } |
| + |
| virtual void PrintDataTo(StringStream* stream); |
| DECLARE_CONCRETE_INSTRUCTION(HasInstanceType) |