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

Side by Side Diff: src/objects.cc

Issue 1181163002: Map::TryUpdate() must be in sync with Map::Update(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/test-migrations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 // Check the state of the root map. 2413 // Check the state of the root map.
2414 Handle<Map> root_map(old_map->FindRootMap(), isolate); 2414 Handle<Map> root_map(old_map->FindRootMap(), isolate);
2415 if (!old_map->EquivalentToForTransition(*root_map)) { 2415 if (!old_map->EquivalentToForTransition(*root_map)) {
2416 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, 2416 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode,
2417 new_kind, new_attributes, 2417 new_kind, new_attributes,
2418 "GenAll_NotEquivalent"); 2418 "GenAll_NotEquivalent");
2419 } 2419 }
2420 2420
2421 ElementsKind from_kind = root_map->elements_kind(); 2421 ElementsKind from_kind = root_map->elements_kind();
2422 ElementsKind to_kind = old_map->elements_kind(); 2422 ElementsKind to_kind = old_map->elements_kind();
2423 if (from_kind != to_kind && 2423 if (from_kind != to_kind && to_kind != DICTIONARY_ELEMENTS &&
2424 !(IsTransitionableFastElementsKind(from_kind) && 2424 !(IsTransitionableFastElementsKind(from_kind) &&
2425 IsMoreGeneralElementsKindTransition(from_kind, to_kind))) { 2425 IsMoreGeneralElementsKindTransition(from_kind, to_kind))) {
2426 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, 2426 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode,
2427 new_kind, new_attributes, 2427 new_kind, new_attributes,
2428 "GenAll_InvalidElementsTransition"); 2428 "GenAll_InvalidElementsTransition");
2429 } 2429 }
2430 int root_nof = root_map->NumberOfOwnDescriptors(); 2430 int root_nof = root_map->NumberOfOwnDescriptors();
2431 if (modify_index >= 0 && modify_index < root_nof) { 2431 if (modify_index >= 0 && modify_index < root_nof) {
2432 PropertyDetails old_details = old_descriptors->GetDetails(modify_index); 2432 PropertyDetails old_details = old_descriptors->GetDetails(modify_index);
2433 if (old_details.kind() != new_kind || 2433 if (old_details.kind() != new_kind ||
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2877 // static 2877 // static
2878 MaybeHandle<Map> Map::TryUpdate(Handle<Map> old_map) { 2878 MaybeHandle<Map> Map::TryUpdate(Handle<Map> old_map) {
2879 DisallowHeapAllocation no_allocation; 2879 DisallowHeapAllocation no_allocation;
2880 DisallowDeoptimization no_deoptimization(old_map->GetIsolate()); 2880 DisallowDeoptimization no_deoptimization(old_map->GetIsolate());
2881 2881
2882 if (!old_map->is_deprecated()) return old_map; 2882 if (!old_map->is_deprecated()) return old_map;
2883 2883
2884 // Check the state of the root map. 2884 // Check the state of the root map.
2885 Map* root_map = old_map->FindRootMap(); 2885 Map* root_map = old_map->FindRootMap();
2886 if (!old_map->EquivalentToForTransition(root_map)) return MaybeHandle<Map>(); 2886 if (!old_map->EquivalentToForTransition(root_map)) return MaybeHandle<Map>();
2887
2888 ElementsKind from_kind = root_map->elements_kind();
2889 ElementsKind to_kind = old_map->elements_kind();
2890 if (from_kind != to_kind) {
2891 // Try to follow existing elements kind transitions.
2892 root_map = root_map->LookupElementsTransitionMap(to_kind);
2893 if (root_map == NULL) return MaybeHandle<Map>();
2894 // From here on, use the map with correct elements kind as root map.
2895 }
2887 int root_nof = root_map->NumberOfOwnDescriptors(); 2896 int root_nof = root_map->NumberOfOwnDescriptors();
2888 2897
2889 int old_nof = old_map->NumberOfOwnDescriptors(); 2898 int old_nof = old_map->NumberOfOwnDescriptors();
2890 DescriptorArray* old_descriptors = old_map->instance_descriptors(); 2899 DescriptorArray* old_descriptors = old_map->instance_descriptors();
2891 2900
2892 Map* new_map = root_map; 2901 Map* new_map = root_map;
2893 for (int i = root_nof; i < old_nof; ++i) { 2902 for (int i = root_nof; i < old_nof; ++i) {
2894 PropertyDetails old_details = old_descriptors->GetDetails(i); 2903 PropertyDetails old_details = old_descriptors->GetDetails(i);
2895 Map* transition = TransitionArray::SearchTransition( 2904 Map* transition = TransitionArray::SearchTransition(
2896 new_map, old_details.kind(), old_descriptors->GetKey(i), 2905 new_map, old_details.kind(), old_descriptors->GetKey(i),
(...skipping 13796 matching lines...) Expand 10 before | Expand all | Expand 10 after
16693 Handle<Object> new_value) { 16702 Handle<Object> new_value) {
16694 if (cell->value() != *new_value) { 16703 if (cell->value() != *new_value) {
16695 cell->set_value(*new_value); 16704 cell->set_value(*new_value);
16696 Isolate* isolate = cell->GetIsolate(); 16705 Isolate* isolate = cell->GetIsolate();
16697 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16706 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16698 isolate, DependentCode::kPropertyCellChangedGroup); 16707 isolate, DependentCode::kPropertyCellChangedGroup);
16699 } 16708 }
16700 } 16709 }
16701 } // namespace internal 16710 } // namespace internal
16702 } // namespace v8 16711 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-migrations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698