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

Side by Side Diff: src/compiler/access-info.cc

Issue 1636013002: Replace HeapType with a non-templated FieldType class. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tracing of generalizations Created 4 years, 11 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/crankshaft/hydrogen.h » ('j') | src/crankshaft/hydrogen-types.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 <ostream> 5 #include <ostream>
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/compilation-dependencies.h" 8 #include "src/compilation-dependencies.h"
9 #include "src/compiler/access-info.h" 9 #include "src/compiler/access-info.h"
10 #include "src/field-index-inl.h" 10 #include "src/field-index-inl.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 *map, index, field_representation.IsDouble()); 270 *map, index, field_representation.IsDouble());
271 Type* field_type = Type::Tagged(); 271 Type* field_type = Type::Tagged();
272 if (field_representation.IsSmi()) { 272 if (field_representation.IsSmi()) {
273 field_type = type_cache_.kSmi; 273 field_type = type_cache_.kSmi;
274 } else if (field_representation.IsDouble()) { 274 } else if (field_representation.IsDouble()) {
275 field_type = type_cache_.kFloat64; 275 field_type = type_cache_.kFloat64;
276 } else if (field_representation.IsHeapObject()) { 276 } else if (field_representation.IsHeapObject()) {
277 // Extract the field type from the property details (make sure its 277 // Extract the field type from the property details (make sure its
278 // representation is TaggedPointer to reflect the heap object case). 278 // representation is TaggedPointer to reflect the heap object case).
279 field_type = Type::Intersect( 279 field_type = Type::Intersect(
280 Type::Convert<HeapType>( 280 descriptors->GetFieldType(number)->Convert(zone()),
281 handle(descriptors->GetFieldType(number), isolate()), zone()),
282 Type::TaggedPointer(), zone()); 281 Type::TaggedPointer(), zone());
283 if (field_type->Is(Type::None())) { 282 if (field_type->Is(Type::None())) {
284 // Store is not safe if the field type was cleared. 283 // Store is not safe if the field type was cleared.
285 if (access_mode == AccessMode::kStore) return false; 284 if (access_mode == AccessMode::kStore) return false;
286 285
287 // The field type was cleared by the GC, so we don't know anything 286 // The field type was cleared by the GC, so we don't know anything
288 // about the contents now. 287 // about the contents now.
289 // TODO(bmeurer): It would be awesome to make this saner in the 288 // TODO(bmeurer): It would be awesome to make this saner in the
290 // runtime/GC interaction. 289 // runtime/GC interaction.
291 field_type = Type::TaggedPointer(); 290 field_type = Type::TaggedPointer();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 *transition_map, index, field_representation.IsDouble()); 446 *transition_map, index, field_representation.IsDouble());
448 Type* field_type = Type::Tagged(); 447 Type* field_type = Type::Tagged();
449 if (field_representation.IsSmi()) { 448 if (field_representation.IsSmi()) {
450 field_type = type_cache_.kSmi; 449 field_type = type_cache_.kSmi;
451 } else if (field_representation.IsDouble()) { 450 } else if (field_representation.IsDouble()) {
452 field_type = type_cache_.kFloat64; 451 field_type = type_cache_.kFloat64;
453 } else if (field_representation.IsHeapObject()) { 452 } else if (field_representation.IsHeapObject()) {
454 // Extract the field type from the property details (make sure its 453 // Extract the field type from the property details (make sure its
455 // representation is TaggedPointer to reflect the heap object case). 454 // representation is TaggedPointer to reflect the heap object case).
456 field_type = Type::Intersect( 455 field_type = Type::Intersect(
457 Type::Convert<HeapType>( 456 transition_map->instance_descriptors()->GetFieldType(number)->Convert(
458 handle(
459 transition_map->instance_descriptors()->GetFieldType(number),
460 isolate()),
461 zone()), 457 zone()),
462 Type::TaggedPointer(), zone()); 458 Type::TaggedPointer(), zone());
463 if (field_type->Is(Type::None())) { 459 if (field_type->Is(Type::None())) {
464 // Store is not safe if the field type was cleared. 460 // Store is not safe if the field type was cleared.
465 return false; 461 return false;
466 } else if (!Type::Any()->Is(field_type)) { 462 } else if (!Type::Any()->Is(field_type)) {
467 // Add proper code dependencies in case of stable field map(s). 463 // Add proper code dependencies in case of stable field map(s).
468 Handle<Map> field_owner_map(transition_map->FindFieldOwner(number), 464 Handle<Map> field_owner_map(transition_map->FindFieldOwner(number),
469 isolate()); 465 isolate());
470 dependencies()->AssumeFieldType(field_owner_map); 466 dependencies()->AssumeFieldType(field_owner_map);
471 } 467 }
472 DCHECK(field_type->Is(Type::TaggedPointer())); 468 DCHECK(field_type->Is(Type::TaggedPointer()));
473 } 469 }
474 dependencies()->AssumeMapNotDeprecated(transition_map); 470 dependencies()->AssumeMapNotDeprecated(transition_map);
475 *access_info = PropertyAccessInfo::DataField( 471 *access_info = PropertyAccessInfo::DataField(
476 Type::Class(map, zone()), field_index, field_type, FieldCheck::kNone, 472 Type::Class(map, zone()), field_index, field_type, FieldCheck::kNone,
477 holder, transition_map); 473 holder, transition_map);
478 return true; 474 return true;
479 } 475 }
480 return false; 476 return false;
481 } 477 }
482 478
483 479
484 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } 480 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); }
485 481
486 } // namespace compiler 482 } // namespace compiler
487 } // namespace internal 483 } // namespace internal
488 } // namespace v8 484 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/crankshaft/hydrogen.h » ('j') | src/crankshaft/hydrogen-types.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698