Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index 36d1e11edab37c49aea9aa725866799eb28b83c6..60a6912654fe50b3533a470a1df8a540d145b37d 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -1584,10 +1584,10 @@ void HCheckMaps::SetSideEffectDominator(GVNFlag side_effect, |
// for which the map is known. |
if (HasNoUses() && dominator->IsStoreNamedField()) { |
HStoreNamedField* store = HStoreNamedField::cast(dominator); |
- Handle<Map> map = store->transition(); |
- if (map.is_null() || store->object() != value()) return; |
+ UniqueValueId map_unique_id = store->transition_unique_id(); |
+ if (!map_unique_id.IsInitialized() || store->object() != value()) return; |
for (int i = 0; i < map_set()->length(); i++) { |
- if (map.is_identical_to(map_set()->at(i))) { |
+ if (map_unique_id == map_unique_ids_.at(i)) { |
DeleteAndReplaceWith(NULL); |
return; |
} |
@@ -2047,6 +2047,7 @@ static bool IsInteger32(double value) { |
HConstant::HConstant(Handle<Object> handle, Representation r) |
: handle_(handle), |
+ unique_id_(), |
has_int32_value_(false), |
has_double_value_(false), |
is_internalized_string_(false), |
@@ -2075,11 +2076,13 @@ HConstant::HConstant(Handle<Object> handle, Representation r) |
HConstant::HConstant(Handle<Object> handle, |
+ UniqueValueId unique_id, |
Representation r, |
HType type, |
bool is_internalize_string, |
bool boolean_value) |
: handle_(handle), |
+ unique_id_(unique_id), |
has_int32_value_(false), |
has_double_value_(false), |
is_internalized_string_(is_internalize_string), |
@@ -2095,7 +2098,9 @@ HConstant::HConstant(Handle<Object> handle, |
HConstant::HConstant(int32_t integer_value, |
Representation r, |
Handle<Object> optional_handle) |
- : has_int32_value_(true), |
+ : handle_(optional_handle), |
+ unique_id_(), |
+ has_int32_value_(true), |
has_double_value_(true), |
is_internalized_string_(false), |
boolean_value_(integer_value != 0), |
@@ -2108,7 +2113,9 @@ HConstant::HConstant(int32_t integer_value, |
HConstant::HConstant(double double_value, |
Representation r, |
Handle<Object> optional_handle) |
- : has_int32_value_(IsInteger32(double_value)), |
+ : handle_(optional_handle), |
+ unique_id_(), |
+ has_int32_value_(IsInteger32(double_value)), |
has_double_value_(true), |
is_internalized_string_(false), |
boolean_value_(double_value != 0 && !isnan(double_value)), |
@@ -2133,8 +2140,12 @@ HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const { |
if (has_int32_value_) return new(zone) HConstant(int32_value_, r, handle_); |
if (has_double_value_) return new(zone) HConstant(double_value_, r, handle_); |
ASSERT(!handle_.is_null()); |
- return new(zone) HConstant( |
- handle_, r, type_from_value_, is_internalized_string_, boolean_value_); |
+ return new(zone) HConstant(handle_, |
+ unique_id_, |
+ r, |
+ type_from_value_, |
+ is_internalized_string_, |
+ boolean_value_); |
} |
@@ -2459,6 +2470,8 @@ HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context, |
Zone* zone) |
: types_(Min(types->length(), kMaxLoadPolymorphism), zone), |
name_(name), |
+ types_unique_ids_(0, zone), |
+ name_unique_id_(), |
need_generic_(false) { |
SetOperandAt(0, context); |
SetOperandAt(1, object); |
@@ -2525,15 +2538,39 @@ HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context, |
} |
+void HCheckMaps::FinalizeUniqueValueId() { |
+ if (!map_unique_ids_.is_empty()) return; |
+ Zone* zone = block()->zone(); |
+ map_unique_ids_.Initialize(map_set_.length(), zone); |
+ for (int i = 0; i < map_set_.length(); i++) { |
+ map_unique_ids_.Add(UniqueValueId(map_set_.at(i)), zone); |
+ } |
+} |
+ |
+ |
+void HLoadNamedFieldPolymorphic::FinalizeUniqueValueId() { |
+ if (!types_unique_ids_.is_empty()) return; |
+ Zone* zone = block()->zone(); |
+ types_unique_ids_.Initialize(types_.length(), zone); |
+ for (int i = 0; i < types_.length(); i++) { |
+ types_unique_ids_.Add(UniqueValueId(types_.at(i)), zone); |
+ } |
+ name_unique_id_ = UniqueValueId(name_); |
+} |
+ |
+ |
bool HLoadNamedFieldPolymorphic::DataEquals(HValue* value) { |
+ ASSERT_EQ(types_.length(), types_unique_ids_.length()); |
HLoadNamedFieldPolymorphic* other = HLoadNamedFieldPolymorphic::cast(value); |
- if (types_.length() != other->types()->length()) return false; |
- if (!name_.is_identical_to(other->name())) return false; |
+ if (name_unique_id_ != other->name_unique_id_) return false; |
+ if (types_unique_ids_.length() != other->types_unique_ids_.length()) { |
+ return false; |
+ } |
if (need_generic_ != other->need_generic_) return false; |
- for (int i = 0; i < types_.length(); i++) { |
+ for (int i = 0; i < types_unique_ids_.length(); i++) { |
bool found = false; |
- for (int j = 0; j < types_.length(); j++) { |
- if (types_.at(j).is_identical_to(other->types()->at(i))) { |
+ for (int j = 0; j < types_unique_ids_.length(); j++) { |
+ if (types_unique_ids_.at(j) == other->types_unique_ids_.at(i)) { |
found = true; |
break; |
} |