Chromium Code Reviews| Index: src/hydrogen-instructions.h |
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
| index 786ff87afe261757b76911df89989b9473baddb9..7d9e9aa87d5890a6f4d4caa8293f0b59a8c5f997 100644 |
| --- a/src/hydrogen-instructions.h |
| +++ b/src/hydrogen-instructions.h |
| @@ -211,7 +211,7 @@ class LChunkBuilder; |
| V(GlobalVars) \ |
| V(InobjectFields) \ |
| V(OsrEntries) \ |
| - V(SpecializedArrayElements) |
| + V(ExternalMemory) |
| #define DECLARE_ABSTRACT_INSTRUCTION(type) \ |
| @@ -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); } |
| @@ -447,6 +448,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 |
| @@ -3471,6 +3473,8 @@ class HConstant: public HTemplateInstruction<0> { |
| bool is_not_in_new_space, |
| bool is_cell, |
| bool boolean_value); |
| + HConstant(ExternalReference reference, |
| + Representation r = Representation::External()); |
|
danno
2013/07/25 18:35:57
r should never be settable for ExternalReferences,
Benedikt Meurer
2013/07/25 21:09:11
Done.
|
| Handle<Object> handle() { |
| if (handle_.is_null()) { |
| @@ -3535,6 +3539,7 @@ class HConstant: public HTemplateInstruction<0> { |
| if (HasSmiValue() && kSmiValueSize == 31) return Representation::Smi(); |
| if (HasInteger32Value()) return Representation::Integer32(); |
| if (HasNumberValue()) return Representation::Double(); |
| + if (HasExternalValue()) return Representation::External(); |
| return Representation::Tagged(); |
| } |
| @@ -3586,6 +3591,8 @@ class HConstant: public HTemplateInstruction<0> { |
| bool HasInternalizedStringValue() const { |
| return HasStringValue() && is_internalized_string_; |
| } |
| + bool HasExternalValue() const { return has_external_value_; } |
|
danno
2013/07/25 18:35:57
Call this HasExternalReferenceValue, it's more con
Benedikt Meurer
2013/07/25 21:09:11
Done.
|
| + ExternalReference ExternalValue() const { return external_value_; } |
|
danno
2013/07/25 18:35:57
Call this ExternalReferenceValue, it's more consis
danno
2013/07/25 18:35:57
Call this ExternalReferenceValue, it's more consis
Benedikt Meurer
2013/07/25 21:09:11
Done.
Benedikt Meurer
2013/07/25 21:09:11
Done.
|
| bool BooleanValue() const { return boolean_value_; } |
| @@ -3594,6 +3601,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(); |
| @@ -3601,14 +3610,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 |
| @@ -3629,6 +3638,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() && |
| @@ -3656,12 +3668,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; |
|
danno
2013/07/25 18:35:57
has_external_reference_value_
Benedikt Meurer
2013/07/25 21:09:11
Done.
|
| 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_; |
|
danno
2013/07/25 18:35:57
external_reference_value_
Benedikt Meurer
2013/07/25 21:09:11
Done.
|
| HType type_from_value_; |
| }; |
| @@ -5627,6 +5641,10 @@ class HObjectAccess { |
| return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); |
| } |
| + static HObjectAccess ForCounter() { |
| + return HObjectAccess(kExternalMemory, 0, Representation::Integer32()); |
| + } |
| + |
| // Create an access to an offset in a fixed array header. |
| static HObjectAccess ForFixedArrayHeader(int offset); |
| @@ -5665,7 +5683,8 @@ class HObjectAccess { |
| kElementsPointer, // elements pointer |
| kBackingStore, // some field in the backing store |
| kDouble, // some double field |
| - kInobject // some other in-object field |
| + kInobject, // some other in-object field |
| + kExternalMemory // some field in external memory |
| }; |
| HObjectAccess(Portion portion, int offset, |
| @@ -5942,7 +5961,7 @@ class HLoadKeyed |
| set_representation(Representation::Integer32()); |
| } |
| - SetGVNFlag(kDependsOnSpecializedArrayElements); |
| + SetGVNFlag(kDependsOnExternalMemory); |
| // Native code could change the specialized array. |
| SetGVNFlag(kDependsOnCalls); |
| } |
| @@ -6219,7 +6238,7 @@ class HStoreKeyed |
| SetGVNFlag(kDependsOnNewSpacePromotion); |
| } |
| if (is_external()) { |
| - SetGVNFlag(kChangesSpecializedArrayElements); |
| + SetGVNFlag(kChangesExternalMemory); |
| SetFlag(kAllowUndefinedAsNaN); |
| } else if (IsFastDoubleElementsKind(elements_kind)) { |
| SetGVNFlag(kChangesDoubleArrayElements); |