Chromium Code Reviews| Index: src/hydrogen-instructions.h |
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
| index a623775f2f8aa68dddb9fbd3c93703321bfde43f..0278b73cf0a9906b5709d794028e0d22c20c0014 100644 |
| --- a/src/hydrogen-instructions.h |
| +++ b/src/hydrogen-instructions.h |
| @@ -155,6 +155,7 @@ class LChunkBuilder; |
| V(StoreKeyedGeneric) \ |
| V(StoreNamedField) \ |
| V(StoreNamedGeneric) \ |
| + V(StringAdd) \ |
| V(StringCharCodeAt) \ |
| V(StringCharFromCode) \ |
| V(StringLength) \ |
| @@ -1707,6 +1708,16 @@ class HCheckInstanceType: public HUnaryOperation { |
| virtual void Verify(); |
| #endif |
| + virtual HValue* Canonicalize() { |
| + if (!value()->type().IsUninitialized() && |
| + value()->type().IsString() && |
| + first() == FIRST_STRING_TYPE && |
| + last() == LAST_STRING_TYPE) { |
| + return NULL; |
| + } |
| + return this; |
| + } |
|
fschneider
2011/04/14 10:26:47
Good idea! We should look where else we can make u
|
| + |
| static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value); |
| InstanceType first() const { return first_; } |
| @@ -1748,6 +1759,18 @@ class HCheckNonSmi: public HUnaryOperation { |
| virtual void Verify(); |
| #endif |
| + virtual HValue* Canonicalize() { |
| + HType value_type = value()->type(); |
| + if (!value_type.IsUninitialized() && |
| + (value_type.IsHeapNumber() || |
| + value_type.IsString() || |
| + value_type.IsBoolean() || |
| + value_type.IsNonPrimitive())) { |
| + return NULL; |
| + } |
| + return this; |
| + } |
| + |
| DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") |
| protected: |
| @@ -3408,6 +3431,29 @@ class HStoreKeyedGeneric: public HTemplateInstruction<4> { |
| }; |
| +class HStringAdd: public HBinaryOperation { |
| + public: |
| + HStringAdd(HValue* left, HValue* right) : HBinaryOperation(left, right) { |
| + set_representation(Representation::Tagged()); |
| + SetFlag(kUseGVN); |
| + SetFlag(kDependsOnMaps); |
| + } |
| + |
| + virtual Representation RequiredInputRepresentation(int index) const { |
| + return Representation::Tagged(); |
| + } |
| + |
| + virtual HType CalculateInferredType() { |
| + return HType::String(); |
| + } |
| + |
| + DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string_add") |
| + |
| + protected: |
| + virtual bool DataEquals(HValue* other) { return true; } |
| +}; |
| + |
| + |
| class HStringCharCodeAt: public HBinaryOperation { |
| public: |
| HStringCharCodeAt(HValue* string, HValue* index) |