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

Side by Side Diff: src/objects.cc

Issue 930983003: Reduce field type tracking to a single stable map per field. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months 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 | « no previous file | src/types.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 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after
2319 DataDescriptor d(name, instance_descriptors()->GetFieldIndex(descriptor), 2319 DataDescriptor d(name, instance_descriptors()->GetFieldIndex(descriptor),
2320 new_type, details.attributes(), new_representation); 2320 new_type, details.attributes(), new_representation);
2321 instance_descriptors()->Replace(descriptor, &d); 2321 instance_descriptors()->Replace(descriptor, &d);
2322 } 2322 }
2323 2323
2324 2324
2325 // static 2325 // static
2326 Handle<HeapType> Map::GeneralizeFieldType(Handle<HeapType> type1, 2326 Handle<HeapType> Map::GeneralizeFieldType(Handle<HeapType> type1,
2327 Handle<HeapType> type2, 2327 Handle<HeapType> type2,
2328 Isolate* isolate) { 2328 Isolate* isolate) {
2329 static const int kMaxClassesPerFieldType = 5;
2330 if (type1->NowIs(type2)) return type2; 2329 if (type1->NowIs(type2)) return type2;
2331 if (type2->NowIs(type1)) return type1; 2330 if (type2->NowIs(type1)) return type1;
2332 if (type1->NowStable() && type2->NowStable()) {
2333 Handle<HeapType> type = HeapType::Union(type1, type2, isolate);
2334 if (type->NumClasses() <= kMaxClassesPerFieldType) {
2335 DCHECK(type->NowStable());
2336 DCHECK(type1->NowIs(type));
2337 DCHECK(type2->NowIs(type));
2338 return type;
2339 }
2340 }
2341 return HeapType::Any(isolate); 2331 return HeapType::Any(isolate);
2342 } 2332 }
2343 2333
2344 2334
2345 // static 2335 // static
2346 void Map::GeneralizeFieldType(Handle<Map> map, int modify_index, 2336 void Map::GeneralizeFieldType(Handle<Map> map, int modify_index,
2347 Representation new_representation, 2337 Representation new_representation,
2348 Handle<HeapType> new_field_type) { 2338 Handle<HeapType> new_field_type) {
2349 Isolate* isolate = map->GetIsolate(); 2339 Isolate* isolate = map->GetIsolate();
2350 2340
(...skipping 14856 matching lines...) Expand 10 before | Expand all | Expand 10 after
17207 CompilationInfo* info) { 17197 CompilationInfo* info) {
17208 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( 17198 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo(
17209 handle(cell->dependent_code(), info->isolate()), 17199 handle(cell->dependent_code(), info->isolate()),
17210 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); 17200 DependentCode::kPropertyCellChangedGroup, info->object_wrapper());
17211 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 17201 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
17212 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 17202 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
17213 cell, info->zone()); 17203 cell, info->zone());
17214 } 17204 }
17215 17205
17216 } } // namespace v8::internal 17206 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698