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

Side by Side Diff: src/objects.cc

Issue 711313002: Reland "In-object double fields unboxing (for 64-bit only)." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: The fix Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.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 <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 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> new_map) { 1946 void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> new_map) {
1947 if (object->map() == *new_map) return; 1947 if (object->map() == *new_map) return;
1948 if (object->HasFastProperties()) { 1948 if (object->HasFastProperties()) {
1949 if (!new_map->is_dictionary_map()) { 1949 if (!new_map->is_dictionary_map()) {
1950 Handle<Map> old_map(object->map()); 1950 Handle<Map> old_map(object->map());
1951 MigrateFastToFast(object, new_map); 1951 MigrateFastToFast(object, new_map);
1952 if (old_map->is_prototype_map()) { 1952 if (old_map->is_prototype_map()) {
1953 // Clear out the old descriptor array to avoid problems to sharing 1953 // Clear out the old descriptor array to avoid problems to sharing
1954 // the descriptor array without using an explicit. 1954 // the descriptor array without using an explicit.
1955 old_map->InitializeDescriptors( 1955 old_map->InitializeDescriptors(
1956 old_map->GetHeap()->empty_descriptor_array()); 1956 old_map->GetHeap()->empty_descriptor_array(),
1957 LayoutDescriptor::FastPointerLayout());
1957 // Ensure that no transition was inserted for prototype migrations. 1958 // Ensure that no transition was inserted for prototype migrations.
1958 DCHECK(!old_map->HasTransitionArray()); 1959 DCHECK(!old_map->HasTransitionArray());
1959 DCHECK(new_map->GetBackPointer()->IsUndefined()); 1960 DCHECK(new_map->GetBackPointer()->IsUndefined());
1960 } 1961 }
1961 } else { 1962 } else {
1962 MigrateFastToSlow(object, new_map, 0); 1963 MigrateFastToSlow(object, new_map, 0);
1963 } 1964 }
1964 } else { 1965 } else {
1965 // For slow-to-fast migrations JSObject::TransformToFastProperties() 1966 // For slow-to-fast migrations JSObject::TransformToFastProperties()
1966 // must be used instead. 1967 // must be used instead.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2005 2006
2006 int total_size = number_of_fields + unused; 2007 int total_size = number_of_fields + unused;
2007 int external = total_size - inobject; 2008 int external = total_size - inobject;
2008 2009
2009 if (number_of_fields != old_number_of_fields && 2010 if (number_of_fields != old_number_of_fields &&
2010 new_map->GetBackPointer() == *old_map) { 2011 new_map->GetBackPointer() == *old_map) {
2011 PropertyDetails details = new_map->GetLastDescriptorDetails(); 2012 PropertyDetails details = new_map->GetLastDescriptorDetails();
2012 2013
2013 if (old_map->unused_property_fields() > 0) { 2014 if (old_map->unused_property_fields() > 0) {
2014 if (details.representation().IsDouble()) { 2015 if (details.representation().IsDouble()) {
2015 Handle<Object> value = isolate->factory()->NewHeapNumber(0, MUTABLE);
2016 FieldIndex index = 2016 FieldIndex index =
2017 FieldIndex::ForDescriptor(*new_map, new_map->LastAdded()); 2017 FieldIndex::ForDescriptor(*new_map, new_map->LastAdded());
2018 object->FastPropertyAtPut(index, *value); 2018 if (new_map->IsUnboxedDoubleField(index)) {
2019 object->RawFastDoublePropertyAtPut(index, 0);
2020 } else {
2021 Handle<Object> value = isolate->factory()->NewHeapNumber(0, MUTABLE);
2022 object->RawFastPropertyAtPut(index, *value);
2023 }
2019 } 2024 }
2020 object->synchronized_set_map(*new_map); 2025 object->synchronized_set_map(*new_map);
2021 return; 2026 return;
2022 } 2027 }
2023 2028
2024 DCHECK(number_of_fields == old_number_of_fields + 1); 2029 DCHECK(number_of_fields == old_number_of_fields + 1);
2025 // This migration is a transition from a map that has run out of property 2030 // This migration is a transition from a map that has run out of property
2026 // space. Therefore it could be done by extending the backing store. 2031 // space. Therefore it could be done by extending the backing store.
2027 Handle<FixedArray> old_storage = handle(object->properties(), isolate); 2032 Handle<FixedArray> old_storage = handle(object->properties(), isolate);
2028 Handle<FixedArray> new_storage = 2033 Handle<FixedArray> new_storage =
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 DCHECK(old_nof <= new_nof); 2065 DCHECK(old_nof <= new_nof);
2061 2066
2062 for (int i = 0; i < old_nof; i++) { 2067 for (int i = 0; i < old_nof; i++) {
2063 PropertyDetails details = new_descriptors->GetDetails(i); 2068 PropertyDetails details = new_descriptors->GetDetails(i);
2064 if (details.type() != FIELD) continue; 2069 if (details.type() != FIELD) continue;
2065 PropertyDetails old_details = old_descriptors->GetDetails(i); 2070 PropertyDetails old_details = old_descriptors->GetDetails(i);
2066 if (old_details.type() == CALLBACKS) { 2071 if (old_details.type() == CALLBACKS) {
2067 DCHECK(details.representation().IsTagged()); 2072 DCHECK(details.representation().IsTagged());
2068 continue; 2073 continue;
2069 } 2074 }
2075 Representation old_representation = old_details.representation();
2076 Representation representation = details.representation();
2070 DCHECK(old_details.type() == CONSTANT || 2077 DCHECK(old_details.type() == CONSTANT ||
2071 old_details.type() == FIELD); 2078 old_details.type() == FIELD);
2072 Object* raw_value = old_details.type() == CONSTANT 2079 Handle<Object> value;
2073 ? old_descriptors->GetValue(i) 2080 if (old_details.type() == CONSTANT) {
2074 : object->RawFastPropertyAt(FieldIndex::ForDescriptor(*old_map, i)); 2081 value = handle(old_descriptors->GetValue(i), isolate);
2075 Handle<Object> value(raw_value, isolate); 2082 DCHECK(!old_representation.IsDouble() && !representation.IsDouble());
2076 if (!old_details.representation().IsDouble() && 2083 } else {
2077 details.representation().IsDouble()) { 2084 FieldIndex index = FieldIndex::ForDescriptor(*old_map, i);
2078 if (old_details.representation().IsNone()) { 2085 if (object->IsUnboxedDoubleField(index)) {
2079 value = handle(Smi::FromInt(0), isolate); 2086 double old = object->RawFastDoublePropertyAt(index);
2087 value = isolate->factory()->NewHeapNumber(
2088 old, representation.IsDouble() ? MUTABLE : IMMUTABLE);
2089
2090 } else {
2091 value = handle(object->RawFastPropertyAt(index), isolate);
2092 if (!old_representation.IsDouble() && representation.IsDouble()) {
2093 if (old_representation.IsNone()) {
2094 value = handle(Smi::FromInt(0), isolate);
2095 }
2096 value = Object::NewStorageFor(isolate, value, representation);
2097 } else if (old_representation.IsDouble() &&
2098 !representation.IsDouble()) {
2099 value = Object::WrapForRead(isolate, value, old_representation);
2100 }
2080 } 2101 }
2081 value = Object::NewStorageFor(isolate, value, details.representation());
2082 } else if (old_details.representation().IsDouble() &&
2083 !details.representation().IsDouble()) {
2084 value = Object::WrapForRead(isolate, value, old_details.representation());
2085 } 2102 }
2086 DCHECK(!(details.representation().IsDouble() && value->IsSmi())); 2103 DCHECK(!(representation.IsDouble() && value->IsSmi()));
2087 int target_index = new_descriptors->GetFieldIndex(i) - inobject; 2104 int target_index = new_descriptors->GetFieldIndex(i) - inobject;
2088 if (target_index < 0) target_index += total_size; 2105 if (target_index < 0) target_index += total_size;
2089 array->set(target_index, *value); 2106 array->set(target_index, *value);
2090 } 2107 }
2091 2108
2092 for (int i = old_nof; i < new_nof; i++) { 2109 for (int i = old_nof; i < new_nof; i++) {
2093 PropertyDetails details = new_descriptors->GetDetails(i); 2110 PropertyDetails details = new_descriptors->GetDetails(i);
2094 if (details.type() != FIELD) continue; 2111 if (details.type() != FIELD) continue;
2095 Handle<Object> value; 2112 Handle<Object> value;
2096 if (details.representation().IsDouble()) { 2113 if (details.representation().IsDouble()) {
2097 value = isolate->factory()->NewHeapNumber(0, MUTABLE); 2114 value = isolate->factory()->NewHeapNumber(0, MUTABLE);
2098 } else { 2115 } else {
2099 value = isolate->factory()->uninitialized_value(); 2116 value = isolate->factory()->uninitialized_value();
2100 } 2117 }
2101 int target_index = new_descriptors->GetFieldIndex(i) - inobject; 2118 int target_index = new_descriptors->GetFieldIndex(i) - inobject;
2102 if (target_index < 0) target_index += total_size; 2119 if (target_index < 0) target_index += total_size;
2103 array->set(target_index, *value); 2120 array->set(target_index, *value);
2104 } 2121 }
2105 2122
2106 // From here on we cannot fail and we shouldn't GC anymore. 2123 // From here on we cannot fail and we shouldn't GC anymore.
2107 DisallowHeapAllocation no_allocation; 2124 DisallowHeapAllocation no_allocation;
2108 2125
2109 // Copy (real) inobject properties. If necessary, stop at number_of_fields to 2126 // Copy (real) inobject properties. If necessary, stop at number_of_fields to
2110 // avoid overwriting |one_pointer_filler_map|. 2127 // avoid overwriting |one_pointer_filler_map|.
2111 int limit = Min(inobject, number_of_fields); 2128 int limit = Min(inobject, number_of_fields);
2112 for (int i = 0; i < limit; i++) { 2129 for (int i = 0; i < limit; i++) {
2113 FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i); 2130 FieldIndex index = FieldIndex::ForPropertyIndex(*new_map, i);
2114 object->FastPropertyAtPut(index, array->get(external + i)); 2131 Object* value = array->get(external + i);
2132 // Can't use JSObject::FastPropertyAtPut() because proper map was not set
2133 // yet.
2134 if (new_map->IsUnboxedDoubleField(index)) {
2135 DCHECK(value->IsMutableHeapNumber());
2136 object->RawFastDoublePropertyAtPut(index,
2137 HeapNumber::cast(value)->value());
2138 } else {
2139 object->RawFastPropertyAtPut(index, value);
2140 }
2115 } 2141 }
2116 2142
2117 Heap* heap = isolate->heap(); 2143 Heap* heap = isolate->heap();
2118 2144
2119 // If there are properties in the new backing store, trim it to the correct 2145 // If there are properties in the new backing store, trim it to the correct
2120 // size and install the backing store into the object. 2146 // size and install the backing store into the object.
2121 if (external > 0) { 2147 if (external > 0) {
2122 heap->RightTrimFixedArray<Heap::FROM_MUTATOR>(*array, inobject); 2148 heap->RightTrimFixedArray<Heap::FROM_MUTATOR>(*array, inobject);
2123 object->set_properties(*array); 2149 object->set_properties(*array);
2124 } 2150 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 GetIsolate(), DependentCode::kTransitionGroup); 2254 GetIsolate(), DependentCode::kTransitionGroup);
2229 NotifyLeafMapLayoutChange(); 2255 NotifyLeafMapLayoutChange();
2230 } 2256 }
2231 2257
2232 2258
2233 // Invalidates a transition target at |key|, and installs |new_descriptors| over 2259 // Invalidates a transition target at |key|, and installs |new_descriptors| over
2234 // the current instance_descriptors to ensure proper sharing of descriptor 2260 // the current instance_descriptors to ensure proper sharing of descriptor
2235 // arrays. 2261 // arrays.
2236 void Map::DeprecateTarget(PropertyType type, Name* key, 2262 void Map::DeprecateTarget(PropertyType type, Name* key,
2237 PropertyAttributes attributes, 2263 PropertyAttributes attributes,
2238 DescriptorArray* new_descriptors) { 2264 DescriptorArray* new_descriptors,
2265 LayoutDescriptor* new_layout_descriptor) {
2239 if (HasTransitionArray()) { 2266 if (HasTransitionArray()) {
2240 TransitionArray* transitions = this->transitions(); 2267 TransitionArray* transitions = this->transitions();
2241 int transition = transitions->Search(type, key, attributes); 2268 int transition = transitions->Search(type, key, attributes);
2242 if (transition != TransitionArray::kNotFound) { 2269 if (transition != TransitionArray::kNotFound) {
2243 transitions->GetTarget(transition)->DeprecateTransitionTree(); 2270 transitions->GetTarget(transition)->DeprecateTransitionTree();
2244 } 2271 }
2245 } 2272 }
2246 2273
2247 // Don't overwrite the empty descriptor array. 2274 // Don't overwrite the empty descriptor array.
2248 if (NumberOfOwnDescriptors() == 0) return; 2275 if (NumberOfOwnDescriptors() == 0) return;
2249 2276
2250 DescriptorArray* to_replace = instance_descriptors(); 2277 DescriptorArray* to_replace = instance_descriptors();
2251 Map* current = this; 2278 Map* current = this;
2252 GetHeap()->incremental_marking()->RecordWrites(to_replace); 2279 GetHeap()->incremental_marking()->RecordWrites(to_replace);
2253 while (current->instance_descriptors() == to_replace) { 2280 while (current->instance_descriptors() == to_replace) {
2254 current->SetEnumLength(kInvalidEnumCacheSentinel); 2281 current->SetEnumLength(kInvalidEnumCacheSentinel);
2255 current->set_instance_descriptors(new_descriptors); 2282 current->UpdateDescriptors(new_descriptors, new_layout_descriptor);
2256 Object* next = current->GetBackPointer(); 2283 Object* next = current->GetBackPointer();
2257 if (next->IsUndefined()) break; 2284 if (next->IsUndefined()) break;
2258 current = Map::cast(next); 2285 current = Map::cast(next);
2259 } 2286 }
2260 2287
2261 set_owns_descriptors(false); 2288 set_owns_descriptors(false);
2262 } 2289 }
2263 2290
2264 2291
2265 Map* Map::FindRootMap() { 2292 Map* Map::FindRootMap() {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 DCHECK(new_descriptors->length() > target_descriptors->length() || 2611 DCHECK(new_descriptors->length() > target_descriptors->length() ||
2585 new_descriptors->NumberOfSlackDescriptors() > 0 || 2612 new_descriptors->NumberOfSlackDescriptors() > 0 ||
2586 new_descriptors->number_of_descriptors() == 2613 new_descriptors->number_of_descriptors() ==
2587 old_descriptors->number_of_descriptors()); 2614 old_descriptors->number_of_descriptors());
2588 DCHECK(new_descriptors->number_of_descriptors() == old_nof); 2615 DCHECK(new_descriptors->number_of_descriptors() == old_nof);
2589 2616
2590 // 0 -> |root_nof| 2617 // 0 -> |root_nof|
2591 int current_offset = 0; 2618 int current_offset = 0;
2592 for (int i = 0; i < root_nof; ++i) { 2619 for (int i = 0; i < root_nof; ++i) {
2593 PropertyDetails old_details = old_descriptors->GetDetails(i); 2620 PropertyDetails old_details = old_descriptors->GetDetails(i);
2594 if (old_details.type() == FIELD) current_offset++; 2621 if (old_details.type() == FIELD) {
2622 current_offset += old_details.field_width_in_words();
2623 }
2595 Descriptor d(handle(old_descriptors->GetKey(i), isolate), 2624 Descriptor d(handle(old_descriptors->GetKey(i), isolate),
2596 handle(old_descriptors->GetValue(i), isolate), 2625 handle(old_descriptors->GetValue(i), isolate),
2597 old_details); 2626 old_details);
2598 new_descriptors->Set(i, &d); 2627 new_descriptors->Set(i, &d);
2599 } 2628 }
2600 2629
2601 // |root_nof| -> |target_nof| 2630 // |root_nof| -> |target_nof|
2602 for (int i = root_nof; i < target_nof; ++i) { 2631 for (int i = root_nof; i < target_nof; ++i) {
2603 Handle<Name> target_key(target_descriptors->GetKey(i), isolate); 2632 Handle<Name> target_key(target_descriptors->GetKey(i), isolate);
2604 PropertyDetails old_details = old_descriptors->GetDetails(i); 2633 PropertyDetails old_details = old_descriptors->GetDetails(i);
(...skipping 17 matching lines...) Expand all
2622 Handle<HeapType> target_field_type = (target_details.type() == FIELD) 2651 Handle<HeapType> target_field_type = (target_details.type() == FIELD)
2623 ? handle(target_descriptors->GetFieldType(i), isolate) 2652 ? handle(target_descriptors->GetFieldType(i), isolate)
2624 : target_descriptors->GetValue(i)->OptimalType( 2653 : target_descriptors->GetValue(i)->OptimalType(
2625 isolate, target_details.representation()); 2654 isolate, target_details.representation());
2626 target_field_type = GeneralizeFieldType( 2655 target_field_type = GeneralizeFieldType(
2627 target_field_type, old_field_type, isolate); 2656 target_field_type, old_field_type, isolate);
2628 if (modify_index == i) { 2657 if (modify_index == i) {
2629 target_field_type = GeneralizeFieldType( 2658 target_field_type = GeneralizeFieldType(
2630 target_field_type, new_field_type, isolate); 2659 target_field_type, new_field_type, isolate);
2631 } 2660 }
2632 FieldDescriptor d(target_key, 2661 FieldDescriptor d(target_key, current_offset, target_field_type,
2633 current_offset++,
2634 target_field_type,
2635 target_details.attributes(), 2662 target_details.attributes(),
2636 target_details.representation()); 2663 target_details.representation());
2664 current_offset += d.GetDetails().field_width_in_words();
2637 new_descriptors->Set(i, &d); 2665 new_descriptors->Set(i, &d);
2638 } else { 2666 } else {
2639 DCHECK_NE(FIELD, target_details.type()); 2667 DCHECK_NE(FIELD, target_details.type());
2640 Descriptor d(target_key, 2668 Descriptor d(target_key,
2641 handle(target_descriptors->GetValue(i), isolate), 2669 handle(target_descriptors->GetValue(i), isolate),
2642 target_details); 2670 target_details);
2643 new_descriptors->Set(i, &d); 2671 new_descriptors->Set(i, &d);
2644 } 2672 }
2645 } 2673 }
2646 2674
2647 // |target_nof| -> |old_nof| 2675 // |target_nof| -> |old_nof|
2648 for (int i = target_nof; i < old_nof; ++i) { 2676 for (int i = target_nof; i < old_nof; ++i) {
2649 PropertyDetails old_details = old_descriptors->GetDetails(i); 2677 PropertyDetails old_details = old_descriptors->GetDetails(i);
2650 Handle<Name> old_key(old_descriptors->GetKey(i), isolate); 2678 Handle<Name> old_key(old_descriptors->GetKey(i), isolate);
2651 if (modify_index == i) { 2679 if (modify_index == i) {
2652 old_details = old_details.CopyWithRepresentation( 2680 old_details = old_details.CopyWithRepresentation(
2653 new_representation.generalize(old_details.representation())); 2681 new_representation.generalize(old_details.representation()));
2654 } 2682 }
2655 if (old_details.type() == FIELD) { 2683 if (old_details.type() == FIELD) {
2656 Handle<HeapType> old_field_type( 2684 Handle<HeapType> old_field_type(
2657 old_descriptors->GetFieldType(i), isolate); 2685 old_descriptors->GetFieldType(i), isolate);
2658 if (modify_index == i) { 2686 if (modify_index == i) {
2659 old_field_type = GeneralizeFieldType( 2687 old_field_type = GeneralizeFieldType(
2660 old_field_type, new_field_type, isolate); 2688 old_field_type, new_field_type, isolate);
2661 } 2689 }
2662 FieldDescriptor d(old_key, 2690 FieldDescriptor d(old_key, current_offset, old_field_type,
2663 current_offset++, 2691 old_details.attributes(), old_details.representation());
2664 old_field_type, 2692 current_offset += d.GetDetails().field_width_in_words();
2665 old_details.attributes(),
2666 old_details.representation());
2667 new_descriptors->Set(i, &d); 2693 new_descriptors->Set(i, &d);
2668 } else { 2694 } else {
2669 DCHECK(old_details.type() == CONSTANT || old_details.type() == CALLBACKS); 2695 DCHECK(old_details.type() == CONSTANT || old_details.type() == CALLBACKS);
2670 if (modify_index == i && store_mode == FORCE_FIELD) { 2696 if (modify_index == i && store_mode == FORCE_FIELD) {
2671 FieldDescriptor d(old_key, 2697 FieldDescriptor d(
2672 current_offset++, 2698 old_key, current_offset,
2673 GeneralizeFieldType( 2699 GeneralizeFieldType(old_descriptors->GetValue(i)->OptimalType(
2674 old_descriptors->GetValue(i)->OptimalType( 2700 isolate, old_details.representation()),
2675 isolate, old_details.representation()), 2701 new_field_type, isolate),
2676 new_field_type, isolate), 2702 old_details.attributes(), old_details.representation());
2677 old_details.attributes(), 2703 current_offset += d.GetDetails().field_width_in_words();
2678 old_details.representation());
2679 new_descriptors->Set(i, &d); 2704 new_descriptors->Set(i, &d);
2680 } else { 2705 } else {
2681 DCHECK_NE(FIELD, old_details.type()); 2706 DCHECK_NE(FIELD, old_details.type());
2682 Descriptor d(old_key, 2707 Descriptor d(old_key,
2683 handle(old_descriptors->GetValue(i), isolate), 2708 handle(old_descriptors->GetValue(i), isolate),
2684 old_details); 2709 old_details);
2685 new_descriptors->Set(i, &d); 2710 new_descriptors->Set(i, &d);
2686 } 2711 }
2687 } 2712 }
2688 } 2713 }
2689 2714
2690 new_descriptors->Sort(); 2715 new_descriptors->Sort();
2691 2716
2692 DCHECK(store_mode != FORCE_FIELD || 2717 DCHECK(store_mode != FORCE_FIELD ||
2693 new_descriptors->GetDetails(modify_index).type() == FIELD); 2718 new_descriptors->GetDetails(modify_index).type() == FIELD);
2694 2719
2695 Handle<Map> split_map(root_map->FindLastMatchMap( 2720 Handle<Map> split_map(root_map->FindLastMatchMap(
2696 root_nof, old_nof, *new_descriptors), isolate); 2721 root_nof, old_nof, *new_descriptors), isolate);
2697 int split_nof = split_map->NumberOfOwnDescriptors(); 2722 int split_nof = split_map->NumberOfOwnDescriptors();
2698 DCHECK_NE(old_nof, split_nof); 2723 DCHECK_NE(old_nof, split_nof);
2699 2724
2725 Handle<LayoutDescriptor> new_layout_descriptor =
2726 LayoutDescriptor::New(split_map, new_descriptors, old_nof);
2700 PropertyDetails split_prop_details = old_descriptors->GetDetails(split_nof); 2727 PropertyDetails split_prop_details = old_descriptors->GetDetails(split_nof);
2701 split_map->DeprecateTarget(split_prop_details.type(), 2728 split_map->DeprecateTarget(split_prop_details.type(),
2702 old_descriptors->GetKey(split_nof), 2729 old_descriptors->GetKey(split_nof),
2703 split_prop_details.attributes(), *new_descriptors); 2730 split_prop_details.attributes(), *new_descriptors,
2731 *new_layout_descriptor);
2704 2732
2705 if (FLAG_trace_generalization) { 2733 if (FLAG_trace_generalization) {
2706 PropertyDetails old_details = old_descriptors->GetDetails(modify_index); 2734 PropertyDetails old_details = old_descriptors->GetDetails(modify_index);
2707 PropertyDetails new_details = new_descriptors->GetDetails(modify_index); 2735 PropertyDetails new_details = new_descriptors->GetDetails(modify_index);
2708 Handle<HeapType> old_field_type = (old_details.type() == FIELD) 2736 Handle<HeapType> old_field_type = (old_details.type() == FIELD)
2709 ? handle(old_descriptors->GetFieldType(modify_index), isolate) 2737 ? handle(old_descriptors->GetFieldType(modify_index), isolate)
2710 : HeapType::Constant(handle(old_descriptors->GetValue(modify_index), 2738 : HeapType::Constant(handle(old_descriptors->GetValue(modify_index),
2711 isolate), isolate); 2739 isolate), isolate);
2712 Handle<HeapType> new_field_type = (new_details.type() == FIELD) 2740 Handle<HeapType> new_field_type = (new_details.type() == FIELD)
2713 ? handle(new_descriptors->GetFieldType(modify_index), isolate) 2741 ? handle(new_descriptors->GetFieldType(modify_index), isolate)
2714 : HeapType::Constant(handle(new_descriptors->GetValue(modify_index), 2742 : HeapType::Constant(handle(new_descriptors->GetValue(modify_index),
2715 isolate), isolate); 2743 isolate), isolate);
2716 old_map->PrintGeneralization( 2744 old_map->PrintGeneralization(
2717 stdout, "", modify_index, split_nof, old_nof, 2745 stdout, "", modify_index, split_nof, old_nof,
2718 old_details.type() == CONSTANT && store_mode == FORCE_FIELD, 2746 old_details.type() == CONSTANT && store_mode == FORCE_FIELD,
2719 old_details.representation(), new_details.representation(), 2747 old_details.representation(), new_details.representation(),
2720 *old_field_type, *new_field_type); 2748 *old_field_type, *new_field_type);
2721 } 2749 }
2722 2750
2723 // Add missing transitions. 2751 // Add missing transitions.
2724 Handle<Map> new_map = split_map; 2752 Handle<Map> new_map = split_map;
2725 for (int i = split_nof; i < old_nof; ++i) { 2753 for (int i = split_nof; i < old_nof; ++i) {
2726 if (!new_map->CanHaveMoreTransitions()) { 2754 if (!new_map->CanHaveMoreTransitions()) {
2727 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, 2755 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode,
2728 "can't have more transitions"); 2756 "can't have more transitions");
2729 } 2757 }
2730 new_map = CopyInstallDescriptors(new_map, i, new_descriptors); 2758 new_map = CopyInstallDescriptors(new_map, i, new_descriptors,
2759 new_layout_descriptor);
2731 } 2760 }
2732 new_map->set_owns_descriptors(true); 2761 new_map->set_owns_descriptors(true);
2733 return new_map; 2762 return new_map;
2734 } 2763 }
2735 2764
2736 2765
2737 // Generalize the representation of all FIELD descriptors. 2766 // Generalize the representation of all FIELD descriptors.
2738 Handle<Map> Map::GeneralizeAllFieldRepresentations( 2767 Handle<Map> Map::GeneralizeAllFieldRepresentations(
2739 Handle<Map> map) { 2768 Handle<Map> map) {
2740 Handle<DescriptorArray> descriptors(map->instance_descriptors()); 2769 Handle<DescriptorArray> descriptors(map->instance_descriptors());
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
3143 // Only supports adding slack to owned descriptors. 3172 // Only supports adding slack to owned descriptors.
3144 DCHECK(map->owns_descriptors()); 3173 DCHECK(map->owns_descriptors());
3145 3174
3146 Handle<DescriptorArray> descriptors(map->instance_descriptors()); 3175 Handle<DescriptorArray> descriptors(map->instance_descriptors());
3147 int old_size = map->NumberOfOwnDescriptors(); 3176 int old_size = map->NumberOfOwnDescriptors();
3148 if (slack <= descriptors->NumberOfSlackDescriptors()) return; 3177 if (slack <= descriptors->NumberOfSlackDescriptors()) return;
3149 3178
3150 Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo( 3179 Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo(
3151 descriptors, old_size, slack); 3180 descriptors, old_size, slack);
3152 3181
3182 DisallowHeapAllocation no_allocation;
3183 // The descriptors are still the same, so keep the layout descriptor.
3184 LayoutDescriptor* layout_descriptor = map->GetLayoutDescriptor();
3185
3153 if (old_size == 0) { 3186 if (old_size == 0) {
3154 map->set_instance_descriptors(*new_descriptors); 3187 map->UpdateDescriptors(*new_descriptors, layout_descriptor);
3155 return; 3188 return;
3156 } 3189 }
3157 3190
3158 // If the source descriptors had an enum cache we copy it. This ensures 3191 // If the source descriptors had an enum cache we copy it. This ensures
3159 // that the maps to which we push the new descriptor array back can rely 3192 // that the maps to which we push the new descriptor array back can rely
3160 // on a cache always being available once it is set. If the map has more 3193 // on a cache always being available once it is set. If the map has more
3161 // enumerated descriptors than available in the original cache, the cache 3194 // enumerated descriptors than available in the original cache, the cache
3162 // will be lazily replaced by the extended cache when needed. 3195 // will be lazily replaced by the extended cache when needed.
3163 if (descriptors->HasEnumCache()) { 3196 if (descriptors->HasEnumCache()) {
3164 new_descriptors->CopyEnumCacheFrom(*descriptors); 3197 new_descriptors->CopyEnumCacheFrom(*descriptors);
3165 } 3198 }
3166 3199
3167 // Replace descriptors by new_descriptors in all maps that share it. 3200 // Replace descriptors by new_descriptors in all maps that share it.
3168 map->GetHeap()->incremental_marking()->RecordWrites(*descriptors); 3201 map->GetHeap()->incremental_marking()->RecordWrites(*descriptors);
3169 3202
3170 Map* walk_map; 3203 Map* walk_map;
3171 for (Object* current = map->GetBackPointer(); 3204 for (Object* current = map->GetBackPointer();
3172 !current->IsUndefined(); 3205 !current->IsUndefined();
3173 current = walk_map->GetBackPointer()) { 3206 current = walk_map->GetBackPointer()) {
3174 walk_map = Map::cast(current); 3207 walk_map = Map::cast(current);
3175 if (walk_map->instance_descriptors() != *descriptors) break; 3208 if (walk_map->instance_descriptors() != *descriptors) break;
3176 walk_map->set_instance_descriptors(*new_descriptors); 3209 walk_map->UpdateDescriptors(*new_descriptors, layout_descriptor);
3177 } 3210 }
3178 3211
3179 map->set_instance_descriptors(*new_descriptors); 3212 map->UpdateDescriptors(*new_descriptors, layout_descriptor);
3180 } 3213 }
3181 3214
3182 3215
3183 template<class T> 3216 template<class T>
3184 static int AppendUniqueCallbacks(NeanderArray* callbacks, 3217 static int AppendUniqueCallbacks(NeanderArray* callbacks,
3185 Handle<typename T::Array> array, 3218 Handle<typename T::Array> array,
3186 int valid_descriptors) { 3219 int valid_descriptors) {
3187 int nof_callbacks = callbacks->length(); 3220 int nof_callbacks = callbacks->length();
3188 3221
3189 Isolate* isolate = array->GetIsolate(); 3222 Isolate* isolate = array->GetIsolate();
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
3843 3876
3844 DescriptorArray* desc = map()->instance_descriptors(); 3877 DescriptorArray* desc = map()->instance_descriptors();
3845 PropertyDetails details = desc->GetDetails(descriptor); 3878 PropertyDetails details = desc->GetDetails(descriptor);
3846 3879
3847 DCHECK(details.type() == FIELD); 3880 DCHECK(details.type() == FIELD);
3848 3881
3849 FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor); 3882 FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor);
3850 if (details.representation().IsDouble()) { 3883 if (details.representation().IsDouble()) {
3851 // Nothing more to be done. 3884 // Nothing more to be done.
3852 if (value->IsUninitialized()) return; 3885 if (value->IsUninitialized()) return;
3853 HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(index)); 3886 if (IsUnboxedDoubleField(index)) {
3854 DCHECK(box->IsMutableHeapNumber()); 3887 RawFastDoublePropertyAtPut(index, value->Number());
3855 box->set_value(value->Number()); 3888 } else {
3889 HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(index));
3890 DCHECK(box->IsMutableHeapNumber());
3891 box->set_value(value->Number());
3892 }
3856 } else { 3893 } else {
3857 FastPropertyAtPut(index, value); 3894 RawFastPropertyAtPut(index, value);
3858 } 3895 }
3859 } 3896 }
3860 3897
3861 3898
3862 void JSObject::AddProperty(Handle<JSObject> object, Handle<Name> name, 3899 void JSObject::AddProperty(Handle<JSObject> object, Handle<Name> name,
3863 Handle<Object> value, 3900 Handle<Object> value,
3864 PropertyAttributes attributes) { 3901 PropertyAttributes attributes) {
3865 LookupIterator it(object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); 3902 LookupIterator it(object, name, LookupIterator::OWN_SKIP_INTERCEPTOR);
3866 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); 3903 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state());
3867 #ifdef DEBUG 3904 #ifdef DEBUG
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
4309 Handle<Name> key(descs->GetKey(i)); 4346 Handle<Name> key(descs->GetKey(i));
4310 Handle<Object> value(descs->GetConstant(i), isolate); 4347 Handle<Object> value(descs->GetConstant(i), isolate);
4311 PropertyDetails d = PropertyDetails( 4348 PropertyDetails d = PropertyDetails(
4312 details.attributes(), NORMAL, i + 1); 4349 details.attributes(), NORMAL, i + 1);
4313 dictionary = NameDictionary::Add(dictionary, key, value, d); 4350 dictionary = NameDictionary::Add(dictionary, key, value, d);
4314 break; 4351 break;
4315 } 4352 }
4316 case FIELD: { 4353 case FIELD: {
4317 Handle<Name> key(descs->GetKey(i)); 4354 Handle<Name> key(descs->GetKey(i));
4318 FieldIndex index = FieldIndex::ForDescriptor(*map, i); 4355 FieldIndex index = FieldIndex::ForDescriptor(*map, i);
4319 Handle<Object> value( 4356 Handle<Object> value;
4320 object->RawFastPropertyAt(index), isolate); 4357 if (object->IsUnboxedDoubleField(index)) {
4321 if (details.representation().IsDouble()) { 4358 double old_value = object->RawFastDoublePropertyAt(index);
4322 DCHECK(value->IsMutableHeapNumber()); 4359 value = isolate->factory()->NewHeapNumber(old_value);
4323 Handle<HeapNumber> old = Handle<HeapNumber>::cast(value); 4360 } else {
4324 value = isolate->factory()->NewHeapNumber(old->value()); 4361 value = handle(object->RawFastPropertyAt(index), isolate);
4362 if (details.representation().IsDouble()) {
4363 DCHECK(value->IsMutableHeapNumber());
4364 Handle<HeapNumber> old = Handle<HeapNumber>::cast(value);
4365 value = isolate->factory()->NewHeapNumber(old->value());
4366 }
4325 } 4367 }
4326 PropertyDetails d = 4368 PropertyDetails d =
4327 PropertyDetails(details.attributes(), NORMAL, i + 1); 4369 PropertyDetails(details.attributes(), NORMAL, i + 1);
4328 dictionary = NameDictionary::Add(dictionary, key, value, d); 4370 dictionary = NameDictionary::Add(dictionary, key, value, d);
4329 break; 4371 break;
4330 } 4372 }
4331 case CALLBACKS: { 4373 case CALLBACKS: {
4332 Handle<Name> key(descs->GetKey(i)); 4374 Handle<Name> key(descs->GetKey(i));
4333 Handle<Object> value(descs->GetCallbacksObject(i), isolate); 4375 Handle<Object> value(descs->GetCallbacksObject(i), isolate);
4334 PropertyDetails d = PropertyDetails( 4376 PropertyDetails d = PropertyDetails(
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
4484 ConstantDescriptor d(key, handle(value, isolate), details.attributes()); 4526 ConstantDescriptor d(key, handle(value, isolate), details.attributes());
4485 descriptors->Set(enumeration_index - 1, &d); 4527 descriptors->Set(enumeration_index - 1, &d);
4486 } else if (type == NORMAL) { 4528 } else if (type == NORMAL) {
4487 if (current_offset < inobject_props) { 4529 if (current_offset < inobject_props) {
4488 object->InObjectPropertyAtPut(current_offset, value, 4530 object->InObjectPropertyAtPut(current_offset, value,
4489 UPDATE_WRITE_BARRIER); 4531 UPDATE_WRITE_BARRIER);
4490 } else { 4532 } else {
4491 int offset = current_offset - inobject_props; 4533 int offset = current_offset - inobject_props;
4492 fields->set(offset, value); 4534 fields->set(offset, value);
4493 } 4535 }
4494 FieldDescriptor d(key, current_offset++, details.attributes(), 4536 FieldDescriptor d(key, current_offset, details.attributes(),
4495 // TODO(verwaest): value->OptimalRepresentation(); 4537 // TODO(verwaest): value->OptimalRepresentation();
4496 Representation::Tagged()); 4538 Representation::Tagged());
4539 current_offset += d.GetDetails().field_width_in_words();
4497 descriptors->Set(enumeration_index - 1, &d); 4540 descriptors->Set(enumeration_index - 1, &d);
4498 } else if (type == CALLBACKS) { 4541 } else if (type == CALLBACKS) {
4499 CallbacksDescriptor d(key, handle(value, isolate), details.attributes()); 4542 CallbacksDescriptor d(key, handle(value, isolate), details.attributes());
4500 descriptors->Set(enumeration_index - 1, &d); 4543 descriptors->Set(enumeration_index - 1, &d);
4501 } else { 4544 } else {
4502 UNREACHABLE(); 4545 UNREACHABLE();
4503 } 4546 }
4504 } 4547 }
4505 DCHECK(current_offset == number_of_fields); 4548 DCHECK(current_offset == number_of_fields);
4506 4549
4507 descriptors->Sort(); 4550 descriptors->Sort();
4508 4551
4552 Handle<LayoutDescriptor> layout_descriptor = LayoutDescriptor::New(
4553 new_map, descriptors, descriptors->number_of_descriptors());
4554
4509 DisallowHeapAllocation no_gc; 4555 DisallowHeapAllocation no_gc;
4510 new_map->InitializeDescriptors(*descriptors); 4556 new_map->InitializeDescriptors(*descriptors, *layout_descriptor);
4511 new_map->set_unused_property_fields(unused_property_fields); 4557 new_map->set_unused_property_fields(unused_property_fields);
4512 4558
4513 // Transform the object. 4559 // Transform the object.
4514 object->synchronized_set_map(*new_map); 4560 object->synchronized_set_map(*new_map);
4515 4561
4516 object->set_properties(*fields); 4562 object->set_properties(*fields);
4517 DCHECK(object->IsJSObject()); 4563 DCHECK(object->IsJSObject());
4518 4564
4519 // Check that it really works. 4565 // Check that it really works.
4520 DCHECK(object->HasFastProperties()); 4566 DCHECK(object->HasFastProperties());
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
5471 new_map->set_is_observed(); 5517 new_map->set_is_observed();
5472 } 5518 }
5473 JSObject::MigrateToMap(object, new_map); 5519 JSObject::MigrateToMap(object, new_map);
5474 } 5520 }
5475 5521
5476 5522
5477 Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object, 5523 Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object,
5478 Representation representation, 5524 Representation representation,
5479 FieldIndex index) { 5525 FieldIndex index) {
5480 Isolate* isolate = object->GetIsolate(); 5526 Isolate* isolate = object->GetIsolate();
5527 if (object->IsUnboxedDoubleField(index)) {
5528 double value = object->RawFastDoublePropertyAt(index);
5529 return isolate->factory()->NewHeapNumber(value);
5530 }
5481 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate); 5531 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate);
5482 return Object::WrapForRead(isolate, raw_value, representation); 5532 return Object::WrapForRead(isolate, raw_value, representation);
5483 } 5533 }
5484 5534
5485 5535
5486 template<class ContextObject> 5536 template<class ContextObject>
5487 class JSObjectWalkVisitor { 5537 class JSObjectWalkVisitor {
5488 public: 5538 public:
5489 JSObjectWalkVisitor(ContextObject* site_context, bool copying, 5539 JSObjectWalkVisitor(ContextObject* site_context, bool copying,
5490 JSObject::DeepCopyHints hints) 5540 JSObject::DeepCopyHints hints)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
5561 HandleScope scope(isolate); 5611 HandleScope scope(isolate);
5562 5612
5563 // Deep copy own properties. 5613 // Deep copy own properties.
5564 if (copy->HasFastProperties()) { 5614 if (copy->HasFastProperties()) {
5565 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors()); 5615 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors());
5566 int limit = copy->map()->NumberOfOwnDescriptors(); 5616 int limit = copy->map()->NumberOfOwnDescriptors();
5567 for (int i = 0; i < limit; i++) { 5617 for (int i = 0; i < limit; i++) {
5568 PropertyDetails details = descriptors->GetDetails(i); 5618 PropertyDetails details = descriptors->GetDetails(i);
5569 if (details.type() != FIELD) continue; 5619 if (details.type() != FIELD) continue;
5570 FieldIndex index = FieldIndex::ForDescriptor(copy->map(), i); 5620 FieldIndex index = FieldIndex::ForDescriptor(copy->map(), i);
5571 Handle<Object> value(object->RawFastPropertyAt(index), isolate); 5621 if (object->IsUnboxedDoubleField(index)) {
5572 if (value->IsJSObject()) { 5622 if (copying) {
5573 ASSIGN_RETURN_ON_EXCEPTION( 5623 double value = object->RawFastDoublePropertyAt(index);
5574 isolate, value, 5624 copy->RawFastDoublePropertyAtPut(index, value);
5575 VisitElementOrProperty(copy, Handle<JSObject>::cast(value)), 5625 }
5576 JSObject);
5577 } else { 5626 } else {
5578 Representation representation = details.representation(); 5627 Handle<Object> value(object->RawFastPropertyAt(index), isolate);
5579 value = Object::NewStorageFor(isolate, value, representation); 5628 if (value->IsJSObject()) {
5580 } 5629 ASSIGN_RETURN_ON_EXCEPTION(
5581 if (copying) { 5630 isolate, value,
5582 copy->FastPropertyAtPut(index, *value); 5631 VisitElementOrProperty(copy, Handle<JSObject>::cast(value)),
5632 JSObject);
5633 if (copying) {
5634 copy->FastPropertyAtPut(index, *value);
5635 }
5636 } else {
5637 if (copying) {
5638 Representation representation = details.representation();
5639 value = Object::NewStorageFor(isolate, value, representation);
5640 copy->FastPropertyAtPut(index, *value);
5641 }
5642 }
5583 } 5643 }
5584 } 5644 }
5585 } else { 5645 } else {
5586 Handle<FixedArray> names = 5646 Handle<FixedArray> names =
5587 isolate->factory()->NewFixedArray(copy->NumberOfOwnProperties()); 5647 isolate->factory()->NewFixedArray(copy->NumberOfOwnProperties());
5588 copy->GetOwnPropertyNames(*names, 0); 5648 copy->GetOwnPropertyNames(*names, 0);
5589 for (int i = 0; i < names->length(); i++) { 5649 for (int i = 0; i < names->length(); i++) {
5590 DCHECK(names->get(i)->IsString()); 5650 DCHECK(names->get(i)->IsString());
5591 Handle<String> key_string(String::cast(names->get(i))); 5651 Handle<String> key_string(String::cast(names->get(i)));
5592 Maybe<PropertyAttributes> maybe = 5652 Maybe<PropertyAttributes> maybe =
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
5769 if ((descs->GetDetails(i).attributes() & filter) == 0 && 5829 if ((descs->GetDetails(i).attributes() & filter) == 0 &&
5770 !FilterKey(descs->GetKey(i), filter)) { 5830 !FilterKey(descs->GetKey(i), filter)) {
5771 result++; 5831 result++;
5772 } 5832 }
5773 } 5833 }
5774 return result; 5834 return result;
5775 } 5835 }
5776 5836
5777 5837
5778 int Map::NextFreePropertyIndex() { 5838 int Map::NextFreePropertyIndex() {
5779 int max_index = -1; 5839 int free_index = 0;
5780 int number_of_own_descriptors = NumberOfOwnDescriptors(); 5840 int number_of_own_descriptors = NumberOfOwnDescriptors();
5781 DescriptorArray* descs = instance_descriptors(); 5841 DescriptorArray* descs = instance_descriptors();
5782 for (int i = 0; i < number_of_own_descriptors; i++) { 5842 for (int i = 0; i < number_of_own_descriptors; i++) {
5783 if (descs->GetType(i) == FIELD) { 5843 PropertyDetails details = descs->GetDetails(i);
5784 int current_index = descs->GetFieldIndex(i); 5844 if (details.type() == FIELD) {
5785 if (current_index > max_index) max_index = current_index; 5845 int candidate = details.field_index() + details.field_width_in_words();
5846 if (candidate > free_index) free_index = candidate;
5786 } 5847 }
5787 } 5848 }
5788 return max_index + 1; 5849 return free_index;
5789 } 5850 }
5790 5851
5791 5852
5792 static bool ContainsOnlyValidKeys(Handle<FixedArray> array) { 5853 static bool ContainsOnlyValidKeys(Handle<FixedArray> array) {
5793 int len = array->length(); 5854 int len = array->length();
5794 for (int i = 0; i < len; i++) { 5855 for (int i = 0; i < len; i++) {
5795 Object* e = array->get(i); 5856 Object* e = array->get(i);
5796 if (!(e->IsString() || e->IsNumber())) return false; 5857 if (!(e->IsString() || e->IsNumber())) return false;
5797 } 5858 }
5798 return true; 5859 return true;
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
6463 } 6524 }
6464 } 6525 }
6465 return isolate->factory()->undefined_value(); 6526 return isolate->factory()->undefined_value();
6466 } 6527 }
6467 6528
6468 6529
6469 Object* JSObject::SlowReverseLookup(Object* value) { 6530 Object* JSObject::SlowReverseLookup(Object* value) {
6470 if (HasFastProperties()) { 6531 if (HasFastProperties()) {
6471 int number_of_own_descriptors = map()->NumberOfOwnDescriptors(); 6532 int number_of_own_descriptors = map()->NumberOfOwnDescriptors();
6472 DescriptorArray* descs = map()->instance_descriptors(); 6533 DescriptorArray* descs = map()->instance_descriptors();
6534 bool value_is_number = value->IsNumber();
6473 for (int i = 0; i < number_of_own_descriptors; i++) { 6535 for (int i = 0; i < number_of_own_descriptors; i++) {
6474 if (descs->GetType(i) == FIELD) { 6536 if (descs->GetType(i) == FIELD) {
6475 Object* property = 6537 FieldIndex field_index = FieldIndex::ForDescriptor(map(), i);
6476 RawFastPropertyAt(FieldIndex::ForDescriptor(map(), i)); 6538 if (IsUnboxedDoubleField(field_index)) {
6477 if (descs->GetDetails(i).representation().IsDouble()) { 6539 if (value_is_number) {
6478 DCHECK(property->IsMutableHeapNumber()); 6540 double property = RawFastDoublePropertyAt(field_index);
6479 if (value->IsNumber() && property->Number() == value->Number()) { 6541 if (property == value->Number()) {
6542 return descs->GetKey(i);
6543 }
6544 }
6545 } else {
6546 Object* property = RawFastPropertyAt(field_index);
6547 if (field_index.is_double()) {
6548 DCHECK(property->IsMutableHeapNumber());
6549 if (value_is_number && property->Number() == value->Number()) {
6550 return descs->GetKey(i);
6551 }
6552 } else if (property == value) {
6480 return descs->GetKey(i); 6553 return descs->GetKey(i);
6481 } 6554 }
6482 } else if (property == value) {
6483 return descs->GetKey(i);
6484 } 6555 }
6485 } else if (descs->GetType(i) == CONSTANT) { 6556 } else if (descs->GetType(i) == CONSTANT) {
6486 if (descs->GetConstant(i) == value) { 6557 if (descs->GetConstant(i) == value) {
6487 return descs->GetKey(i); 6558 return descs->GetKey(i);
6488 } 6559 }
6489 } 6560 }
6490 } 6561 }
6491 return GetHeap()->undefined_value(); 6562 return GetHeap()->undefined_value();
6492 } else { 6563 } else {
6493 return property_dictionary()->SlowReverseLookup(value); 6564 return property_dictionary()->SlowReverseLookup(value);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
6627 int old_size = descriptors->number_of_descriptors(); 6698 int old_size = descriptors->number_of_descriptors();
6628 if (old_size == 0) { 6699 if (old_size == 0) {
6629 descriptors = DescriptorArray::Allocate(map->GetIsolate(), 0, 1); 6700 descriptors = DescriptorArray::Allocate(map->GetIsolate(), 0, 1);
6630 } else { 6701 } else {
6631 EnsureDescriptorSlack( 6702 EnsureDescriptorSlack(
6632 map, SlackForArraySize(old_size, kMaxNumberOfDescriptors)); 6703 map, SlackForArraySize(old_size, kMaxNumberOfDescriptors));
6633 descriptors = handle(map->instance_descriptors()); 6704 descriptors = handle(map->instance_descriptors());
6634 } 6705 }
6635 } 6706 }
6636 6707
6708 Handle<LayoutDescriptor> layout_descriptor =
6709 FLAG_unbox_double_fields
6710 ? LayoutDescriptor::Append(map, descriptor->GetDetails())
6711 : handle(LayoutDescriptor::FastPointerLayout(), map->GetIsolate());
6712
6637 { 6713 {
6638 DisallowHeapAllocation no_gc; 6714 DisallowHeapAllocation no_gc;
6639 descriptors->Append(descriptor); 6715 descriptors->Append(descriptor);
6640 result->InitializeDescriptors(*descriptors); 6716 result->InitializeDescriptors(*descriptors, *layout_descriptor);
6641 } 6717 }
6642 6718
6643 DCHECK(result->NumberOfOwnDescriptors() == map->NumberOfOwnDescriptors() + 1); 6719 DCHECK(result->NumberOfOwnDescriptors() == map->NumberOfOwnDescriptors() + 1);
6644 ConnectTransition(map, result, name, SIMPLE_PROPERTY_TRANSITION); 6720 ConnectTransition(map, result, name, SIMPLE_PROPERTY_TRANSITION);
6645 6721
6646 return result; 6722 return result;
6647 } 6723 }
6648 6724
6649 6725
6650 #if TRACE_MAPS 6726 #if TRACE_MAPS
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
6690 parent->set_transitions(*transitions); 6766 parent->set_transitions(*transitions);
6691 } 6767 }
6692 child->SetBackPointer(*parent); 6768 child->SetBackPointer(*parent);
6693 #if TRACE_MAPS 6769 #if TRACE_MAPS
6694 Map::TraceTransition("Transition", *parent, *child, *name); 6770 Map::TraceTransition("Transition", *parent, *child, *name);
6695 #endif 6771 #endif
6696 } 6772 }
6697 } 6773 }
6698 6774
6699 6775
6700 Handle<Map> Map::CopyReplaceDescriptors(Handle<Map> map, 6776 Handle<Map> Map::CopyReplaceDescriptors(
6701 Handle<DescriptorArray> descriptors, 6777 Handle<Map> map, Handle<DescriptorArray> descriptors,
6702 TransitionFlag flag, 6778 Handle<LayoutDescriptor> layout_descriptor, TransitionFlag flag,
6703 MaybeHandle<Name> maybe_name, 6779 MaybeHandle<Name> maybe_name, const char* reason,
6704 const char* reason, 6780 SimpleTransitionFlag simple_flag) {
6705 SimpleTransitionFlag simple_flag) {
6706 DCHECK(descriptors->IsSortedNoDuplicates()); 6781 DCHECK(descriptors->IsSortedNoDuplicates());
6707 6782
6708 Handle<Map> result = CopyDropDescriptors(map); 6783 Handle<Map> result = CopyDropDescriptors(map);
6709 result->InitializeDescriptors(*descriptors);
6710 6784
6711 if (!map->is_prototype_map()) { 6785 if (!map->is_prototype_map()) {
6712 if (flag == INSERT_TRANSITION && map->CanHaveMoreTransitions()) { 6786 if (flag == INSERT_TRANSITION && map->CanHaveMoreTransitions()) {
6787 result->InitializeDescriptors(*descriptors, *layout_descriptor);
6788
6713 Handle<Name> name; 6789 Handle<Name> name;
6714 CHECK(maybe_name.ToHandle(&name)); 6790 CHECK(maybe_name.ToHandle(&name));
6715 ConnectTransition(map, result, name, simple_flag); 6791 ConnectTransition(map, result, name, simple_flag);
6716 } else { 6792 } else {
6717 int length = descriptors->number_of_descriptors(); 6793 int length = descriptors->number_of_descriptors();
6718 for (int i = 0; i < length; i++) { 6794 for (int i = 0; i < length; i++) {
6719 descriptors->SetRepresentation(i, Representation::Tagged()); 6795 descriptors->SetRepresentation(i, Representation::Tagged());
6720 if (descriptors->GetDetails(i).type() == FIELD) { 6796 if (descriptors->GetDetails(i).type() == FIELD) {
6721 descriptors->SetValue(i, HeapType::Any()); 6797 descriptors->SetValue(i, HeapType::Any());
6722 } 6798 }
6723 } 6799 }
6800 result->InitializeDescriptors(*descriptors,
6801 LayoutDescriptor::FastPointerLayout());
6724 } 6802 }
6803 } else {
6804 result->InitializeDescriptors(*descriptors, *layout_descriptor);
6725 } 6805 }
6726 #if TRACE_MAPS 6806 #if TRACE_MAPS
6727 if (FLAG_trace_maps && 6807 if (FLAG_trace_maps &&
6728 // Mirror conditions above that did not call ConnectTransition(). 6808 // Mirror conditions above that did not call ConnectTransition().
6729 (map->is_prototype_map() || 6809 (map->is_prototype_map() ||
6730 !(flag == INSERT_TRANSITION && map->CanHaveMoreTransitions()))) { 6810 !(flag == INSERT_TRANSITION && map->CanHaveMoreTransitions()))) {
6731 PrintF("[TraceMaps: ReplaceDescriptors from= %p to= %p reason= %s ]\n", 6811 PrintF("[TraceMaps: ReplaceDescriptors from= %p to= %p reason= %s ]\n",
6732 reinterpret_cast<void*>(*map), reinterpret_cast<void*>(*result), 6812 reinterpret_cast<void*>(*map), reinterpret_cast<void*>(*result),
6733 reason); 6813 reason);
6734 } 6814 }
6735 #endif 6815 #endif
6736 6816
6737 return result; 6817 return result;
6738 } 6818 }
6739 6819
6740 6820
6741 // Since this method is used to rewrite an existing transition tree, it can 6821 // Since this method is used to rewrite an existing transition tree, it can
6742 // always insert transitions without checking. 6822 // always insert transitions without checking.
6743 Handle<Map> Map::CopyInstallDescriptors(Handle<Map> map, 6823 Handle<Map> Map::CopyInstallDescriptors(
6744 int new_descriptor, 6824 Handle<Map> map, int new_descriptor, Handle<DescriptorArray> descriptors,
6745 Handle<DescriptorArray> descriptors) { 6825 Handle<LayoutDescriptor> full_layout_descriptor) {
6746 DCHECK(descriptors->IsSortedNoDuplicates()); 6826 DCHECK(descriptors->IsSortedNoDuplicates());
6747 6827
6748 Handle<Map> result = CopyDropDescriptors(map); 6828 Handle<Map> result = CopyDropDescriptors(map);
6749 6829
6750 result->InitializeDescriptors(*descriptors); 6830 result->set_instance_descriptors(*descriptors);
6751 result->SetNumberOfOwnDescriptors(new_descriptor + 1); 6831 result->SetNumberOfOwnDescriptors(new_descriptor + 1);
6752 6832
6753 int unused_property_fields = map->unused_property_fields(); 6833 int unused_property_fields = map->unused_property_fields();
6754 if (descriptors->GetDetails(new_descriptor).type() == FIELD) { 6834 PropertyDetails details = descriptors->GetDetails(new_descriptor);
6835 if (details.type() == FIELD) {
6755 unused_property_fields = map->unused_property_fields() - 1; 6836 unused_property_fields = map->unused_property_fields() - 1;
6756 if (unused_property_fields < 0) { 6837 if (unused_property_fields < 0) {
6757 unused_property_fields += JSObject::kFieldsAdded; 6838 unused_property_fields += JSObject::kFieldsAdded;
6758 } 6839 }
6759 } 6840 }
6841 result->set_unused_property_fields(unused_property_fields);
6760 6842
6761 result->set_unused_property_fields(unused_property_fields); 6843 if (FLAG_unbox_double_fields) {
6844 Handle<LayoutDescriptor> layout_descriptor =
6845 LayoutDescriptor::AppendIfFastOrUseFull(map, details,
6846 full_layout_descriptor);
6847 result->set_layout_descriptor(*layout_descriptor);
6848 SLOW_DCHECK(result->layout_descriptor()->IsConsistentWithMap(*result));
6849 result->set_visitor_id(StaticVisitorBase::GetVisitorId(*result));
6850 }
6762 6851
6763 Handle<Name> name = handle(descriptors->GetKey(new_descriptor)); 6852 Handle<Name> name = handle(descriptors->GetKey(new_descriptor));
6764 ConnectTransition(map, result, name, SIMPLE_PROPERTY_TRANSITION); 6853 ConnectTransition(map, result, name, SIMPLE_PROPERTY_TRANSITION);
6765 6854
6766 return result; 6855 return result;
6767 } 6856 }
6768 6857
6769 6858
6770 Handle<Map> Map::CopyAsElementsKind(Handle<Map> map, ElementsKind kind, 6859 Handle<Map> Map::CopyAsElementsKind(Handle<Map> map, ElementsKind kind,
6771 TransitionFlag flag) { 6860 TransitionFlag flag) {
(...skipping 15 matching lines...) Expand all
6787 !map->HasElementsTransition(); 6876 !map->HasElementsTransition();
6788 6877
6789 if (insert_transition && map->owns_descriptors()) { 6878 if (insert_transition && map->owns_descriptors()) {
6790 // In case the map owned its own descriptors, share the descriptors and 6879 // In case the map owned its own descriptors, share the descriptors and
6791 // transfer ownership to the new map. 6880 // transfer ownership to the new map.
6792 Handle<Map> new_map = CopyDropDescriptors(map); 6881 Handle<Map> new_map = CopyDropDescriptors(map);
6793 6882
6794 ConnectElementsTransition(map, new_map); 6883 ConnectElementsTransition(map, new_map);
6795 6884
6796 new_map->set_elements_kind(kind); 6885 new_map->set_elements_kind(kind);
6797 new_map->InitializeDescriptors(map->instance_descriptors()); 6886 // The properties did not change, so reuse descriptors.
6887 new_map->InitializeDescriptors(map->instance_descriptors(),
6888 map->GetLayoutDescriptor());
6798 return new_map; 6889 return new_map;
6799 } 6890 }
6800 6891
6801 // In case the map did not own its own descriptors, a split is forced by 6892 // In case the map did not own its own descriptors, a split is forced by
6802 // copying the map; creating a new descriptor array cell. 6893 // copying the map; creating a new descriptor array cell.
6803 // Create a new free-floating map only if we are not allowed to store it. 6894 // Create a new free-floating map only if we are not allowed to store it.
6804 Handle<Map> new_map = Copy(map, "CopyAsElementsKind"); 6895 Handle<Map> new_map = Copy(map, "CopyAsElementsKind");
6805 6896
6806 new_map->set_elements_kind(kind); 6897 new_map->set_elements_kind(kind);
6807 6898
(...skipping 15 matching lines...) Expand all
6823 Handle<Map> new_map; 6914 Handle<Map> new_map;
6824 if (map->owns_descriptors()) { 6915 if (map->owns_descriptors()) {
6825 new_map = CopyDropDescriptors(map); 6916 new_map = CopyDropDescriptors(map);
6826 } else { 6917 } else {
6827 DCHECK(!map->is_prototype_map()); 6918 DCHECK(!map->is_prototype_map());
6828 new_map = Copy(map, "CopyForObserved"); 6919 new_map = Copy(map, "CopyForObserved");
6829 } 6920 }
6830 6921
6831 new_map->set_is_observed(); 6922 new_map->set_is_observed();
6832 if (map->owns_descriptors()) { 6923 if (map->owns_descriptors()) {
6833 new_map->InitializeDescriptors(map->instance_descriptors()); 6924 // The properties did not change, so reuse descriptors.
6925 new_map->InitializeDescriptors(map->instance_descriptors(),
6926 map->GetLayoutDescriptor());
6834 } 6927 }
6835 6928
6836 if (map->CanHaveMoreTransitions()) { 6929 if (map->CanHaveMoreTransitions()) {
6837 Handle<Name> name = isolate->factory()->observed_symbol(); 6930 Handle<Name> name = isolate->factory()->observed_symbol();
6838 ConnectTransition(map, new_map, name, SPECIAL_TRANSITION); 6931 ConnectTransition(map, new_map, name, SPECIAL_TRANSITION);
6839 } 6932 }
6840 return new_map; 6933 return new_map;
6841 } 6934 }
6842 6935
6843 6936
6844 Handle<Map> Map::Copy(Handle<Map> map, const char* reason) { 6937 Handle<Map> Map::Copy(Handle<Map> map, const char* reason) {
6845 Handle<DescriptorArray> descriptors(map->instance_descriptors()); 6938 Handle<DescriptorArray> descriptors(map->instance_descriptors());
6846 int number_of_own_descriptors = map->NumberOfOwnDescriptors(); 6939 int number_of_own_descriptors = map->NumberOfOwnDescriptors();
6847 Handle<DescriptorArray> new_descriptors = 6940 Handle<DescriptorArray> new_descriptors =
6848 DescriptorArray::CopyUpTo(descriptors, number_of_own_descriptors); 6941 DescriptorArray::CopyUpTo(descriptors, number_of_own_descriptors);
6849 return CopyReplaceDescriptors(map, new_descriptors, OMIT_TRANSITION, 6942 Handle<LayoutDescriptor> new_layout_descriptor(map->GetLayoutDescriptor(),
6850 MaybeHandle<Name>(), reason, 6943 map->GetIsolate());
6944 return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor,
6945 OMIT_TRANSITION, MaybeHandle<Name>(), reason,
6851 SPECIAL_TRANSITION); 6946 SPECIAL_TRANSITION);
6852 } 6947 }
6853 6948
6854 6949
6855 Handle<Map> Map::Create(Isolate* isolate, int inobject_properties) { 6950 Handle<Map> Map::Create(Isolate* isolate, int inobject_properties) {
6856 Handle<Map> copy = 6951 Handle<Map> copy =
6857 Copy(handle(isolate->object_function()->initial_map()), "MapCreate"); 6952 Copy(handle(isolate->object_function()->initial_map()), "MapCreate");
6858 6953
6859 // Check that we do not overflow the instance size when adding the extra 6954 // Check that we do not overflow the instance size when adding the extra
6860 // inobject properties. If the instance size overflows, we allocate as many 6955 // inobject properties. If the instance size overflows, we allocate as many
(...skipping 15 matching lines...) Expand all
6876 copy->set_visitor_id(StaticVisitorBase::GetVisitorId(*copy)); 6971 copy->set_visitor_id(StaticVisitorBase::GetVisitorId(*copy));
6877 return copy; 6972 return copy;
6878 } 6973 }
6879 6974
6880 6975
6881 Handle<Map> Map::CopyForFreeze(Handle<Map> map) { 6976 Handle<Map> Map::CopyForFreeze(Handle<Map> map) {
6882 int num_descriptors = map->NumberOfOwnDescriptors(); 6977 int num_descriptors = map->NumberOfOwnDescriptors();
6883 Isolate* isolate = map->GetIsolate(); 6978 Isolate* isolate = map->GetIsolate();
6884 Handle<DescriptorArray> new_desc = DescriptorArray::CopyUpToAddAttributes( 6979 Handle<DescriptorArray> new_desc = DescriptorArray::CopyUpToAddAttributes(
6885 handle(map->instance_descriptors(), isolate), num_descriptors, FROZEN); 6980 handle(map->instance_descriptors(), isolate), num_descriptors, FROZEN);
6981 Handle<LayoutDescriptor> new_layout_descriptor(map->GetLayoutDescriptor(),
6982 isolate);
6886 Handle<Map> new_map = CopyReplaceDescriptors( 6983 Handle<Map> new_map = CopyReplaceDescriptors(
6887 map, new_desc, INSERT_TRANSITION, isolate->factory()->frozen_symbol(), 6984 map, new_desc, new_layout_descriptor, INSERT_TRANSITION,
6888 "CopyForFreeze", SPECIAL_TRANSITION); 6985 isolate->factory()->frozen_symbol(), "CopyForFreeze", SPECIAL_TRANSITION);
6889 new_map->freeze(); 6986 new_map->freeze();
6890 new_map->set_is_extensible(false); 6987 new_map->set_is_extensible(false);
6891 new_map->set_elements_kind(DICTIONARY_ELEMENTS); 6988 new_map->set_elements_kind(DICTIONARY_ELEMENTS);
6892 return new_map; 6989 return new_map;
6893 } 6990 }
6894 6991
6895 6992
6896 bool DescriptorArray::CanHoldValue(int descriptor, Object* value) { 6993 bool DescriptorArray::CanHoldValue(int descriptor, Object* value) {
6897 PropertyDetails details = GetDetails(descriptor); 6994 PropertyDetails details = GetDetails(descriptor);
6898 switch (details.type()) { 6995 switch (details.type()) {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
7103 if (flag == INSERT_TRANSITION && 7200 if (flag == INSERT_TRANSITION &&
7104 map->owns_descriptors() && 7201 map->owns_descriptors() &&
7105 map->CanHaveMoreTransitions()) { 7202 map->CanHaveMoreTransitions()) {
7106 return ShareDescriptor(map, descriptors, descriptor); 7203 return ShareDescriptor(map, descriptors, descriptor);
7107 } 7204 }
7108 7205
7109 Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo( 7206 Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo(
7110 descriptors, map->NumberOfOwnDescriptors(), 1); 7207 descriptors, map->NumberOfOwnDescriptors(), 1);
7111 new_descriptors->Append(descriptor); 7208 new_descriptors->Append(descriptor);
7112 7209
7113 return CopyReplaceDescriptors(map, new_descriptors, flag, 7210 Handle<LayoutDescriptor> new_layout_descriptor =
7114 descriptor->GetKey(), "CopyAddDescriptor", 7211 FLAG_unbox_double_fields
7212 ? LayoutDescriptor::Append(map, descriptor->GetDetails())
7213 : handle(LayoutDescriptor::FastPointerLayout(), map->GetIsolate());
7214
7215 return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor,
7216 flag, descriptor->GetKey(), "CopyAddDescriptor",
7115 SIMPLE_PROPERTY_TRANSITION); 7217 SIMPLE_PROPERTY_TRANSITION);
7116 } 7218 }
7117 7219
7118 7220
7119 Handle<Map> Map::CopyInsertDescriptor(Handle<Map> map, 7221 Handle<Map> Map::CopyInsertDescriptor(Handle<Map> map,
7120 Descriptor* descriptor, 7222 Descriptor* descriptor,
7121 TransitionFlag flag) { 7223 TransitionFlag flag) {
7122 Handle<DescriptorArray> old_descriptors(map->instance_descriptors()); 7224 Handle<DescriptorArray> old_descriptors(map->instance_descriptors());
7123 7225
7124 // Ensure the key is unique. 7226 // Ensure the key is unique.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
7196 // Ensure the key is unique. 7298 // Ensure the key is unique.
7197 descriptor->KeyToUniqueName(); 7299 descriptor->KeyToUniqueName();
7198 7300
7199 Handle<Name> key = descriptor->GetKey(); 7301 Handle<Name> key = descriptor->GetKey();
7200 DCHECK(*key == descriptors->GetKey(insertion_index)); 7302 DCHECK(*key == descriptors->GetKey(insertion_index));
7201 7303
7202 Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo( 7304 Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo(
7203 descriptors, map->NumberOfOwnDescriptors()); 7305 descriptors, map->NumberOfOwnDescriptors());
7204 7306
7205 new_descriptors->Replace(insertion_index, descriptor); 7307 new_descriptors->Replace(insertion_index, descriptor);
7308 Handle<LayoutDescriptor> new_layout_descriptor = LayoutDescriptor::New(
7309 map, new_descriptors, new_descriptors->number_of_descriptors());
7206 7310
7207 SimpleTransitionFlag simple_flag = 7311 SimpleTransitionFlag simple_flag =
7208 (insertion_index == descriptors->number_of_descriptors() - 1) 7312 (insertion_index == descriptors->number_of_descriptors() - 1)
7209 ? SIMPLE_PROPERTY_TRANSITION 7313 ? SIMPLE_PROPERTY_TRANSITION
7210 : PROPERTY_TRANSITION; 7314 : PROPERTY_TRANSITION;
7211 return CopyReplaceDescriptors(map, new_descriptors, flag, key, 7315 return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor,
7212 "CopyReplaceDescriptor", simple_flag); 7316 flag, key, "CopyReplaceDescriptor",
7317 simple_flag);
7213 } 7318 }
7214 7319
7215 7320
7216 void Map::UpdateCodeCache(Handle<Map> map, 7321 void Map::UpdateCodeCache(Handle<Map> map,
7217 Handle<Name> name, 7322 Handle<Name> name,
7218 Handle<Code> code) { 7323 Handle<Code> code) {
7219 Isolate* isolate = map->GetIsolate(); 7324 Isolate* isolate = map->GetIsolate();
7220 HandleScope scope(isolate); 7325 HandleScope scope(isolate);
7221 // Allocate the code cache if not present. 7326 // Allocate the code cache if not present.
7222 if (map->code_cache()->IsFixedArray()) { 7327 if (map->code_cache()->IsFixedArray()) {
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
8009 DCHECK(!IsEmpty()); 8114 DCHECK(!IsEmpty());
8010 DCHECK(!HasEnumCache() || new_cache->length() > GetEnumCache()->length()); 8115 DCHECK(!HasEnumCache() || new_cache->length() > GetEnumCache()->length());
8011 FixedArray::cast(bridge_storage)-> 8116 FixedArray::cast(bridge_storage)->
8012 set(kEnumCacheBridgeCacheIndex, new_cache); 8117 set(kEnumCacheBridgeCacheIndex, new_cache);
8013 FixedArray::cast(bridge_storage)-> 8118 FixedArray::cast(bridge_storage)->
8014 set(kEnumCacheBridgeIndicesCacheIndex, new_index_cache); 8119 set(kEnumCacheBridgeIndicesCacheIndex, new_index_cache);
8015 set(kEnumCacheIndex, bridge_storage); 8120 set(kEnumCacheIndex, bridge_storage);
8016 } 8121 }
8017 8122
8018 8123
8019 void DescriptorArray::CopyFrom(int index, 8124 void DescriptorArray::CopyFrom(int index, DescriptorArray* src,
8020 DescriptorArray* src,
8021 const WhitenessWitness& witness) { 8125 const WhitenessWitness& witness) {
8022 Object* value = src->GetValue(index); 8126 Object* value = src->GetValue(index);
8023 PropertyDetails details = src->GetDetails(index); 8127 PropertyDetails details = src->GetDetails(index);
8024 Descriptor desc(handle(src->GetKey(index)), 8128 Descriptor desc(handle(src->GetKey(index)),
8025 handle(value, src->GetIsolate()), 8129 handle(value, src->GetIsolate()),
8026 details); 8130 details);
8027 Set(index, &desc, witness); 8131 Set(index, &desc, witness);
8028 } 8132 }
8029 8133
8030 8134
(...skipping 8633 matching lines...) Expand 10 before | Expand all | Expand 10 after
16664 Handle<DependentCode> codes = 16768 Handle<DependentCode> codes =
16665 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16769 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16666 DependentCode::kPropertyCellChangedGroup, 16770 DependentCode::kPropertyCellChangedGroup,
16667 info->object_wrapper()); 16771 info->object_wrapper());
16668 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16772 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16669 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16773 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16670 cell, info->zone()); 16774 cell, info->zone());
16671 } 16775 }
16672 16776
16673 } } // namespace v8::internal 16777 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698