Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 5a15839579b84ccc383e97c43950335e0bad42cc..73c46a4403b8a72ddad67077012c8624d33d9608 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -1757,19 +1757,17 @@ class HCheckFunction: public HUnaryOperation { |
class HCheckInstanceType: public HUnaryOperation { |
public: |
- // Check that the instance type is in the range [first, last] where |
- // both first and last are included. |
- HCheckInstanceType(HValue* value, InstanceType first, InstanceType last) |
- : HUnaryOperation(value), first_(first), last_(last) { |
- ASSERT(first <= last); |
- set_representation(Representation::Tagged()); |
- SetFlag(kUseGVN); |
- if ((FIRST_STRING_TYPE < first && last <= LAST_STRING_TYPE) || |
- (FIRST_STRING_TYPE <= first && last < LAST_STRING_TYPE)) { |
- // A particular string instance type can change because of GC or |
- // externalization, but the value still remains a string. |
- SetFlag(kDependsOnMaps); |
- } |
+ static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value) { |
+ return new HCheckInstanceType(value, IS_JS_OBJECT_OR_JS_FUNCTION); |
+ } |
+ static HCheckInstanceType* NewIsJSArray(HValue* value) { |
+ return new HCheckInstanceType(value, IS_JS_ARRAY); |
+ } |
+ static HCheckInstanceType* NewIsString(HValue* value) { |
+ return new HCheckInstanceType(value, IS_STRING); |
+ } |
+ static HCheckInstanceType* NewIsSymbol(HValue* value) { |
+ return new HCheckInstanceType(value, IS_SYMBOL); |
} |
virtual bool IsCheckInstruction() const { return true; } |
@@ -1785,17 +1783,15 @@ class HCheckInstanceType: public HUnaryOperation { |
virtual HValue* Canonicalize() { |
if (!value()->type().IsUninitialized() && |
value()->type().IsString() && |
- first() == FIRST_STRING_TYPE && |
- last() == LAST_STRING_TYPE) { |
+ check_ == IS_STRING) { |
return NULL; |
} |
return this; |
} |
- static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value); |
- |
- InstanceType first() const { return first_; } |
- InstanceType last() const { return last_; } |
+ bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } |
+ void GetCheckInterval(InstanceType* first, InstanceType* last); |
+ void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); |
DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) |
@@ -1805,12 +1801,25 @@ class HCheckInstanceType: public HUnaryOperation { |
// with a larger range. |
virtual bool DataEquals(HValue* other) { |
HCheckInstanceType* b = HCheckInstanceType::cast(other); |
- return (first_ == b->first()) && (last_ == b->last()); |
+ return check_ == b->check_; |
} |
private: |
- InstanceType first_; |
- InstanceType last_; |
+ enum Check { |
+ IS_JS_OBJECT_OR_JS_FUNCTION, |
+ IS_JS_ARRAY, |
+ IS_STRING, |
+ IS_SYMBOL, |
+ LAST_INTERVAL_CHECK = IS_JS_ARRAY |
+ }; |
+ |
+ HCheckInstanceType(HValue* value, Check check) |
+ : HUnaryOperation(value), check_(check) { |
+ set_representation(Representation::Tagged()); |
+ SetFlag(kUseGVN); |
+ } |
+ |
+ const Check check_; |
}; |