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

Side by Side Diff: src/objects.cc

Issue 1413003008: Support fast-path allocation for subclass constructors with correctly initialized initial maps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-object.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 "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 11204 matching lines...) Expand 10 before | Expand all | Expand 10 after
11215 map->set_unused_property_fields(map->unused_property_fields() - slack); 11215 map->set_unused_property_fields(map->unused_property_fields() - slack);
11216 map->set_instance_size(map->instance_size() - slack * kPointerSize); 11216 map->set_instance_size(map->instance_size() - slack * kPointerSize);
11217 11217
11218 // Visitor id might depend on the instance size, recalculate it. 11218 // Visitor id might depend on the instance size, recalculate it.
11219 map->set_visitor_id(Heap::GetStaticVisitorIdForMap(map)); 11219 map->set_visitor_id(Heap::GetStaticVisitorIdForMap(map));
11220 } 11220 }
11221 11221
11222 11222
11223 void JSFunction::CompleteInobjectSlackTracking() { 11223 void JSFunction::CompleteInobjectSlackTracking() {
11224 DCHECK(has_initial_map()); 11224 DCHECK(has_initial_map());
11225 Map* map = initial_map(); 11225 initial_map()->CompleteInobjectSlackTracking();
11226 }
11226 11227
11227 DCHECK(map->counter() >= Map::kSlackTrackingCounterEnd - 1);
11228 map->set_counter(Map::kRetainingCounterStart);
11229 11228
11230 int slack = map->unused_property_fields(); 11229 void Map::CompleteInobjectSlackTracking() {
11231 TransitionArray::TraverseTransitionTree(map, &GetMinInobjectSlack, &slack); 11230 // Has to be an initial map.
11231 DCHECK(GetBackPointer()->IsUndefined());
11232
11233 DCHECK_GE(counter(), kSlackTrackingCounterEnd - 1);
11234 set_counter(kRetainingCounterStart);
11235
11236 int slack = unused_property_fields();
11237 TransitionArray::TraverseTransitionTree(this, &GetMinInobjectSlack, &slack);
11232 if (slack != 0) { 11238 if (slack != 0) {
11233 // Resize the initial map and all maps in its transition tree. 11239 // Resize the initial map and all maps in its transition tree.
11234 TransitionArray::TraverseTransitionTree(map, &ShrinkInstanceSize, &slack); 11240 TransitionArray::TraverseTransitionTree(this, &ShrinkInstanceSize, &slack);
11235 } 11241 }
11236 } 11242 }
11237 11243
11238 11244
11239 static bool PrototypeBenefitsFromNormalization(Handle<JSObject> object) { 11245 static bool PrototypeBenefitsFromNormalization(Handle<JSObject> object) {
11240 DisallowHeapAllocation no_gc; 11246 DisallowHeapAllocation no_gc;
11241 if (!object->HasFastProperties()) return false; 11247 if (!object->HasFastProperties()) return false;
11242 Map* map = object->map(); 11248 Map* map = object->map();
11243 if (map->is_prototype_map()) return false; 11249 if (map->is_prototype_map()) return false;
11244 DescriptorArray* descriptors = map->instance_descriptors(); 11250 DescriptorArray* descriptors = map->instance_descriptors();
(...skipping 6637 matching lines...) Expand 10 before | Expand all | Expand 10 after
17882 if (cell->value() != *new_value) { 17888 if (cell->value() != *new_value) {
17883 cell->set_value(*new_value); 17889 cell->set_value(*new_value);
17884 Isolate* isolate = cell->GetIsolate(); 17890 Isolate* isolate = cell->GetIsolate();
17885 cell->dependent_code()->DeoptimizeDependentCodeGroup( 17891 cell->dependent_code()->DeoptimizeDependentCodeGroup(
17886 isolate, DependentCode::kPropertyCellChangedGroup); 17892 isolate, DependentCode::kPropertyCellChangedGroup);
17887 } 17893 }
17888 } 17894 }
17889 17895
17890 } // namespace internal 17896 } // namespace internal
17891 } // namespace v8 17897 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698