Chromium Code Reviews| Index: src/hydrogen-instructions.cc |
| diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
| index 36d1e11edab37c49aea9aa725866799eb28b83c6..5e3fec89a33444748cb62aa5dec590b0793edec9 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; |
| + Address map_address_ = store->transition_raw_address(); |
| + if (map_address_ == NULL || store->object() != value()) return; |
| for (int i = 0; i < map_set()->length(); i++) { |
| - if (map.is_identical_to(map_set()->at(i))) { |
| + if (map_address_ == map_raw_addresses_.at(i)) { |
| DeleteAndReplaceWith(NULL); |
| return; |
| } |
| @@ -2050,7 +2050,8 @@ HConstant::HConstant(Handle<Object> handle, Representation r) |
| has_int32_value_(false), |
| has_double_value_(false), |
| is_internalized_string_(false), |
| - boolean_value_(handle->BooleanValue()) { |
| + boolean_value_(handle->BooleanValue()), |
| + raw_address_(NULL) { |
| if (handle_->IsNumber()) { |
| double n = handle_->Number(); |
| has_int32_value_ = IsInteger32(n); |
| @@ -2075,6 +2076,7 @@ HConstant::HConstant(Handle<Object> handle, Representation r) |
| HConstant::HConstant(Handle<Object> handle, |
| + Address raw_address, |
| Representation r, |
| HType type, |
| bool is_internalize_string, |
| @@ -2084,6 +2086,7 @@ HConstant::HConstant(Handle<Object> handle, |
| has_double_value_(false), |
| is_internalized_string_(is_internalize_string), |
| boolean_value_(boolean_value), |
| + raw_address_(raw_address), |
| type_from_value_(type) { |
| ASSERT(!handle.is_null()); |
| ASSERT(!type.IsUninitialized()); |
| @@ -2095,7 +2098,8 @@ HConstant::HConstant(Handle<Object> handle, |
| HConstant::HConstant(int32_t integer_value, |
| Representation r, |
| Handle<Object> optional_handle) |
| - : has_int32_value_(true), |
| + : handle_(optional_handle), |
| + has_int32_value_(true), |
| has_double_value_(true), |
| is_internalized_string_(false), |
| boolean_value_(integer_value != 0), |
| @@ -2108,7 +2112,8 @@ 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), |
| + has_int32_value_(IsInteger32(double_value)), |
| has_double_value_(true), |
| is_internalized_string_(false), |
| boolean_value_(double_value != 0 && !isnan(double_value)), |
| @@ -2133,8 +2138,13 @@ 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_); |
| + ASSERT_NE(NULL, raw_address_); |
| + return new(zone) HConstant(handle_, |
| + raw_address_, |
| + r, |
| + type_from_value_, |
| + is_internalized_string_, |
| + boolean_value_); |
| } |
| @@ -2459,6 +2469,8 @@ HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context, |
| Zone* zone) |
| : types_(Min(types->length(), kMaxLoadPolymorphism), zone), |
| name_(name), |
| + types_raw_address_(0, zone), |
| + name_raw_address_(NULL), |
| need_generic_(false) { |
| SetOperandAt(0, context); |
| SetOperandAt(1, object); |
| @@ -2525,15 +2537,49 @@ HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context, |
| } |
| +void HCheckMaps::FinalizeUniqueId() { |
| + // Raw addresses may have already been collected. |
|
Sven Panne
2013/04/16 06:43:44
I don't understand this comment here and elsewhere
|
| + if (map_raw_addresses_.is_empty()) { |
| + Zone* zone = block()->zone(); |
| + map_raw_addresses_.Initialize(map_set_.length(), zone); |
| + for (int i = 0; i < map_set_.length(); i++) { |
| + map_raw_addresses_.Add( |
| + reinterpret_cast<Address>(*map_set_.at(i)), zone); |
| + } |
| + } |
| + ASSERT_EQ(map_set_.length(), map_raw_addresses_.length()); |
| +} |
| + |
| + |
| +void HLoadNamedFieldPolymorphic::FinalizeUniqueId() { |
| + // Raw addresses may have already been collected. |
| + if (types_raw_address_.is_empty()) { |
| + Zone* zone = block()->zone(); |
| + types_raw_address_.Initialize(types_.length(), zone); |
| + for (int i = 0; i < types_.length(); i++) { |
| + types_raw_address_.Add(reinterpret_cast<Address>(*types_.at(i)), zone); |
| + } |
| + } |
| + ASSERT_EQ(types_.length(), types_raw_address_.length()); |
| + ASSERT(name_raw_address_ == NULL || |
| + name_raw_address_ == reinterpret_cast<Address>(*name_)); |
| + name_raw_address_ = reinterpret_cast<Address>(*name_); |
| +} |
| + |
| + |
| bool HLoadNamedFieldPolymorphic::DataEquals(HValue* value) { |
| + ASSERT_EQ(types_.length(), types_raw_address_.length()); |
| + ASSERT_NE(NULL, name_raw_address_); |
| HLoadNamedFieldPolymorphic* other = HLoadNamedFieldPolymorphic::cast(value); |
| - if (types_.length() != other->types()->length()) return false; |
| - if (!name_.is_identical_to(other->name())) return false; |
| + if (types_raw_address_.length() != other->types_raw_address_.length()) { |
| + return false; |
| + } |
| + if (name_raw_address_ != name_raw_address_) return false; |
| if (need_generic_ != other->need_generic_) return false; |
| - for (int i = 0; i < types_.length(); i++) { |
| + for (int i = 0; i < types_raw_address_.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_raw_address_.length(); j++) { |
| + if (types_raw_address_.at(j) == other->types_raw_address_.at(i)) { |
| found = true; |
| break; |
| } |