| OLD | NEW |
| 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 2553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2564 // Check the state of the root map. | 2564 // Check the state of the root map. |
| 2565 Handle<Map> root_map(old_map->FindRootMap(), isolate); | 2565 Handle<Map> root_map(old_map->FindRootMap(), isolate); |
| 2566 if (!old_map->EquivalentToForTransition(*root_map)) { | 2566 if (!old_map->EquivalentToForTransition(*root_map)) { |
| 2567 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, | 2567 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, |
| 2568 new_kind, new_attributes, | 2568 new_kind, new_attributes, |
| 2569 "GenAll_NotEquivalent"); | 2569 "GenAll_NotEquivalent"); |
| 2570 } | 2570 } |
| 2571 | 2571 |
| 2572 ElementsKind from_kind = root_map->elements_kind(); | 2572 ElementsKind from_kind = root_map->elements_kind(); |
| 2573 ElementsKind to_kind = old_map->elements_kind(); | 2573 ElementsKind to_kind = old_map->elements_kind(); |
| 2574 if (from_kind != to_kind && | 2574 if (from_kind != to_kind && to_kind != DICTIONARY_ELEMENTS && |
| 2575 !(IsTransitionableFastElementsKind(from_kind) && | 2575 !(IsTransitionableFastElementsKind(from_kind) && |
| 2576 IsMoreGeneralElementsKindTransition(from_kind, to_kind))) { | 2576 IsMoreGeneralElementsKindTransition(from_kind, to_kind))) { |
| 2577 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, | 2577 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, |
| 2578 new_kind, new_attributes, | 2578 new_kind, new_attributes, |
| 2579 "GenAll_InvalidElementsTransition"); | 2579 "GenAll_InvalidElementsTransition"); |
| 2580 } | 2580 } |
| 2581 int root_nof = root_map->NumberOfOwnDescriptors(); | 2581 int root_nof = root_map->NumberOfOwnDescriptors(); |
| 2582 if (modify_index >= 0 && modify_index < root_nof) { | 2582 if (modify_index >= 0 && modify_index < root_nof) { |
| 2583 PropertyDetails old_details = old_descriptors->GetDetails(modify_index); | 2583 PropertyDetails old_details = old_descriptors->GetDetails(modify_index); |
| 2584 if (old_details.kind() != new_kind || | 2584 if (old_details.kind() != new_kind || |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3028 // static | 3028 // static |
| 3029 MaybeHandle<Map> Map::TryUpdate(Handle<Map> old_map) { | 3029 MaybeHandle<Map> Map::TryUpdate(Handle<Map> old_map) { |
| 3030 DisallowHeapAllocation no_allocation; | 3030 DisallowHeapAllocation no_allocation; |
| 3031 DisallowDeoptimization no_deoptimization(old_map->GetIsolate()); | 3031 DisallowDeoptimization no_deoptimization(old_map->GetIsolate()); |
| 3032 | 3032 |
| 3033 if (!old_map->is_deprecated()) return old_map; | 3033 if (!old_map->is_deprecated()) return old_map; |
| 3034 | 3034 |
| 3035 // Check the state of the root map. | 3035 // Check the state of the root map. |
| 3036 Map* root_map = old_map->FindRootMap(); | 3036 Map* root_map = old_map->FindRootMap(); |
| 3037 if (!old_map->EquivalentToForTransition(root_map)) return MaybeHandle<Map>(); | 3037 if (!old_map->EquivalentToForTransition(root_map)) return MaybeHandle<Map>(); |
| 3038 |
| 3039 ElementsKind from_kind = root_map->elements_kind(); |
| 3040 ElementsKind to_kind = old_map->elements_kind(); |
| 3041 if (from_kind != to_kind) { |
| 3042 // Try to follow existing elements kind transitions. |
| 3043 root_map = root_map->LookupElementsTransitionMap(to_kind); |
| 3044 if (root_map == NULL) return MaybeHandle<Map>(); |
| 3045 // From here on, use the map with correct elements kind as root map. |
| 3046 } |
| 3038 int root_nof = root_map->NumberOfOwnDescriptors(); | 3047 int root_nof = root_map->NumberOfOwnDescriptors(); |
| 3039 | 3048 |
| 3040 int old_nof = old_map->NumberOfOwnDescriptors(); | 3049 int old_nof = old_map->NumberOfOwnDescriptors(); |
| 3041 DescriptorArray* old_descriptors = old_map->instance_descriptors(); | 3050 DescriptorArray* old_descriptors = old_map->instance_descriptors(); |
| 3042 | 3051 |
| 3043 Map* new_map = root_map; | 3052 Map* new_map = root_map; |
| 3044 for (int i = root_nof; i < old_nof; ++i) { | 3053 for (int i = root_nof; i < old_nof; ++i) { |
| 3045 PropertyDetails old_details = old_descriptors->GetDetails(i); | 3054 PropertyDetails old_details = old_descriptors->GetDetails(i); |
| 3046 Map* transition = TransitionArray::SearchTransition( | 3055 Map* transition = TransitionArray::SearchTransition( |
| 3047 new_map, old_details.kind(), old_descriptors->GetKey(i), | 3056 new_map, old_details.kind(), old_descriptors->GetKey(i), |
| (...skipping 14198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17246 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, | 17255 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, |
| 17247 Handle<Object> new_value) { | 17256 Handle<Object> new_value) { |
| 17248 if (cell->value() != *new_value) { | 17257 if (cell->value() != *new_value) { |
| 17249 cell->set_value(*new_value); | 17258 cell->set_value(*new_value); |
| 17250 Isolate* isolate = cell->GetIsolate(); | 17259 Isolate* isolate = cell->GetIsolate(); |
| 17251 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17260 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 17252 isolate, DependentCode::kPropertyCellChangedGroup); | 17261 isolate, DependentCode::kPropertyCellChangedGroup); |
| 17253 } | 17262 } |
| 17254 } | 17263 } |
| 17255 } } // namespace v8::internal | 17264 } } // namespace v8::internal |
| OLD | NEW |