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/hydrogen.cc

Issue 239623005: Clear invalid field maps in PropertyAccessInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-363956.js » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5475 matching lines...) Expand 10 before | Expand all | Expand 10 after
5486 if (!info->access_.representation().IsCompatibleForLoad(r)) return false; 5486 if (!info->access_.representation().IsCompatibleForLoad(r)) return false;
5487 } else { 5487 } else {
5488 if (!info->access_.representation().IsCompatibleForStore(r)) return false; 5488 if (!info->access_.representation().IsCompatibleForStore(r)) return false;
5489 } 5489 }
5490 if (info->access_.offset() != access_.offset()) return false; 5490 if (info->access_.offset() != access_.offset()) return false;
5491 if (info->access_.IsInobject() != access_.IsInobject()) return false; 5491 if (info->access_.IsInobject() != access_.IsInobject()) return false;
5492 if (!field_map_.is_identical_to(info->field_map_)) { 5492 if (!field_map_.is_identical_to(info->field_map_)) {
5493 if (!IsLoad()) return false; 5493 if (!IsLoad()) return false;
5494 5494
5495 // Throw away type information for merging polymorphic loads. 5495 // Throw away type information for merging polymorphic loads.
5496 field_map_ = info->field_map_ = Handle<Map>(); 5496 info->field_map_ = Handle<Map>::null();
5497 } 5497 }
5498 info->GeneralizeRepresentation(r); 5498 info->GeneralizeRepresentation(r);
5499 return true; 5499 return true;
5500 } 5500 }
5501 5501
5502 5502
5503 bool HOptimizedGraphBuilder::PropertyAccessInfo::LookupDescriptor() { 5503 bool HOptimizedGraphBuilder::PropertyAccessInfo::LookupDescriptor() {
5504 if (!type_->IsClass()) return true; 5504 if (!type_->IsClass()) return true;
5505 map()->LookupDescriptor(NULL, *name_, &lookup_); 5505 map()->LookupDescriptor(NULL, *name_, &lookup_);
5506 return LoadResult(map()); 5506 return LoadResult(map());
5507 } 5507 }
5508 5508
5509 5509
5510 bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) { 5510 bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) {
5511 if (!IsLoad() && lookup_.IsProperty() && 5511 if (!IsLoad() && lookup_.IsProperty() &&
5512 (lookup_.IsReadOnly() || !lookup_.IsCacheable())) { 5512 (lookup_.IsReadOnly() || !lookup_.IsCacheable())) {
5513 return false; 5513 return false;
5514 } 5514 }
5515 5515
5516 if (lookup_.IsField()) { 5516 if (lookup_.IsField()) {
5517 // Construct the object field access. 5517 // Construct the object field access.
5518 access_ = HObjectAccess::ForField(map, &lookup_, name_); 5518 access_ = HObjectAccess::ForField(map, &lookup_, name_);
5519 5519
5520 // Load field map for heap objects. 5520 // Load field map for heap objects.
5521 if (access_.representation().IsHeapObject()) LoadFieldMap(map); 5521 LoadFieldMap(map);
5522 } else if (lookup_.IsPropertyCallbacks()) { 5522 } else if (lookup_.IsPropertyCallbacks()) {
5523 Handle<Object> callback(lookup_.GetValueFromMap(*map), isolate()); 5523 Handle<Object> callback(lookup_.GetValueFromMap(*map), isolate());
5524 if (!callback->IsAccessorPair()) return false; 5524 if (!callback->IsAccessorPair()) return false;
5525 Object* raw_accessor = IsLoad() 5525 Object* raw_accessor = IsLoad()
5526 ? Handle<AccessorPair>::cast(callback)->getter() 5526 ? Handle<AccessorPair>::cast(callback)->getter()
5527 : Handle<AccessorPair>::cast(callback)->setter(); 5527 : Handle<AccessorPair>::cast(callback)->setter();
5528 if (!raw_accessor->IsJSFunction()) return false; 5528 if (!raw_accessor->IsJSFunction()) return false;
5529 Handle<JSFunction> accessor = handle(JSFunction::cast(raw_accessor)); 5529 Handle<JSFunction> accessor = handle(JSFunction::cast(raw_accessor));
5530 if (accessor->shared()->IsApiFunction()) { 5530 if (accessor->shared()->IsApiFunction()) {
5531 CallOptimization call_optimization(accessor); 5531 CallOptimization call_optimization(accessor);
5532 if (call_optimization.is_simple_api_call()) { 5532 if (call_optimization.is_simple_api_call()) {
5533 CallOptimization::HolderLookup holder_lookup; 5533 CallOptimization::HolderLookup holder_lookup;
5534 Handle<Map> receiver_map = this->map(); 5534 Handle<Map> receiver_map = this->map();
5535 api_holder_ = call_optimization.LookupHolderOfExpectedType( 5535 api_holder_ = call_optimization.LookupHolderOfExpectedType(
5536 receiver_map, &holder_lookup); 5536 receiver_map, &holder_lookup);
5537 } 5537 }
5538 } 5538 }
5539 accessor_ = accessor; 5539 accessor_ = accessor;
5540 } else if (lookup_.IsConstant()) { 5540 } else if (lookup_.IsConstant()) {
5541 constant_ = handle(lookup_.GetConstantFromMap(*map), isolate()); 5541 constant_ = handle(lookup_.GetConstantFromMap(*map), isolate());
5542 } 5542 }
5543 5543
5544 return true; 5544 return true;
5545 } 5545 }
5546 5546
5547 5547
5548 void HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMap(Handle<Map> map) { 5548 void HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMap(Handle<Map> map) {
5549 // Clear any previous field map.
5550 field_map_ = Handle<Map>::null();
5551
5549 // Figure out the field type from the accessor map. 5552 // Figure out the field type from the accessor map.
5550 HeapType* field_type = lookup_.GetFieldTypeFromMap(*map); 5553 HeapType* field_type = lookup_.GetFieldTypeFromMap(*map);
5551 if (field_type->IsClass()) { 5554 if (field_type->IsClass()) {
5555 ASSERT(access_.representation().IsHeapObject());
5552 Handle<Map> field_map = field_type->AsClass(); 5556 Handle<Map> field_map = field_type->AsClass();
5553 if (field_map->is_stable()) { 5557 if (field_map->is_stable()) {
5554 field_map_ = field_map; 5558 field_map_ = field_map;
5555 Map::AddDependentCompilationInfo( 5559 Map::AddDependentCompilationInfo(
5556 field_map_, DependentCode::kPrototypeCheckGroup, top_info()); 5560 field_map_, DependentCode::kPrototypeCheckGroup, top_info());
5557 5561
5558 // Add dependency on the map that introduced the field. 5562 // Add dependency on the map that introduced the field.
5559 Map::AddDependentCompilationInfo( 5563 Map::AddDependentCompilationInfo(
5560 handle(lookup_.GetFieldOwnerFromMap(*map), isolate()), 5564 handle(lookup_.GetFieldOwnerFromMap(*map), isolate()),
5561 DependentCode::kFieldTypeGroup, top_info()); 5565 DependentCode::kFieldTypeGroup, top_info());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5597 if (IsLoad()) return true; 5601 if (IsLoad()) return true;
5598 5602
5599 if (lookup_.IsPropertyCallbacks()) return true; 5603 if (lookup_.IsPropertyCallbacks()) return true;
5600 Handle<Map> map = this->map(); 5604 Handle<Map> map = this->map();
5601 map->LookupTransition(NULL, *name_, &lookup_); 5605 map->LookupTransition(NULL, *name_, &lookup_);
5602 if (lookup_.IsTransitionToField() && map->unused_property_fields() > 0) { 5606 if (lookup_.IsTransitionToField() && map->unused_property_fields() > 0) {
5603 // Construct the object field access. 5607 // Construct the object field access.
5604 access_ = HObjectAccess::ForField(map, &lookup_, name_); 5608 access_ = HObjectAccess::ForField(map, &lookup_, name_);
5605 5609
5606 // Load field map for heap objects. 5610 // Load field map for heap objects.
5607 if (access_.representation().IsHeapObject()) LoadFieldMap(transition()); 5611 LoadFieldMap(transition());
5608 return true; 5612 return true;
5609 } 5613 }
5610 return false; 5614 return false;
5611 } 5615 }
5612 5616
5613 5617
5614 bool HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessAsMonomorphic( 5618 bool HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessAsMonomorphic(
5615 SmallMapList* types) { 5619 SmallMapList* types) {
5616 ASSERT(type_->Is(ToType(types->first()))); 5620 ASSERT(type_->Is(ToType(types->first())));
5617 if (!CanAccessMonomorphic()) return false; 5621 if (!CanAccessMonomorphic()) return false;
(...skipping 5983 matching lines...) Expand 10 before | Expand all | Expand 10 after
11601 if (ShouldProduceTraceOutput()) { 11605 if (ShouldProduceTraceOutput()) {
11602 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11606 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11603 } 11607 }
11604 11608
11605 #ifdef DEBUG 11609 #ifdef DEBUG
11606 graph_->Verify(false); // No full verify. 11610 graph_->Verify(false); // No full verify.
11607 #endif 11611 #endif
11608 } 11612 }
11609 11613
11610 } } // namespace v8::internal 11614 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-363956.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698