| 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 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2497 // Check the state of the root map. | 2497 // Check the state of the root map. |
| 2498 Handle<Map> root_map(old_map->FindRootMap(), isolate); | 2498 Handle<Map> root_map(old_map->FindRootMap(), isolate); |
| 2499 if (!old_map->EquivalentToForTransition(*root_map)) { | 2499 if (!old_map->EquivalentToForTransition(*root_map)) { |
| 2500 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, | 2500 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, |
| 2501 new_kind, new_attributes, | 2501 new_kind, new_attributes, |
| 2502 "GenAll_NotEquivalent"); | 2502 "GenAll_NotEquivalent"); |
| 2503 } | 2503 } |
| 2504 | 2504 |
| 2505 ElementsKind from_kind = root_map->elements_kind(); | 2505 ElementsKind from_kind = root_map->elements_kind(); |
| 2506 ElementsKind to_kind = old_map->elements_kind(); | 2506 ElementsKind to_kind = old_map->elements_kind(); |
| 2507 if (from_kind != to_kind && | 2507 if (from_kind != to_kind && to_kind != DICTIONARY_ELEMENTS && |
| 2508 !(IsTransitionableFastElementsKind(from_kind) && | 2508 !(IsTransitionableFastElementsKind(from_kind) && |
| 2509 IsMoreGeneralElementsKindTransition(from_kind, to_kind))) { | 2509 IsMoreGeneralElementsKindTransition(from_kind, to_kind))) { |
| 2510 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, | 2510 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, |
| 2511 new_kind, new_attributes, | 2511 new_kind, new_attributes, |
| 2512 "GenAll_InvalidElementsTransition"); | 2512 "GenAll_InvalidElementsTransition"); |
| 2513 } | 2513 } |
| 2514 int root_nof = root_map->NumberOfOwnDescriptors(); | 2514 int root_nof = root_map->NumberOfOwnDescriptors(); |
| 2515 if (modify_index >= 0 && modify_index < root_nof) { | 2515 if (modify_index >= 0 && modify_index < root_nof) { |
| 2516 PropertyDetails old_details = old_descriptors->GetDetails(modify_index); | 2516 PropertyDetails old_details = old_descriptors->GetDetails(modify_index); |
| 2517 if (old_details.kind() != new_kind || | 2517 if (old_details.kind() != new_kind || |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2961 // static | 2961 // static |
| 2962 MaybeHandle<Map> Map::TryUpdate(Handle<Map> old_map) { | 2962 MaybeHandle<Map> Map::TryUpdate(Handle<Map> old_map) { |
| 2963 DisallowHeapAllocation no_allocation; | 2963 DisallowHeapAllocation no_allocation; |
| 2964 DisallowDeoptimization no_deoptimization(old_map->GetIsolate()); | 2964 DisallowDeoptimization no_deoptimization(old_map->GetIsolate()); |
| 2965 | 2965 |
| 2966 if (!old_map->is_deprecated()) return old_map; | 2966 if (!old_map->is_deprecated()) return old_map; |
| 2967 | 2967 |
| 2968 // Check the state of the root map. | 2968 // Check the state of the root map. |
| 2969 Map* root_map = old_map->FindRootMap(); | 2969 Map* root_map = old_map->FindRootMap(); |
| 2970 if (!old_map->EquivalentToForTransition(root_map)) return MaybeHandle<Map>(); | 2970 if (!old_map->EquivalentToForTransition(root_map)) return MaybeHandle<Map>(); |
| 2971 |
| 2972 ElementsKind from_kind = root_map->elements_kind(); |
| 2973 ElementsKind to_kind = old_map->elements_kind(); |
| 2974 if (from_kind != to_kind) { |
| 2975 // Try to follow existing elements kind transitions. |
| 2976 root_map = root_map->LookupElementsTransitionMap(to_kind); |
| 2977 if (root_map == NULL) return MaybeHandle<Map>(); |
| 2978 // From here on, use the map with correct elements kind as root map. |
| 2979 } |
| 2971 int root_nof = root_map->NumberOfOwnDescriptors(); | 2980 int root_nof = root_map->NumberOfOwnDescriptors(); |
| 2972 | 2981 |
| 2973 int old_nof = old_map->NumberOfOwnDescriptors(); | 2982 int old_nof = old_map->NumberOfOwnDescriptors(); |
| 2974 DescriptorArray* old_descriptors = old_map->instance_descriptors(); | 2983 DescriptorArray* old_descriptors = old_map->instance_descriptors(); |
| 2975 | 2984 |
| 2976 Map* new_map = root_map; | 2985 Map* new_map = root_map; |
| 2977 for (int i = root_nof; i < old_nof; ++i) { | 2986 for (int i = root_nof; i < old_nof; ++i) { |
| 2978 PropertyDetails old_details = old_descriptors->GetDetails(i); | 2987 PropertyDetails old_details = old_descriptors->GetDetails(i); |
| 2979 Map* transition = TransitionArray::SearchTransition( | 2988 Map* transition = TransitionArray::SearchTransition( |
| 2980 new_map, old_details.kind(), old_descriptors->GetKey(i), | 2989 new_map, old_details.kind(), old_descriptors->GetKey(i), |
| (...skipping 14204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17185 CompilationInfo* info) { | 17194 CompilationInfo* info) { |
| 17186 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( | 17195 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( |
| 17187 handle(cell->dependent_code(), info->isolate()), | 17196 handle(cell->dependent_code(), info->isolate()), |
| 17188 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); | 17197 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); |
| 17189 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17198 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
| 17190 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17199 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
| 17191 cell, info->zone()); | 17200 cell, info->zone()); |
| 17192 } | 17201 } |
| 17193 | 17202 |
| 17194 } } // namespace v8::internal | 17203 } } // namespace v8::internal |
| OLD | NEW |