Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1819)

Unified Diff: src/type-info.cc

Issue 15358005: Don't create new maps in CurrentMapForDeprecated. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/type-info.cc
diff --git a/src/type-info.cc b/src/type-info.cc
index 21dcf74cabd944c1082b3c3c291c10b638ae3201..53866c16cb5941a0f39408ae2ddeead023b3837b 100644
--- a/src/type-info.cc
+++ b/src/type-info.cc
@@ -105,6 +105,8 @@ bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) {
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;
@@ -136,6 +138,8 @@ bool TypeFeedbackOracle::StoreIsMonomorphicNormal(TypeFeedbackId ast_id) {
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;
@@ -192,14 +196,12 @@ Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) {
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);
}
@@ -209,14 +211,12 @@ Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(
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);
}
@@ -224,10 +224,15 @@ Handle<Map> TypeFeedbackOracle::CompareNilMonomorphicReceiverType(
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>();
}
@@ -351,8 +356,7 @@ ElementsKind TypeFeedbackOracle::GetCallNewElementsKind(CallNew* expr) {
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()));
}
@@ -431,12 +435,10 @@ Handle<Map> TypeFeedbackOracle::GetCompareMap(CompareOperation* expr) {
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);
}
@@ -723,7 +725,8 @@ void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) {
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 {
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698