Chromium Code Reviews| Index: src/hydrogen-instructions.h |
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
| index 763b6369e3583a0a1c9b1a41bd3af7e93e8fe34e..9f28df675582695866b490ff51b3b6c637275f8f 100644 |
| --- a/src/hydrogen-instructions.h |
| +++ b/src/hydrogen-instructions.h |
| @@ -352,6 +352,7 @@ class HType { |
| public: |
| HType() : type_(kUninitialized) { } |
| + static HType None() { return HType(kNone); } |
| static HType Tagged() { return HType(kTagged); } |
| static HType TaggedPrimitive() { return HType(kTaggedPrimitive); } |
| static HType TaggedNumber() { return HType(kTaggedNumber); } |
| @@ -442,6 +443,7 @@ class HType { |
| private: |
| enum Type { |
| + kNone = 0x0, // 0000 0000 0000 0000 |
| kTagged = 0x1, // 0000 0000 0000 0001 |
| kTaggedPrimitive = 0x5, // 0000 0000 0000 0101 |
| kTaggedNumber = 0xd, // 0000 0000 0000 1101 |
| @@ -3283,6 +3285,8 @@ class HConstant: public HTemplateInstruction<0> { |
| bool is_not_in_new_space, |
| bool is_cell, |
| bool boolean_value); |
| + HConstant(ExternalReference reference, |
| + Representation r = Representation::None()); |
|
danno
2013/07/22 14:19:55
Why None? It seems to make much more sense to use
Benedikt Meurer
2013/07/23 07:00:48
Copy'n'paste....
|
| Handle<Object> handle() { |
| if (handle_.is_null()) { |
| @@ -3342,6 +3346,7 @@ class HConstant: public HTemplateInstruction<0> { |
| if (HasSmiValue()) return Representation::Smi(); |
| if (HasInteger32Value()) return Representation::Integer32(); |
| if (HasNumberValue()) return Representation::Double(); |
| + if (HasExternalValue()) return Representation::External(); |
| return Representation::Tagged(); |
| } |
| @@ -3392,6 +3397,8 @@ class HConstant: public HTemplateInstruction<0> { |
| bool HasInternalizedStringValue() const { |
| return HasStringValue() && is_internalized_string_; |
| } |
| + bool HasExternalValue() const { return has_external_value_; } |
| + ExternalReference ExternalValue() const { return external_value_; } |
| bool BooleanValue() const { return boolean_value_; } |
| @@ -3400,6 +3407,8 @@ class HConstant: public HTemplateInstruction<0> { |
| return static_cast<intptr_t>(int32_value_); |
| } else if (has_double_value_) { |
| return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); |
| + } else if (has_external_value_) { |
| + return reinterpret_cast<intptr_t>(external_value_.address()); |
| } else { |
| ASSERT(!handle_.is_null()); |
| return unique_id_.Hashcode(); |
| @@ -3407,14 +3416,14 @@ class HConstant: public HTemplateInstruction<0> { |
| } |
| virtual void FinalizeUniqueValueId() { |
| - if (!has_double_value_) { |
| + if (!has_double_value_ && !has_external_value_) { |
| ASSERT(!handle_.is_null()); |
| unique_id_ = UniqueValueId(handle_); |
| } |
| } |
| bool UniqueValueIdsMatch(UniqueValueId other) { |
| - return !has_double_value_ && unique_id_ == other; |
| + return !has_double_value_ && !has_external_value_ && unique_id_ == other; |
| } |
| #ifdef DEBUG |
| @@ -3435,6 +3444,9 @@ class HConstant: public HTemplateInstruction<0> { |
| return other_constant->has_double_value_ && |
| BitCast<int64_t>(double_value_) == |
| BitCast<int64_t>(other_constant->double_value_); |
| + } else if (has_external_value_) { |
| + return other_constant->has_external_value_ && |
| + external_value_ == other_constant->external_value_; |
| } else { |
| ASSERT(!handle_.is_null()); |
| return !other_constant->handle_.is_null() && |
| @@ -3462,12 +3474,14 @@ class HConstant: public HTemplateInstruction<0> { |
| bool has_smi_value_ : 1; |
| bool has_int32_value_ : 1; |
| bool has_double_value_ : 1; |
| + bool has_external_value_ : 1; |
| bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. |
| bool is_not_in_new_space_ : 1; |
| bool is_cell_ : 1; |
| bool boolean_value_ : 1; |
| int32_t int32_value_; |
| double double_value_; |
| + ExternalReference external_value_; |
| HType type_from_value_; |
| }; |