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

Side by Side Diff: src/objects.cc

Issue 748893003: Version 3.30.33.5 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@3.30
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.h ('k') | src/version.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 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 deprecate(); 2221 deprecate();
2222 dependent_code()->DeoptimizeDependentCodeGroup( 2222 dependent_code()->DeoptimizeDependentCodeGroup(
2223 GetIsolate(), DependentCode::kTransitionGroup); 2223 GetIsolate(), DependentCode::kTransitionGroup);
2224 NotifyLeafMapLayoutChange(); 2224 NotifyLeafMapLayoutChange();
2225 } 2225 }
2226 2226
2227 2227
2228 // Invalidates a transition target at |key|, and installs |new_descriptors| over 2228 // Invalidates a transition target at |key|, and installs |new_descriptors| over
2229 // the current instance_descriptors to ensure proper sharing of descriptor 2229 // the current instance_descriptors to ensure proper sharing of descriptor
2230 // arrays. 2230 // arrays.
2231 void Map::DeprecateTarget(Name* key, DescriptorArray* new_descriptors) { 2231 // Returns true if the transition target at given key was deprecated.
2232 bool Map::DeprecateTarget(Name* key, DescriptorArray* new_descriptors) {
2233 bool transition_target_deprecated = false;
2232 if (HasTransitionArray()) { 2234 if (HasTransitionArray()) {
2233 TransitionArray* transitions = this->transitions(); 2235 TransitionArray* transitions = this->transitions();
2234 int transition = transitions->Search(key); 2236 int transition = transitions->Search(key);
2235 if (transition != TransitionArray::kNotFound) { 2237 if (transition != TransitionArray::kNotFound) {
2236 transitions->GetTarget(transition)->DeprecateTransitionTree(); 2238 transitions->GetTarget(transition)->DeprecateTransitionTree();
2239 transition_target_deprecated = true;
2237 } 2240 }
2238 } 2241 }
2239 2242
2240 // Don't overwrite the empty descriptor array. 2243 // Don't overwrite the empty descriptor array.
2241 if (NumberOfOwnDescriptors() == 0) return; 2244 if (NumberOfOwnDescriptors() == 0) return transition_target_deprecated;
2242 2245
2243 DescriptorArray* to_replace = instance_descriptors(); 2246 DescriptorArray* to_replace = instance_descriptors();
2244 Map* current = this; 2247 Map* current = this;
2245 GetHeap()->incremental_marking()->RecordWrites(to_replace); 2248 GetHeap()->incremental_marking()->RecordWrites(to_replace);
2246 while (current->instance_descriptors() == to_replace) { 2249 while (current->instance_descriptors() == to_replace) {
2247 current->SetEnumLength(kInvalidEnumCacheSentinel); 2250 current->SetEnumLength(kInvalidEnumCacheSentinel);
2248 current->set_instance_descriptors(new_descriptors); 2251 current->set_instance_descriptors(new_descriptors);
2249 Object* next = current->GetBackPointer(); 2252 Object* next = current->GetBackPointer();
2250 if (next->IsUndefined()) break; 2253 if (next->IsUndefined()) break;
2251 current = Map::cast(next); 2254 current = Map::cast(next);
2252 } 2255 }
2253 2256
2254 set_owns_descriptors(false); 2257 set_owns_descriptors(false);
2258 return transition_target_deprecated;
2255 } 2259 }
2256 2260
2257 2261
2258 Map* Map::FindRootMap() { 2262 Map* Map::FindRootMap() {
2259 Map* result = this; 2263 Map* result = this;
2260 while (true) { 2264 while (true) {
2261 Object* back = result->GetBackPointer(); 2265 Object* back = result->GetBackPointer();
2262 if (back->IsUndefined()) return result; 2266 if (back->IsUndefined()) return result;
2263 result = Map::cast(back); 2267 result = Map::cast(back);
2264 } 2268 }
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
2678 new_descriptors->Sort(); 2682 new_descriptors->Sort();
2679 2683
2680 DCHECK(store_mode != FORCE_FIELD || 2684 DCHECK(store_mode != FORCE_FIELD ||
2681 new_descriptors->GetDetails(modify_index).type() == FIELD); 2685 new_descriptors->GetDetails(modify_index).type() == FIELD);
2682 2686
2683 Handle<Map> split_map(root_map->FindLastMatchMap( 2687 Handle<Map> split_map(root_map->FindLastMatchMap(
2684 root_nof, old_nof, *new_descriptors), isolate); 2688 root_nof, old_nof, *new_descriptors), isolate);
2685 int split_nof = split_map->NumberOfOwnDescriptors(); 2689 int split_nof = split_map->NumberOfOwnDescriptors();
2686 DCHECK_NE(old_nof, split_nof); 2690 DCHECK_NE(old_nof, split_nof);
2687 2691
2688 split_map->DeprecateTarget( 2692 bool transition_target_deprecated =
2689 old_descriptors->GetKey(split_nof), *new_descriptors); 2693 split_map->DeprecateTarget(old_descriptors->GetKey(split_nof),
2694 *new_descriptors);
2690 2695
2696 // If |transition_target_deprecated| is true then the transition array
2697 // already contains entry for given descriptor. This means that the transition
2698 // could be inserted regardless of whether transitions array is full or not.
2699 if (!transition_target_deprecated && !split_map->CanHaveMoreTransitions()) {
2700 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode,
2701 "can't have more transitions");
2702 }
2691 if (FLAG_trace_generalization) { 2703 if (FLAG_trace_generalization) {
2692 PropertyDetails old_details = old_descriptors->GetDetails(modify_index); 2704 PropertyDetails old_details = old_descriptors->GetDetails(modify_index);
2693 PropertyDetails new_details = new_descriptors->GetDetails(modify_index); 2705 PropertyDetails new_details = new_descriptors->GetDetails(modify_index);
2694 Handle<HeapType> old_field_type = (old_details.type() == FIELD) 2706 Handle<HeapType> old_field_type = (old_details.type() == FIELD)
2695 ? handle(old_descriptors->GetFieldType(modify_index), isolate) 2707 ? handle(old_descriptors->GetFieldType(modify_index), isolate)
2696 : HeapType::Constant(handle(old_descriptors->GetValue(modify_index), 2708 : HeapType::Constant(handle(old_descriptors->GetValue(modify_index),
2697 isolate), isolate); 2709 isolate), isolate);
2698 Handle<HeapType> new_field_type = (new_details.type() == FIELD) 2710 Handle<HeapType> new_field_type = (new_details.type() == FIELD)
2699 ? handle(new_descriptors->GetFieldType(modify_index), isolate) 2711 ? handle(new_descriptors->GetFieldType(modify_index), isolate)
2700 : HeapType::Constant(handle(new_descriptors->GetValue(modify_index), 2712 : HeapType::Constant(handle(new_descriptors->GetValue(modify_index),
2701 isolate), isolate); 2713 isolate), isolate);
2702 old_map->PrintGeneralization( 2714 old_map->PrintGeneralization(
2703 stdout, "", modify_index, split_nof, old_nof, 2715 stdout, "", modify_index, split_nof, old_nof,
2704 old_details.type() == CONSTANT && store_mode == FORCE_FIELD, 2716 old_details.type() == CONSTANT && store_mode == FORCE_FIELD,
2705 old_details.representation(), new_details.representation(), 2717 old_details.representation(), new_details.representation(),
2706 *old_field_type, *new_field_type); 2718 *old_field_type, *new_field_type);
2707 } 2719 }
2708 2720
2709 // Add missing transitions. 2721 // Add missing transitions.
2710 Handle<Map> new_map = split_map; 2722 Handle<Map> new_map = split_map;
2711 for (int i = split_nof; i < old_nof; ++i) { 2723 for (int i = split_nof; i < old_nof; ++i) {
2712 if (!new_map->CanHaveMoreTransitions()) {
2713 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode,
2714 "can't have more transitions");
2715 }
2716 new_map = CopyInstallDescriptors(new_map, i, new_descriptors); 2724 new_map = CopyInstallDescriptors(new_map, i, new_descriptors);
2717 } 2725 }
2718 new_map->set_owns_descriptors(true); 2726 new_map->set_owns_descriptors(true);
2719 return new_map; 2727 return new_map;
2720 } 2728 }
2721 2729
2722 2730
2723 // Generalize the representation of all FIELD descriptors. 2731 // Generalize the representation of all FIELD descriptors.
2724 Handle<Map> Map::GeneralizeAllFieldRepresentations( 2732 Handle<Map> Map::GeneralizeAllFieldRepresentations(
2725 Handle<Map> map) { 2733 Handle<Map> map) {
(...skipping 13839 matching lines...) Expand 10 before | Expand all | Expand 10 after
16565 Handle<DependentCode> codes = 16573 Handle<DependentCode> codes =
16566 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16574 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16567 DependentCode::kPropertyCellChangedGroup, 16575 DependentCode::kPropertyCellChangedGroup,
16568 info->object_wrapper()); 16576 info->object_wrapper());
16569 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16577 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16570 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16578 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16571 cell, info->zone()); 16579 cell, info->zone());
16572 } 16580 }
16573 16581
16574 } } // namespace v8::internal 16582 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698