int descriptors = old_map->NumberOfOwnDescriptors();
Map* root_map = old_map->FindRootMap();
+ // Check the state of the root map.
if (!old_map->EquivalentToForTransition(root_map)) {
return CopyGeneralizeAllRepresentations();
}
verbatim, descriptors, old_descriptors);
if (updated == NULL) return CopyGeneralizeAllRepresentations();
- // Check the state of the root map.
DescriptorArray* updated_descriptors = updated->instance_descriptors();
int valid = updated->NumberOfOwnDescriptors();
}
+Map* Map::CurrentMapForDeprecated() {
+ AssertNoAllocation no_allocation;
+ if (!is_deprecated()) return this;
+
+ DescriptorArray* old_descriptors = instance_descriptors();
+
+ int descriptors = NumberOfOwnDescriptors();
+ Map* root_map = FindRootMap();
+
+ // Check the state of the root map.
+ if (!EquivalentToForTransition(root_map)) return NULL;
+ int verbatim = root_map->NumberOfOwnDescriptors();
+
+ Map* updated = root_map->FindUpdatedMap(
+ verbatim, descriptors, old_descriptors);
+ if (updated == NULL) return NULL;
+
+ DescriptorArray* updated_descriptors = updated->instance_descriptors();
+ int valid = updated->NumberOfOwnDescriptors();
+ if (!updated_descriptors->IsMoreGeneralThan(
+ verbatim, valid, descriptors, old_descriptors)) {
+ return NULL;
+ }
+
+ return updated;
+}
+
+
MaybeObject* JSObject::SetPropertyWithInterceptor(
Name* name,
Object* value,
Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL;
if (!preliminary_checks) return false;
Map* map = code->FindFirstMap();
+ if (map == NULL) return false;
+ map = map->CurrentMapForDeprecated();
return map != NULL && !CanRetainOtherContext(map, *native_context_);
}
return false;
Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL;
if (!preliminary_checks) return false;
Map* map = code->FindFirstMap();
+ if (map == NULL) return false;
+ map = map->CurrentMapForDeprecated();
return map != NULL && !CanRetainOtherContext(map, *native_context_);
}
return false;
Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId());
if (map_or_code->IsCode()) {
Handle<Code> code = Handle<Code>::cast(map_or_code);
- Handle<Map> first_map(code->FindFirstMap());
- ASSERT(!first_map.is_null());
- first_map = Map::CurrentMapForDeprecated(first_map);
- return CanRetainOtherContext(*first_map, *native_context_)
+ Map* map = code->FindFirstMap()->CurrentMapForDeprecated();
+ return map == NULL || CanRetainOtherContext(map, *native_context_)
? Handle<Map>::null()
- : first_map;
+ : Handle<Map>(map);
}
- return Map::CurrentMapForDeprecated(Handle<Map>::cast(map_or_code));
+ return Handle<Map>::cast(map_or_code);
}
Handle<Object> map_or_code = GetInfo(ast_id);
if (map_or_code->IsCode()) {
Handle<Code> code = Handle<Code>::cast(map_or_code);
- Handle<Map> first_map(code->FindFirstMap());
- ASSERT(!first_map.is_null());
- first_map = Map::CurrentMapForDeprecated(first_map);
- return CanRetainOtherContext(*first_map, *native_context_)
+ Map* map = code->FindFirstMap()->CurrentMapForDeprecated();
+ return map == NULL || CanRetainOtherContext(map, *native_context_)
? Handle<Map>::null()
- : first_map;
+ : Handle<Map>(map);
}
- return Map::CurrentMapForDeprecated(Handle<Map>::cast(map_or_code));
+ return Handle<Map>::cast(map_or_code);
}
TypeFeedbackId id) {
Handle<Object> maybe_code = GetInfo(id);
if (maybe_code->IsCode()) {
- Map* first_map = Handle<Code>::cast(maybe_code)->FindFirstMap();
- if (first_map != NULL) {
- return Map::CurrentMapForDeprecated(Handle<Map>(first_map));
- }
+ Map* map = Handle<Code>::cast(maybe_code)->FindFirstMap();
+ if (map == NULL) return Handle<Map>();
+ map = map->CurrentMapForDeprecated();
+ return map == NULL || CanRetainOtherContext(map, *native_context_)
+ ? Handle<Map>()
+ : Handle<Map>(map);
+ } else if (maybe_code->IsMap()) {
+ ASSERT(!Handle<Map>::cast(maybe_code)->is_deprecated());
+ return Handle<Map>::cast(maybe_code);
}
return Handle<Map>();
}
Handle<Map> TypeFeedbackOracle::GetObjectLiteralStoreMap(
ObjectLiteral::Property* prop) {
ASSERT(ObjectLiteralStoreIsMonomorphic(prop));
- return Map::CurrentMapForDeprecated(
- Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId())));
+ return Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId()));
}
if (state != CompareIC::KNOWN_OBJECT) {
return Handle<Map>::null();
}
- Handle<Map> first_map(code->FindFirstMap());
- ASSERT(!first_map.is_null());
- first_map = Map::CurrentMapForDeprecated(first_map);
- return CanRetainOtherContext(*first_map, *native_context_)
+ Map* map = code->FindFirstMap()->CurrentMapForDeprecated();
+ return map == NULL || CanRetainOtherContext(map, *native_context_)
? Handle<Map>::null()
- : first_map;
+ : Handle<Map>(map);
}
SetInfo(ast_id, static_cast<Object*>(target));
} else if (!CanRetainOtherContext(Map::cast(map),
*native_context_)) {
- SetInfo(ast_id, map);
+ Map* feedback = Map::cast(map)->CurrentMapForDeprecated();
+ if (feedback != NULL) SetInfo(ast_id, feedback);
}
}
} else {