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

Side by Side Diff: src/hydrogen-check-elimination.cc

Issue 295743002: Refactor transitioning stores. (Closed) Base URL: git@github.com:v8/v8.git@master
Patch Set: Created 6 years, 7 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 | « src/hydrogen.cc ('k') | src/hydrogen-escape-analysis.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 "hydrogen-check-elimination.h" 5 #include "hydrogen-check-elimination.h"
6 6
7 #include "hydrogen-alias-analysis.h" 7 #include "hydrogen-alias-analysis.h"
8 #include "hydrogen-flow-engine.h" 8 #include "hydrogen-flow-engine.h"
9 9
10 #define GLOBAL 1 10 #define GLOBAL 1
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 HValue* value = instr->value()->ActualValue(); 444 HValue* value = instr->value()->ActualValue();
445 if (Find(value) != NULL) { 445 if (Find(value) != NULL) {
446 // If the object has known maps, it's definitely a heap object. 446 // If the object has known maps, it's definitely a heap object.
447 instr->DeleteAndReplaceWith(value); 447 instr->DeleteAndReplaceWith(value);
448 INC_STAT(removed_cho_); 448 INC_STAT(removed_cho_);
449 } 449 }
450 } 450 }
451 451
452 void ReduceStoreNamedField(HStoreNamedField* instr) { 452 void ReduceStoreNamedField(HStoreNamedField* instr) {
453 HValue* object = instr->object()->ActualValue(); 453 HValue* object = instr->object()->ActualValue();
454 if (instr->has_transition()) { 454 if (instr->access().IsMap()) {
455 // This store transitions the object to a new map.
456 Kill(object);
457 HConstant* c_transition = HConstant::cast(instr->transition());
458 HCheckTableEntry::State state = c_transition->HasStableMapValue()
459 ? HCheckTableEntry::CHECKED_STABLE
460 : HCheckTableEntry::CHECKED;
461 Insert(object, NULL, c_transition->MapValue(), state);
462 } else if (instr->access().IsMap()) {
463 // This is a store directly to the map field of the object. 455 // This is a store directly to the map field of the object.
464 Kill(object); 456 Kill(object);
465 if (!instr->value()->IsConstant()) return; 457 if (!instr->value()->IsConstant()) return;
466 HConstant* c_value = HConstant::cast(instr->value()); 458 HConstant* c_value = HConstant::cast(instr->value());
467 HCheckTableEntry::State state = c_value->HasStableMapValue() 459 HCheckTableEntry::State state = c_value->HasStableMapValue()
468 ? HCheckTableEntry::CHECKED_STABLE 460 ? HCheckTableEntry::CHECKED_STABLE
469 : HCheckTableEntry::CHECKED; 461 : HCheckTableEntry::CHECKED;
470 Insert(object, NULL, c_value->MapValue(), state); 462 Insert(object, NULL, c_value->MapValue(), state);
471 } else { 463 } else {
472 // If the instruction changes maps, it should be handled above. 464 // If the instruction changes maps, it should be handled above.
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 explicit HCheckMapsEffects(Zone* zone) : objects_(0, zone) { } 699 explicit HCheckMapsEffects(Zone* zone) : objects_(0, zone) { }
708 700
709 // Effects are _not_ disabled. 701 // Effects are _not_ disabled.
710 inline bool Disabled() const { return false; } 702 inline bool Disabled() const { return false; }
711 703
712 // Process a possibly side-effecting instruction. 704 // Process a possibly side-effecting instruction.
713 void Process(HInstruction* instr, Zone* zone) { 705 void Process(HInstruction* instr, Zone* zone) {
714 switch (instr->opcode()) { 706 switch (instr->opcode()) {
715 case HValue::kStoreNamedField: { 707 case HValue::kStoreNamedField: {
716 HStoreNamedField* store = HStoreNamedField::cast(instr); 708 HStoreNamedField* store = HStoreNamedField::cast(instr);
717 if (store->access().IsMap() || store->has_transition()) { 709 if (store->access().IsMap()) {
718 objects_.Add(store->object(), zone); 710 objects_.Add(store->object(), zone);
719 } 711 }
720 break; 712 break;
721 } 713 }
722 case HValue::kTransitionElementsKind: { 714 case HValue::kTransitionElementsKind: {
723 objects_.Add(HTransitionElementsKind::cast(instr)->object(), zone); 715 objects_.Add(HTransitionElementsKind::cast(instr)->object(), zone);
724 break; 716 break;
725 } 717 }
726 default: { 718 default: {
727 flags_.Add(instr->ChangesFlags()); 719 flags_.Add(instr->ChangesFlags());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 PRINT_STAT(removed_cho); 788 PRINT_STAT(removed_cho);
797 PRINT_STAT(narrowed); 789 PRINT_STAT(narrowed);
798 PRINT_STAT(loads); 790 PRINT_STAT(loads);
799 PRINT_STAT(empty); 791 PRINT_STAT(empty);
800 PRINT_STAT(compares_true); 792 PRINT_STAT(compares_true);
801 PRINT_STAT(compares_false); 793 PRINT_STAT(compares_false);
802 PRINT_STAT(transitions); 794 PRINT_STAT(transitions);
803 } 795 }
804 796
805 } } // namespace v8::internal 797 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-escape-analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698