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

Unified Diff: src/objects-inl.h

Issue 15941005: Merged r14732, r14746, r14757 into 3.18 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.18
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/hydrogen.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 29474b99fd5901cd4e8e9e27fb21a95e84edfd6a..09c07f977e8aa8dbf0d45535d96e8372ebf27575 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1514,9 +1514,19 @@ MaybeObject* JSObject::ResetElements() {
MaybeObject* JSObject::TransitionToMap(Map* map) {
ASSERT(this->map()->inobject_properties() == map->inobject_properties());
- ElementsKind expected_kind = this->map()->elements_kind();
- if (map->elements_kind() != expected_kind) {
- MaybeObject* maybe_map = map->AsElementsKind(expected_kind);
+ ElementsKind obj_kind = this->map()->elements_kind();
+ ElementsKind map_kind = map->elements_kind();
+ if (map_kind != obj_kind) {
+ ElementsKind to_kind = map_kind;
+ if (IsMoreGeneralElementsKindTransition(map_kind, obj_kind) ||
+ IsDictionaryElementsKind(obj_kind)) {
+ to_kind = obj_kind;
+ }
+ MaybeObject* maybe_obj =
+ IsDictionaryElementsKind(to_kind) ? NormalizeElements()
+ : TransitionElementsKind(to_kind);
+ if (maybe_obj->IsFailure()) return maybe_obj;
+ MaybeObject* maybe_map = map->AsElementsKind(to_kind);
if (!maybe_map->To(&map)) return maybe_map;
}
int total_size =
« no previous file with comments | « src/hydrogen.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698