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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1943 return false; | 1943 return false; |
1944 } | 1944 } |
1945 // Otherwise, properties will need to be moved to the backing store. | 1945 // Otherwise, properties will need to be moved to the backing store. |
1946 return true; | 1946 return true; |
1947 } | 1947 } |
1948 | 1948 |
1949 | 1949 |
1950 void Map::ConnectElementsTransition(Handle<Map> parent, Handle<Map> child) { | 1950 void Map::ConnectElementsTransition(Handle<Map> parent, Handle<Map> child) { |
1951 Isolate* isolate = parent->GetIsolate(); | 1951 Isolate* isolate = parent->GetIsolate(); |
1952 Handle<Name> name = isolate->factory()->elements_transition_symbol(); | 1952 Handle<Name> name = isolate->factory()->elements_transition_symbol(); |
1953 ConnectTransition(parent, child, name, FULL_TRANSITION); | 1953 ConnectTransition(parent, child, name, SPECIAL_TRANSITION); |
1954 } | 1954 } |
1955 | 1955 |
1956 | 1956 |
1957 void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> new_map) { | 1957 void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> new_map) { |
1958 if (object->map() == *new_map) return; | 1958 if (object->map() == *new_map) return; |
1959 if (object->HasFastProperties()) { | 1959 if (object->HasFastProperties()) { |
1960 if (!new_map->is_dictionary_map()) { | 1960 if (!new_map->is_dictionary_map()) { |
1961 Handle<Map> old_map(object->map()); | 1961 Handle<Map> old_map(object->map()); |
1962 MigrateFastToFast(object, new_map); | 1962 MigrateFastToFast(object, new_map); |
1963 if (old_map->is_prototype_map()) { | 1963 if (old_map->is_prototype_map()) { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2201 | 2201 |
2202 for (int i = 0; i < number_of_own_descriptors; i++) { | 2202 for (int i = 0; i < number_of_own_descriptors; i++) { |
2203 descriptors->SetRepresentation(i, Representation::Tagged()); | 2203 descriptors->SetRepresentation(i, Representation::Tagged()); |
2204 if (descriptors->GetDetails(i).type() == FIELD) { | 2204 if (descriptors->GetDetails(i).type() == FIELD) { |
2205 descriptors->SetValue(i, HeapType::Any()); | 2205 descriptors->SetValue(i, HeapType::Any()); |
2206 } | 2206 } |
2207 } | 2207 } |
2208 | 2208 |
2209 Handle<LayoutDescriptor> new_layout_descriptor( | 2209 Handle<LayoutDescriptor> new_layout_descriptor( |
2210 LayoutDescriptor::FastPointerLayout(), isolate); | 2210 LayoutDescriptor::FastPointerLayout(), isolate); |
2211 Handle<Map> new_map = | 2211 Handle<Map> new_map = CopyReplaceDescriptors( |
2212 CopyReplaceDescriptors(map, descriptors, new_layout_descriptor, | 2212 map, descriptors, new_layout_descriptor, OMIT_TRANSITION, |
2213 OMIT_TRANSITION, MaybeHandle<Name>(), reason); | 2213 MaybeHandle<Name>(), reason, SPECIAL_TRANSITION); |
2214 | 2214 |
2215 // Unless the instance is being migrated, ensure that modify_index is a field. | 2215 // Unless the instance is being migrated, ensure that modify_index is a field. |
2216 PropertyDetails details = descriptors->GetDetails(modify_index); | 2216 PropertyDetails details = descriptors->GetDetails(modify_index); |
2217 if (store_mode == FORCE_FIELD && | 2217 if (store_mode == FORCE_FIELD && |
2218 (details.type() != FIELD || details.attributes() != attributes)) { | 2218 (details.type() != FIELD || details.attributes() != attributes)) { |
2219 int field_index = details.type() == FIELD ? details.field_index() | 2219 int field_index = details.type() == FIELD ? details.field_index() |
2220 : new_map->NumberOfFields(); | 2220 : new_map->NumberOfFields(); |
2221 FieldDescriptor d(handle(descriptors->GetKey(modify_index), isolate), | 2221 FieldDescriptor d(handle(descriptors->GetKey(modify_index), isolate), |
2222 field_index, attributes, Representation::Tagged()); | 2222 field_index, attributes, Representation::Tagged()); |
2223 descriptors->Replace(modify_index, &d); | 2223 descriptors->Replace(modify_index, &d); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 dependent_code()->DeoptimizeDependentCodeGroup( | 2271 dependent_code()->DeoptimizeDependentCodeGroup( |
2272 GetIsolate(), DependentCode::kTransitionGroup); | 2272 GetIsolate(), DependentCode::kTransitionGroup); |
2273 NotifyLeafMapLayoutChange(); | 2273 NotifyLeafMapLayoutChange(); |
2274 } | 2274 } |
2275 | 2275 |
2276 | 2276 |
2277 // Invalidates a transition target at |key|, and installs |new_descriptors| over | 2277 // Invalidates a transition target at |key|, and installs |new_descriptors| over |
2278 // the current instance_descriptors to ensure proper sharing of descriptor | 2278 // the current instance_descriptors to ensure proper sharing of descriptor |
2279 // arrays. | 2279 // arrays. |
2280 // Returns true if the transition target at given key was deprecated. | 2280 // Returns true if the transition target at given key was deprecated. |
2281 bool Map::DeprecateTarget(Name* key, DescriptorArray* new_descriptors, | 2281 bool Map::DeprecateTarget(PropertyType type, Name* key, |
| 2282 PropertyAttributes attributes, |
| 2283 DescriptorArray* new_descriptors, |
2282 LayoutDescriptor* new_layout_descriptor) { | 2284 LayoutDescriptor* new_layout_descriptor) { |
2283 bool transition_target_deprecated = false; | 2285 bool transition_target_deprecated = false; |
2284 if (HasTransitionArray()) { | 2286 if (HasTransitionArray()) { |
2285 TransitionArray* transitions = this->transitions(); | 2287 TransitionArray* transitions = this->transitions(); |
2286 int transition = transitions->Search(key); | 2288 int transition = transitions->Search(type, key, attributes); |
2287 if (transition != TransitionArray::kNotFound) { | 2289 if (transition != TransitionArray::kNotFound) { |
2288 transitions->GetTarget(transition)->DeprecateTransitionTree(); | 2290 transitions->GetTarget(transition)->DeprecateTransitionTree(); |
2289 transition_target_deprecated = true; | 2291 transition_target_deprecated = true; |
2290 } | 2292 } |
2291 } | 2293 } |
2292 | 2294 |
2293 // Don't overwrite the empty descriptor array. | 2295 // Don't overwrite the empty descriptor array. |
2294 if (NumberOfOwnDescriptors() == 0) return transition_target_deprecated; | 2296 if (NumberOfOwnDescriptors() == 0) return transition_target_deprecated; |
2295 | 2297 |
2296 DescriptorArray* to_replace = instance_descriptors(); | 2298 DescriptorArray* to_replace = instance_descriptors(); |
(...skipping 28 matching lines...) Expand all Loading... |
2325 DisallowHeapAllocation no_allocation; | 2327 DisallowHeapAllocation no_allocation; |
2326 | 2328 |
2327 // This can only be called on roots of transition trees. | 2329 // This can only be called on roots of transition trees. |
2328 DCHECK(GetBackPointer()->IsUndefined()); | 2330 DCHECK(GetBackPointer()->IsUndefined()); |
2329 | 2331 |
2330 Map* current = this; | 2332 Map* current = this; |
2331 | 2333 |
2332 for (int i = verbatim; i < length; i++) { | 2334 for (int i = verbatim; i < length; i++) { |
2333 if (!current->HasTransitionArray()) break; | 2335 if (!current->HasTransitionArray()) break; |
2334 Name* name = descriptors->GetKey(i); | 2336 Name* name = descriptors->GetKey(i); |
| 2337 PropertyDetails details = descriptors->GetDetails(i); |
2335 TransitionArray* transitions = current->transitions(); | 2338 TransitionArray* transitions = current->transitions(); |
2336 int transition = transitions->Search(name); | 2339 int transition = |
| 2340 transitions->Search(details.type(), name, details.attributes()); |
2337 if (transition == TransitionArray::kNotFound) break; | 2341 if (transition == TransitionArray::kNotFound) break; |
2338 | 2342 |
2339 Map* next = transitions->GetTarget(transition); | 2343 Map* next = transitions->GetTarget(transition); |
2340 DescriptorArray* next_descriptors = next->instance_descriptors(); | 2344 DescriptorArray* next_descriptors = next->instance_descriptors(); |
2341 | 2345 |
2342 PropertyDetails details = descriptors->GetDetails(i); | |
2343 PropertyDetails next_details = next_descriptors->GetDetails(i); | 2346 PropertyDetails next_details = next_descriptors->GetDetails(i); |
2344 if (details.type() != next_details.type()) break; | 2347 if (details.type() != next_details.type()) break; |
2345 if (details.attributes() != next_details.attributes()) break; | 2348 if (details.attributes() != next_details.attributes()) break; |
2346 if (!details.representation().Equals(next_details.representation())) break; | 2349 if (!details.representation().Equals(next_details.representation())) break; |
2347 if (next_details.type() == FIELD) { | 2350 if (next_details.type() == FIELD) { |
2348 if (!descriptors->GetFieldType(i)->NowIs( | 2351 if (!descriptors->GetFieldType(i)->NowIs( |
2349 next_descriptors->GetFieldType(i))) break; | 2352 next_descriptors->GetFieldType(i))) break; |
2350 } else { | 2353 } else { |
2351 if (descriptors->GetValue(i) != next_descriptors->GetValue(i)) break; | 2354 if (descriptors->GetValue(i) != next_descriptors->GetValue(i)) break; |
2352 } | 2355 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2536 (old_details.type() == FIELD && | 2539 (old_details.type() == FIELD && |
2537 (!new_field_type->NowIs(old_descriptors->GetFieldType(modify_index)) || | 2540 (!new_field_type->NowIs(old_descriptors->GetFieldType(modify_index)) || |
2538 !new_representation.fits_into(old_details.representation())))) { | 2541 !new_representation.fits_into(old_details.representation())))) { |
2539 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, | 2542 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, |
2540 "GenAll_RootModification"); | 2543 "GenAll_RootModification"); |
2541 } | 2544 } |
2542 } | 2545 } |
2543 | 2546 |
2544 Handle<Map> target_map = root_map; | 2547 Handle<Map> target_map = root_map; |
2545 for (int i = root_nof; i < old_nof; ++i) { | 2548 for (int i = root_nof; i < old_nof; ++i) { |
2546 int j = target_map->SearchTransition(old_descriptors->GetKey(i)); | 2549 PropertyDetails old_details = old_descriptors->GetDetails(i); |
| 2550 int j = target_map->SearchTransition(old_details.type(), |
| 2551 old_descriptors->GetKey(i), |
| 2552 old_details.attributes()); |
2547 if (j == TransitionArray::kNotFound) break; | 2553 if (j == TransitionArray::kNotFound) break; |
2548 Handle<Map> tmp_map(target_map->GetTransition(j), isolate); | 2554 Handle<Map> tmp_map(target_map->GetTransition(j), isolate); |
2549 Handle<DescriptorArray> tmp_descriptors = handle( | 2555 Handle<DescriptorArray> tmp_descriptors = handle( |
2550 tmp_map->instance_descriptors(), isolate); | 2556 tmp_map->instance_descriptors(), isolate); |
2551 | 2557 |
2552 // Check if target map is incompatible. | 2558 // Check if target map is incompatible. |
2553 PropertyDetails old_details = old_descriptors->GetDetails(i); | |
2554 PropertyDetails tmp_details = tmp_descriptors->GetDetails(i); | 2559 PropertyDetails tmp_details = tmp_descriptors->GetDetails(i); |
2555 PropertyType old_type = old_details.type(); | 2560 PropertyType old_type = old_details.type(); |
2556 PropertyType tmp_type = tmp_details.type(); | 2561 PropertyType tmp_type = tmp_details.type(); |
2557 if (tmp_details.attributes() != old_details.attributes() || | 2562 DCHECK_EQ(old_details.attributes(), tmp_details.attributes()); |
2558 ((tmp_type == CALLBACKS || old_type == CALLBACKS) && | 2563 if ((tmp_type == CALLBACKS || old_type == CALLBACKS) && |
2559 (tmp_type != old_type || | 2564 (tmp_type != old_type || |
2560 tmp_descriptors->GetValue(i) != old_descriptors->GetValue(i)))) { | 2565 tmp_descriptors->GetValue(i) != old_descriptors->GetValue(i))) { |
2561 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, | 2566 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, |
2562 "GenAll_Incompatible"); | 2567 "GenAll_Incompatible"); |
2563 } | 2568 } |
2564 Representation old_representation = old_details.representation(); | 2569 Representation old_representation = old_details.representation(); |
2565 Representation tmp_representation = tmp_details.representation(); | 2570 Representation tmp_representation = tmp_details.representation(); |
2566 if (!old_representation.fits_into(tmp_representation) || | 2571 if (!old_representation.fits_into(tmp_representation) || |
2567 (!new_representation.fits_into(tmp_representation) && | 2572 (!new_representation.fits_into(tmp_representation) && |
2568 modify_index == i)) { | 2573 modify_index == i)) { |
2569 break; | 2574 break; |
2570 } | 2575 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2602 DCHECK(new_representation.fits_into( | 2607 DCHECK(new_representation.fits_into( |
2603 target_descriptors->GetDetails(modify_index).representation())); | 2608 target_descriptors->GetDetails(modify_index).representation())); |
2604 DCHECK(target_descriptors->GetDetails(modify_index).type() != FIELD || | 2609 DCHECK(target_descriptors->GetDetails(modify_index).type() != FIELD || |
2605 new_field_type->NowIs( | 2610 new_field_type->NowIs( |
2606 target_descriptors->GetFieldType(modify_index))); | 2611 target_descriptors->GetFieldType(modify_index))); |
2607 return target_map; | 2612 return target_map; |
2608 } | 2613 } |
2609 | 2614 |
2610 // Find the last compatible target map in the transition tree. | 2615 // Find the last compatible target map in the transition tree. |
2611 for (int i = target_nof; i < old_nof; ++i) { | 2616 for (int i = target_nof; i < old_nof; ++i) { |
2612 int j = target_map->SearchTransition(old_descriptors->GetKey(i)); | 2617 PropertyDetails old_details = old_descriptors->GetDetails(i); |
| 2618 int j = target_map->SearchTransition(old_details.type(), |
| 2619 old_descriptors->GetKey(i), |
| 2620 old_details.attributes()); |
2613 if (j == TransitionArray::kNotFound) break; | 2621 if (j == TransitionArray::kNotFound) break; |
2614 Handle<Map> tmp_map(target_map->GetTransition(j), isolate); | 2622 Handle<Map> tmp_map(target_map->GetTransition(j), isolate); |
2615 Handle<DescriptorArray> tmp_descriptors( | 2623 Handle<DescriptorArray> tmp_descriptors( |
2616 tmp_map->instance_descriptors(), isolate); | 2624 tmp_map->instance_descriptors(), isolate); |
2617 | 2625 |
2618 // Check if target map is compatible. | 2626 // Check if target map is compatible. |
2619 PropertyDetails old_details = old_descriptors->GetDetails(i); | |
2620 PropertyDetails tmp_details = tmp_descriptors->GetDetails(i); | 2627 PropertyDetails tmp_details = tmp_descriptors->GetDetails(i); |
2621 if (tmp_details.attributes() != old_details.attributes() || | 2628 DCHECK_EQ(old_details.attributes(), tmp_details.attributes()); |
2622 ((tmp_details.type() == CALLBACKS || old_details.type() == CALLBACKS) && | 2629 if ((tmp_details.type() == CALLBACKS || old_details.type() == CALLBACKS) && |
2623 (tmp_details.type() != old_details.type() || | 2630 (tmp_details.type() != old_details.type() || |
2624 tmp_descriptors->GetValue(i) != old_descriptors->GetValue(i)))) { | 2631 tmp_descriptors->GetValue(i) != old_descriptors->GetValue(i))) { |
2625 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, | 2632 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, |
2626 "GenAll_Incompatible"); | 2633 "GenAll_Incompatible"); |
2627 } | 2634 } |
2628 target_map = tmp_map; | 2635 target_map = tmp_map; |
2629 } | 2636 } |
2630 target_nof = target_map->NumberOfOwnDescriptors(); | 2637 target_nof = target_map->NumberOfOwnDescriptors(); |
2631 target_descriptors = handle(target_map->instance_descriptors(), isolate); | 2638 target_descriptors = handle(target_map->instance_descriptors(), isolate); |
2632 | 2639 |
2633 // Allocate a new descriptor array large enough to hold the required | 2640 // Allocate a new descriptor array large enough to hold the required |
2634 // descriptors, with minimally the exact same size as the old descriptor | 2641 // descriptors, with minimally the exact same size as the old descriptor |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2746 DCHECK(store_mode != FORCE_FIELD || | 2753 DCHECK(store_mode != FORCE_FIELD || |
2747 new_descriptors->GetDetails(modify_index).type() == FIELD); | 2754 new_descriptors->GetDetails(modify_index).type() == FIELD); |
2748 | 2755 |
2749 Handle<Map> split_map(root_map->FindLastMatchMap( | 2756 Handle<Map> split_map(root_map->FindLastMatchMap( |
2750 root_nof, old_nof, *new_descriptors), isolate); | 2757 root_nof, old_nof, *new_descriptors), isolate); |
2751 int split_nof = split_map->NumberOfOwnDescriptors(); | 2758 int split_nof = split_map->NumberOfOwnDescriptors(); |
2752 DCHECK_NE(old_nof, split_nof); | 2759 DCHECK_NE(old_nof, split_nof); |
2753 | 2760 |
2754 Handle<LayoutDescriptor> new_layout_descriptor = | 2761 Handle<LayoutDescriptor> new_layout_descriptor = |
2755 LayoutDescriptor::New(split_map, new_descriptors, old_nof); | 2762 LayoutDescriptor::New(split_map, new_descriptors, old_nof); |
2756 bool transition_target_deprecated = | 2763 PropertyDetails split_prop_details = old_descriptors->GetDetails(split_nof); |
2757 split_map->DeprecateTarget(old_descriptors->GetKey(split_nof), | 2764 bool transition_target_deprecated = split_map->DeprecateTarget( |
2758 *new_descriptors, *new_layout_descriptor); | 2765 split_prop_details.type(), old_descriptors->GetKey(split_nof), |
| 2766 split_prop_details.attributes(), *new_descriptors, |
| 2767 *new_layout_descriptor); |
2759 | 2768 |
2760 // If |transition_target_deprecated| is true then the transition array | 2769 // If |transition_target_deprecated| is true then the transition array |
2761 // already contains entry for given descriptor. This means that the transition | 2770 // already contains entry for given descriptor. This means that the transition |
2762 // could be inserted regardless of whether transitions array is full or not. | 2771 // could be inserted regardless of whether transitions array is full or not. |
2763 if (!transition_target_deprecated && !split_map->CanHaveMoreTransitions()) { | 2772 if (!transition_target_deprecated && !split_map->CanHaveMoreTransitions()) { |
2764 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, | 2773 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, |
2765 "GenAll_CantHaveMoreTransitions"); | 2774 "GenAll_CantHaveMoreTransitions"); |
2766 } | 2775 } |
2767 | 2776 |
2768 if (FLAG_trace_generalization) { | 2777 if (FLAG_trace_generalization) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2842 // Check the state of the root map. | 2851 // Check the state of the root map. |
2843 Map* root_map = old_map->FindRootMap(); | 2852 Map* root_map = old_map->FindRootMap(); |
2844 if (!old_map->EquivalentToForTransition(root_map)) return MaybeHandle<Map>(); | 2853 if (!old_map->EquivalentToForTransition(root_map)) return MaybeHandle<Map>(); |
2845 int root_nof = root_map->NumberOfOwnDescriptors(); | 2854 int root_nof = root_map->NumberOfOwnDescriptors(); |
2846 | 2855 |
2847 int old_nof = old_map->NumberOfOwnDescriptors(); | 2856 int old_nof = old_map->NumberOfOwnDescriptors(); |
2848 DescriptorArray* old_descriptors = old_map->instance_descriptors(); | 2857 DescriptorArray* old_descriptors = old_map->instance_descriptors(); |
2849 | 2858 |
2850 Map* new_map = root_map; | 2859 Map* new_map = root_map; |
2851 for (int i = root_nof; i < old_nof; ++i) { | 2860 for (int i = root_nof; i < old_nof; ++i) { |
2852 int j = new_map->SearchTransition(old_descriptors->GetKey(i)); | 2861 PropertyDetails old_details = old_descriptors->GetDetails(i); |
| 2862 int j = new_map->SearchTransition(old_details.type(), |
| 2863 old_descriptors->GetKey(i), |
| 2864 old_details.attributes()); |
2853 if (j == TransitionArray::kNotFound) return MaybeHandle<Map>(); | 2865 if (j == TransitionArray::kNotFound) return MaybeHandle<Map>(); |
2854 new_map = new_map->GetTransition(j); | 2866 new_map = new_map->GetTransition(j); |
2855 DescriptorArray* new_descriptors = new_map->instance_descriptors(); | 2867 DescriptorArray* new_descriptors = new_map->instance_descriptors(); |
2856 | 2868 |
2857 PropertyDetails new_details = new_descriptors->GetDetails(i); | 2869 PropertyDetails new_details = new_descriptors->GetDetails(i); |
2858 PropertyDetails old_details = old_descriptors->GetDetails(i); | |
2859 if (old_details.attributes() != new_details.attributes() || | 2870 if (old_details.attributes() != new_details.attributes() || |
2860 !old_details.representation().fits_into(new_details.representation())) { | 2871 !old_details.representation().fits_into(new_details.representation())) { |
2861 return MaybeHandle<Map>(); | 2872 return MaybeHandle<Map>(); |
2862 } | 2873 } |
2863 PropertyType new_type = new_details.type(); | 2874 PropertyType new_type = new_details.type(); |
2864 PropertyType old_type = old_details.type(); | 2875 PropertyType old_type = old_details.type(); |
2865 Object* new_value = new_descriptors->GetValue(i); | 2876 Object* new_value = new_descriptors->GetValue(i); |
2866 Object* old_value = old_descriptors->GetValue(i); | 2877 Object* old_value = old_descriptors->GetValue(i); |
2867 switch (new_type) { | 2878 switch (new_type) { |
2868 case FIELD: | 2879 case FIELD: |
(...skipping 2620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5489 handle(object->elements()), length, new_element_dictionary); | 5500 handle(object->elements()), length, new_element_dictionary); |
5490 } else { | 5501 } else { |
5491 // No existing elements, use a pre-allocated empty backing store | 5502 // No existing elements, use a pre-allocated empty backing store |
5492 new_element_dictionary = | 5503 new_element_dictionary = |
5493 isolate->factory()->empty_slow_element_dictionary(); | 5504 isolate->factory()->empty_slow_element_dictionary(); |
5494 } | 5505 } |
5495 } | 5506 } |
5496 | 5507 |
5497 Handle<Map> old_map(object->map(), isolate); | 5508 Handle<Map> old_map(object->map(), isolate); |
5498 int transition_index = | 5509 int transition_index = |
5499 old_map->SearchTransition(isolate->heap()->frozen_symbol()); | 5510 old_map->SearchSpecialTransition(isolate->heap()->frozen_symbol()); |
5500 if (transition_index != TransitionArray::kNotFound) { | 5511 if (transition_index != TransitionArray::kNotFound) { |
5501 Handle<Map> transition_map(old_map->GetTransition(transition_index)); | 5512 Handle<Map> transition_map(old_map->GetTransition(transition_index)); |
5502 DCHECK(transition_map->has_dictionary_elements()); | 5513 DCHECK(transition_map->has_dictionary_elements()); |
5503 DCHECK(transition_map->is_frozen()); | 5514 DCHECK(transition_map->is_frozen()); |
5504 DCHECK(!transition_map->is_extensible()); | 5515 DCHECK(!transition_map->is_extensible()); |
5505 JSObject::MigrateToMap(object, transition_map); | 5516 JSObject::MigrateToMap(object, transition_map); |
5506 } else if (object->HasFastProperties() && old_map->CanHaveMoreTransitions()) { | 5517 } else if (object->HasFastProperties() && old_map->CanHaveMoreTransitions()) { |
5507 // Create a new descriptor array with fully-frozen properties | 5518 // Create a new descriptor array with fully-frozen properties |
5508 Handle<Map> new_map = Map::CopyForFreeze(old_map); | 5519 Handle<Map> new_map = Map::CopyForFreeze(old_map); |
5509 JSObject::MigrateToMap(object, new_map); | 5520 JSObject::MigrateToMap(object, new_map); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5542 | 5553 |
5543 | 5554 |
5544 void JSObject::SetObserved(Handle<JSObject> object) { | 5555 void JSObject::SetObserved(Handle<JSObject> object) { |
5545 DCHECK(!object->IsJSGlobalProxy()); | 5556 DCHECK(!object->IsJSGlobalProxy()); |
5546 DCHECK(!object->IsJSGlobalObject()); | 5557 DCHECK(!object->IsJSGlobalObject()); |
5547 Isolate* isolate = object->GetIsolate(); | 5558 Isolate* isolate = object->GetIsolate(); |
5548 Handle<Map> new_map; | 5559 Handle<Map> new_map; |
5549 Handle<Map> old_map(object->map(), isolate); | 5560 Handle<Map> old_map(object->map(), isolate); |
5550 DCHECK(!old_map->is_observed()); | 5561 DCHECK(!old_map->is_observed()); |
5551 int transition_index = | 5562 int transition_index = |
5552 old_map->SearchTransition(isolate->heap()->observed_symbol()); | 5563 old_map->SearchSpecialTransition(isolate->heap()->observed_symbol()); |
5553 if (transition_index != TransitionArray::kNotFound) { | 5564 if (transition_index != TransitionArray::kNotFound) { |
5554 new_map = handle(old_map->GetTransition(transition_index), isolate); | 5565 new_map = handle(old_map->GetTransition(transition_index), isolate); |
5555 DCHECK(new_map->is_observed()); | 5566 DCHECK(new_map->is_observed()); |
5556 } else if (object->HasFastProperties() && old_map->CanHaveMoreTransitions()) { | 5567 } else if (object->HasFastProperties() && old_map->CanHaveMoreTransitions()) { |
5557 new_map = Map::CopyForObserved(old_map); | 5568 new_map = Map::CopyForObserved(old_map); |
5558 } else { | 5569 } else { |
5559 new_map = Map::Copy(old_map, "SlowObserved"); | 5570 new_map = Map::Copy(old_map, "SlowObserved"); |
5560 new_map->set_is_observed(); | 5571 new_map->set_is_observed(); |
5561 } | 5572 } |
5562 JSObject::MigrateToMap(object, new_map); | 5573 JSObject::MigrateToMap(object, new_map); |
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6752 ? LayoutDescriptor::Append(map, descriptor->GetDetails()) | 6763 ? LayoutDescriptor::Append(map, descriptor->GetDetails()) |
6753 : handle(LayoutDescriptor::FastPointerLayout(), map->GetIsolate()); | 6764 : handle(LayoutDescriptor::FastPointerLayout(), map->GetIsolate()); |
6754 | 6765 |
6755 { | 6766 { |
6756 DisallowHeapAllocation no_gc; | 6767 DisallowHeapAllocation no_gc; |
6757 descriptors->Append(descriptor); | 6768 descriptors->Append(descriptor); |
6758 result->InitializeDescriptors(*descriptors, *layout_descriptor); | 6769 result->InitializeDescriptors(*descriptors, *layout_descriptor); |
6759 } | 6770 } |
6760 | 6771 |
6761 DCHECK(result->NumberOfOwnDescriptors() == map->NumberOfOwnDescriptors() + 1); | 6772 DCHECK(result->NumberOfOwnDescriptors() == map->NumberOfOwnDescriptors() + 1); |
6762 ConnectTransition(map, result, name, SIMPLE_TRANSITION); | 6773 ConnectTransition(map, result, name, SIMPLE_PROPERTY_TRANSITION); |
6763 | 6774 |
6764 return result; | 6775 return result; |
6765 } | 6776 } |
6766 | 6777 |
6767 | 6778 |
6768 #if TRACE_MAPS | 6779 #if TRACE_MAPS |
6769 | 6780 |
6770 // static | 6781 // static |
6771 void Map::TraceTransition(const char* what, Map* from, Map* to, Name* name) { | 6782 void Map::TraceTransition(const char* what, Map* from, Map* to, Name* name) { |
6772 if (FLAG_trace_maps) { | 6783 if (FLAG_trace_maps) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6885 if (FLAG_unbox_double_fields) { | 6896 if (FLAG_unbox_double_fields) { |
6886 Handle<LayoutDescriptor> layout_descriptor = | 6897 Handle<LayoutDescriptor> layout_descriptor = |
6887 LayoutDescriptor::AppendIfFastOrUseFull(map, details, | 6898 LayoutDescriptor::AppendIfFastOrUseFull(map, details, |
6888 full_layout_descriptor); | 6899 full_layout_descriptor); |
6889 result->set_layout_descriptor(*layout_descriptor); | 6900 result->set_layout_descriptor(*layout_descriptor); |
6890 SLOW_DCHECK(result->layout_descriptor()->IsConsistentWithMap(*result)); | 6901 SLOW_DCHECK(result->layout_descriptor()->IsConsistentWithMap(*result)); |
6891 result->set_visitor_id(StaticVisitorBase::GetVisitorId(*result)); | 6902 result->set_visitor_id(StaticVisitorBase::GetVisitorId(*result)); |
6892 } | 6903 } |
6893 | 6904 |
6894 Handle<Name> name = handle(descriptors->GetKey(new_descriptor)); | 6905 Handle<Name> name = handle(descriptors->GetKey(new_descriptor)); |
6895 ConnectTransition(map, result, name, SIMPLE_TRANSITION); | 6906 ConnectTransition(map, result, name, SIMPLE_PROPERTY_TRANSITION); |
6896 | 6907 |
6897 return result; | 6908 return result; |
6898 } | 6909 } |
6899 | 6910 |
6900 | 6911 |
6901 Handle<Map> Map::CopyAsElementsKind(Handle<Map> map, ElementsKind kind, | 6912 Handle<Map> Map::CopyAsElementsKind(Handle<Map> map, ElementsKind kind, |
6902 TransitionFlag flag) { | 6913 TransitionFlag flag) { |
6903 if (flag == INSERT_TRANSITION) { | 6914 if (flag == INSERT_TRANSITION) { |
6904 DCHECK(!map->HasElementsTransition() || | 6915 DCHECK(!map->HasElementsTransition() || |
6905 ((map->elements_transition_map()->elements_kind() == | 6916 ((map->elements_transition_map()->elements_kind() == |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6963 | 6974 |
6964 new_map->set_is_observed(); | 6975 new_map->set_is_observed(); |
6965 if (map->owns_descriptors()) { | 6976 if (map->owns_descriptors()) { |
6966 // The properties did not change, so reuse descriptors. | 6977 // The properties did not change, so reuse descriptors. |
6967 new_map->InitializeDescriptors(map->instance_descriptors(), | 6978 new_map->InitializeDescriptors(map->instance_descriptors(), |
6968 map->GetLayoutDescriptor()); | 6979 map->GetLayoutDescriptor()); |
6969 } | 6980 } |
6970 | 6981 |
6971 if (map->CanHaveMoreTransitions()) { | 6982 if (map->CanHaveMoreTransitions()) { |
6972 Handle<Name> name = isolate->factory()->observed_symbol(); | 6983 Handle<Name> name = isolate->factory()->observed_symbol(); |
6973 ConnectTransition(map, new_map, name, FULL_TRANSITION); | 6984 ConnectTransition(map, new_map, name, SPECIAL_TRANSITION); |
6974 } | 6985 } |
6975 return new_map; | 6986 return new_map; |
6976 } | 6987 } |
6977 | 6988 |
6978 | 6989 |
6979 Handle<Map> Map::Copy(Handle<Map> map, const char* reason) { | 6990 Handle<Map> Map::Copy(Handle<Map> map, const char* reason) { |
6980 Handle<DescriptorArray> descriptors(map->instance_descriptors()); | 6991 Handle<DescriptorArray> descriptors(map->instance_descriptors()); |
6981 int number_of_own_descriptors = map->NumberOfOwnDescriptors(); | 6992 int number_of_own_descriptors = map->NumberOfOwnDescriptors(); |
6982 Handle<DescriptorArray> new_descriptors = | 6993 Handle<DescriptorArray> new_descriptors = |
6983 DescriptorArray::CopyUpTo(descriptors, number_of_own_descriptors); | 6994 DescriptorArray::CopyUpTo(descriptors, number_of_own_descriptors); |
6984 Handle<LayoutDescriptor> new_layout_descriptor(map->GetLayoutDescriptor(), | 6995 Handle<LayoutDescriptor> new_layout_descriptor(map->GetLayoutDescriptor(), |
6985 map->GetIsolate()); | 6996 map->GetIsolate()); |
6986 return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor, | 6997 return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor, |
6987 OMIT_TRANSITION, MaybeHandle<Name>(), reason); | 6998 OMIT_TRANSITION, MaybeHandle<Name>(), reason, |
| 6999 SPECIAL_TRANSITION); |
6988 } | 7000 } |
6989 | 7001 |
6990 | 7002 |
6991 Handle<Map> Map::Create(Isolate* isolate, int inobject_properties) { | 7003 Handle<Map> Map::Create(Isolate* isolate, int inobject_properties) { |
6992 Handle<Map> copy = | 7004 Handle<Map> copy = |
6993 Copy(handle(isolate->object_function()->initial_map()), "MapCreate"); | 7005 Copy(handle(isolate->object_function()->initial_map()), "MapCreate"); |
6994 | 7006 |
6995 // Check that we do not overflow the instance size when adding the extra | 7007 // Check that we do not overflow the instance size when adding the extra |
6996 // inobject properties. If the instance size overflows, we allocate as many | 7008 // inobject properties. If the instance size overflows, we allocate as many |
6997 // properties as we can as inobject properties. | 7009 // properties as we can as inobject properties. |
(...skipping 18 matching lines...) Expand all Loading... |
7016 | 7028 |
7017 Handle<Map> Map::CopyForFreeze(Handle<Map> map) { | 7029 Handle<Map> Map::CopyForFreeze(Handle<Map> map) { |
7018 int num_descriptors = map->NumberOfOwnDescriptors(); | 7030 int num_descriptors = map->NumberOfOwnDescriptors(); |
7019 Isolate* isolate = map->GetIsolate(); | 7031 Isolate* isolate = map->GetIsolate(); |
7020 Handle<DescriptorArray> new_desc = DescriptorArray::CopyUpToAddAttributes( | 7032 Handle<DescriptorArray> new_desc = DescriptorArray::CopyUpToAddAttributes( |
7021 handle(map->instance_descriptors(), isolate), num_descriptors, FROZEN); | 7033 handle(map->instance_descriptors(), isolate), num_descriptors, FROZEN); |
7022 Handle<LayoutDescriptor> new_layout_descriptor(map->GetLayoutDescriptor(), | 7034 Handle<LayoutDescriptor> new_layout_descriptor(map->GetLayoutDescriptor(), |
7023 isolate); | 7035 isolate); |
7024 Handle<Map> new_map = CopyReplaceDescriptors( | 7036 Handle<Map> new_map = CopyReplaceDescriptors( |
7025 map, new_desc, new_layout_descriptor, INSERT_TRANSITION, | 7037 map, new_desc, new_layout_descriptor, INSERT_TRANSITION, |
7026 isolate->factory()->frozen_symbol(), "CopyForFreeze"); | 7038 isolate->factory()->frozen_symbol(), "CopyForFreeze", SPECIAL_TRANSITION); |
7027 new_map->freeze(); | 7039 new_map->freeze(); |
7028 new_map->set_is_extensible(false); | 7040 new_map->set_is_extensible(false); |
7029 new_map->set_elements_kind(DICTIONARY_ELEMENTS); | 7041 new_map->set_elements_kind(DICTIONARY_ELEMENTS); |
7030 return new_map; | 7042 return new_map; |
7031 } | 7043 } |
7032 | 7044 |
7033 | 7045 |
7034 bool DescriptorArray::CanHoldValue(int descriptor, Object* value) { | 7046 bool DescriptorArray::CanHoldValue(int descriptor, Object* value) { |
7035 PropertyDetails details = GetDetails(descriptor); | 7047 PropertyDetails details = GetDetails(descriptor); |
7036 switch (details.type()) { | 7048 switch (details.type()) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7076 Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name, | 7088 Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name, |
7077 Handle<Object> value, | 7089 Handle<Object> value, |
7078 PropertyAttributes attributes, | 7090 PropertyAttributes attributes, |
7079 StoreFromKeyed store_mode) { | 7091 StoreFromKeyed store_mode) { |
7080 // Dictionary maps can always have additional data properties. | 7092 // Dictionary maps can always have additional data properties. |
7081 if (map->is_dictionary_map()) return map; | 7093 if (map->is_dictionary_map()) return map; |
7082 | 7094 |
7083 // Migrate to the newest map before storing the property. | 7095 // Migrate to the newest map before storing the property. |
7084 map = Update(map); | 7096 map = Update(map); |
7085 | 7097 |
7086 int index = map->SearchTransition(*name); | 7098 int index = map->SearchTransition(FIELD, *name, attributes); |
7087 if (index != TransitionArray::kNotFound) { | 7099 if (index != TransitionArray::kNotFound) { |
7088 Handle<Map> transition(map->GetTransition(index)); | 7100 Handle<Map> transition(map->GetTransition(index)); |
7089 int descriptor = transition->LastAdded(); | 7101 int descriptor = transition->LastAdded(); |
7090 | 7102 |
7091 // TODO(verwaest): Handle attributes better. | 7103 DCHECK_EQ(attributes, transition->instance_descriptors() |
7092 DescriptorArray* descriptors = transition->instance_descriptors(); | 7104 ->GetDetails(descriptor) |
7093 if (descriptors->GetDetails(descriptor).attributes() != attributes) { | 7105 .attributes()); |
7094 return Map::Normalize(map, CLEAR_INOBJECT_PROPERTIES, | |
7095 "IncompatibleAttributes"); | |
7096 } | |
7097 | 7106 |
7098 return Map::PrepareForDataProperty(transition, descriptor, value); | 7107 return Map::PrepareForDataProperty(transition, descriptor, value); |
7099 } | 7108 } |
7100 | 7109 |
7101 TransitionFlag flag = INSERT_TRANSITION; | 7110 TransitionFlag flag = INSERT_TRANSITION; |
7102 MaybeHandle<Map> maybe_map; | 7111 MaybeHandle<Map> maybe_map; |
7103 if (value->IsJSFunction()) { | 7112 if (value->IsJSFunction()) { |
7104 maybe_map = Map::CopyWithConstant(map, name, value, attributes, flag); | 7113 maybe_map = Map::CopyWithConstant(map, name, value, attributes, flag); |
7105 } else if (!map->TooManyFastProperties(store_mode)) { | 7114 } else if (!map->TooManyFastProperties(store_mode)) { |
7106 Isolate* isolate = name->GetIsolate(); | 7115 Isolate* isolate = name->GetIsolate(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7156 return map; | 7165 return map; |
7157 } | 7166 } |
7158 | 7167 |
7159 // Migrate to the newest map before transitioning to the new property. | 7168 // Migrate to the newest map before transitioning to the new property. |
7160 map = Update(map); | 7169 map = Update(map); |
7161 | 7170 |
7162 PropertyNormalizationMode mode = map->is_prototype_map() | 7171 PropertyNormalizationMode mode = map->is_prototype_map() |
7163 ? KEEP_INOBJECT_PROPERTIES | 7172 ? KEEP_INOBJECT_PROPERTIES |
7164 : CLEAR_INOBJECT_PROPERTIES; | 7173 : CLEAR_INOBJECT_PROPERTIES; |
7165 | 7174 |
7166 int index = map->SearchTransition(*name); | 7175 int index = map->SearchTransition(CALLBACKS, *name, attributes); |
7167 if (index != TransitionArray::kNotFound) { | 7176 if (index != TransitionArray::kNotFound) { |
7168 Handle<Map> transition(map->GetTransition(index)); | 7177 Handle<Map> transition(map->GetTransition(index)); |
7169 DescriptorArray* descriptors = transition->instance_descriptors(); | 7178 DescriptorArray* descriptors = transition->instance_descriptors(); |
7170 // Fast path, assume that we're modifying the last added descriptor. | |
7171 int descriptor = transition->LastAdded(); | 7179 int descriptor = transition->LastAdded(); |
7172 if (descriptors->GetKey(descriptor) != *name) { | 7180 DCHECK(descriptors->GetKey(descriptor)->Equals(*name)); |
7173 // If not, search for the descriptor. | |
7174 descriptor = descriptors->SearchWithCache(*name, *transition); | |
7175 } | |
7176 | 7181 |
7177 if (descriptors->GetDetails(descriptor).type() != CALLBACKS) { | 7182 DCHECK_EQ(CALLBACKS, descriptors->GetDetails(descriptor).type()); |
7178 return Map::Normalize(map, mode, "TransitionToAccessorFromNonPair"); | 7183 DCHECK_EQ(attributes, descriptors->GetDetails(descriptor).attributes()); |
7179 } | |
7180 | |
7181 // TODO(verwaest): Handle attributes better. | |
7182 if (descriptors->GetDetails(descriptor).attributes() != attributes) { | |
7183 return Map::Normalize(map, mode, | |
7184 "TransitionToAccessorDifferentAttributes"); | |
7185 } | |
7186 | 7184 |
7187 Handle<Object> maybe_pair(descriptors->GetValue(descriptor), isolate); | 7185 Handle<Object> maybe_pair(descriptors->GetValue(descriptor), isolate); |
7188 if (!maybe_pair->IsAccessorPair()) { | 7186 if (!maybe_pair->IsAccessorPair()) { |
7189 return Map::Normalize(map, mode, "TransitionToAccessorFromNonPair"); | 7187 return Map::Normalize(map, mode, "TransitionToAccessorFromNonPair"); |
7190 } | 7188 } |
7191 | 7189 |
7192 Handle<AccessorPair> pair = Handle<AccessorPair>::cast(maybe_pair); | 7190 Handle<AccessorPair> pair = Handle<AccessorPair>::cast(maybe_pair); |
7193 if (pair->get(component) != *accessor) { | 7191 if (pair->get(component) != *accessor) { |
7194 return Map::Normalize(map, mode, "TransitionToDifferentAccessor"); | 7192 return Map::Normalize(map, mode, "TransitionToDifferentAccessor"); |
7195 } | 7193 } |
7196 | 7194 |
7197 return transition; | 7195 return transition; |
7198 } | 7196 } |
7199 | 7197 |
7200 Handle<AccessorPair> pair; | 7198 Handle<AccessorPair> pair; |
7201 DescriptorArray* old_descriptors = map->instance_descriptors(); | 7199 DescriptorArray* old_descriptors = map->instance_descriptors(); |
7202 int descriptor = old_descriptors->SearchWithCache(*name, *map); | 7200 int descriptor = old_descriptors->SearchWithCache(*name, *map); |
7203 if (descriptor != DescriptorArray::kNotFound) { | 7201 if (descriptor != DescriptorArray::kNotFound) { |
| 7202 if (descriptor != map->LastAdded()) { |
| 7203 return Map::Normalize(map, mode, "AccessorsOverwritingNonLast"); |
| 7204 } |
7204 PropertyDetails old_details = old_descriptors->GetDetails(descriptor); | 7205 PropertyDetails old_details = old_descriptors->GetDetails(descriptor); |
7205 if (old_details.type() != CALLBACKS) { | 7206 if (old_details.type() != CALLBACKS) { |
7206 return Map::Normalize(map, mode, "AccessorsOverwritingNonAccessors"); | 7207 return Map::Normalize(map, mode, "AccessorsOverwritingNonAccessors"); |
7207 } | 7208 } |
7208 | 7209 |
7209 if (old_details.attributes() != attributes) { | 7210 if (old_details.attributes() != attributes) { |
7210 return Map::Normalize(map, mode, "AccessorsWithAttributes"); | 7211 return Map::Normalize(map, mode, "AccessorsWithAttributes"); |
7211 } | 7212 } |
7212 | 7213 |
7213 Handle<Object> maybe_pair(old_descriptors->GetValue(descriptor), isolate); | 7214 Handle<Object> maybe_pair(old_descriptors->GetValue(descriptor), isolate); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7255 descriptors, map->NumberOfOwnDescriptors(), 1); | 7256 descriptors, map->NumberOfOwnDescriptors(), 1); |
7256 new_descriptors->Append(descriptor); | 7257 new_descriptors->Append(descriptor); |
7257 | 7258 |
7258 Handle<LayoutDescriptor> new_layout_descriptor = | 7259 Handle<LayoutDescriptor> new_layout_descriptor = |
7259 FLAG_unbox_double_fields | 7260 FLAG_unbox_double_fields |
7260 ? LayoutDescriptor::Append(map, descriptor->GetDetails()) | 7261 ? LayoutDescriptor::Append(map, descriptor->GetDetails()) |
7261 : handle(LayoutDescriptor::FastPointerLayout(), map->GetIsolate()); | 7262 : handle(LayoutDescriptor::FastPointerLayout(), map->GetIsolate()); |
7262 | 7263 |
7263 return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor, | 7264 return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor, |
7264 flag, descriptor->GetKey(), "CopyAddDescriptor", | 7265 flag, descriptor->GetKey(), "CopyAddDescriptor", |
7265 SIMPLE_TRANSITION); | 7266 SIMPLE_PROPERTY_TRANSITION); |
7266 } | 7267 } |
7267 | 7268 |
7268 | 7269 |
7269 Handle<Map> Map::CopyInsertDescriptor(Handle<Map> map, | 7270 Handle<Map> Map::CopyInsertDescriptor(Handle<Map> map, |
7270 Descriptor* descriptor, | 7271 Descriptor* descriptor, |
7271 TransitionFlag flag) { | 7272 TransitionFlag flag) { |
7272 Handle<DescriptorArray> old_descriptors(map->instance_descriptors()); | 7273 Handle<DescriptorArray> old_descriptors(map->instance_descriptors()); |
7273 | 7274 |
7274 // Ensure the key is unique. | 7275 // Ensure the key is unique. |
7275 descriptor->KeyToUniqueName(); | 7276 descriptor->KeyToUniqueName(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7351 | 7352 |
7352 Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo( | 7353 Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo( |
7353 descriptors, map->NumberOfOwnDescriptors()); | 7354 descriptors, map->NumberOfOwnDescriptors()); |
7354 | 7355 |
7355 new_descriptors->Replace(insertion_index, descriptor); | 7356 new_descriptors->Replace(insertion_index, descriptor); |
7356 Handle<LayoutDescriptor> new_layout_descriptor = LayoutDescriptor::New( | 7357 Handle<LayoutDescriptor> new_layout_descriptor = LayoutDescriptor::New( |
7357 map, new_descriptors, new_descriptors->number_of_descriptors()); | 7358 map, new_descriptors, new_descriptors->number_of_descriptors()); |
7358 | 7359 |
7359 SimpleTransitionFlag simple_flag = | 7360 SimpleTransitionFlag simple_flag = |
7360 (insertion_index == descriptors->number_of_descriptors() - 1) | 7361 (insertion_index == descriptors->number_of_descriptors() - 1) |
7361 ? SIMPLE_TRANSITION | 7362 ? SIMPLE_PROPERTY_TRANSITION |
7362 : FULL_TRANSITION; | 7363 : PROPERTY_TRANSITION; |
7363 return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor, | 7364 return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor, |
7364 flag, key, "CopyReplaceDescriptor", | 7365 flag, key, "CopyReplaceDescriptor", |
7365 simple_flag); | 7366 simple_flag); |
7366 } | 7367 } |
7367 | 7368 |
7368 | 7369 |
7369 void Map::UpdateCodeCache(Handle<Map> map, | 7370 void Map::UpdateCodeCache(Handle<Map> map, |
7370 Handle<Name> name, | 7371 Handle<Name> name, |
7371 Handle<Code> code) { | 7372 Handle<Code> code) { |
7372 Isolate* isolate = map->GetIsolate(); | 7373 Isolate* isolate = map->GetIsolate(); |
(...skipping 9521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16894 Handle<DependentCode> codes = | 16895 Handle<DependentCode> codes = |
16895 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16896 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16896 DependentCode::kPropertyCellChangedGroup, | 16897 DependentCode::kPropertyCellChangedGroup, |
16897 info->object_wrapper()); | 16898 info->object_wrapper()); |
16898 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16899 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16899 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16900 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16900 cell, info->zone()); | 16901 cell, info->zone()); |
16901 } | 16902 } |
16902 | 16903 |
16903 } } // namespace v8::internal | 16904 } } // namespace v8::internal |
OLD | NEW |