| OLD | NEW |
| 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/hydrogen-check-elimination.h" | 5 #include "src/hydrogen-check-elimination.h" |
| 6 | 6 |
| 7 #include "src/hydrogen-alias-analysis.h" | 7 #include "src/hydrogen-alias-analysis.h" |
| 8 #include "src/hydrogen-flow-engine.h" | 8 #include "src/hydrogen-flow-engine.h" |
| 9 | 9 |
| 10 #define GLOBAL 1 | 10 #define GLOBAL 1 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 HGraph* graph = instr->block()->graph(); | 366 HGraph* graph = instr->block()->graph(); |
| 367 if (entry->maps_->IsSubset(instr->maps())) { | 367 if (entry->maps_->IsSubset(instr->maps())) { |
| 368 // The first check is more strict; the second is redundant. | 368 // The first check is more strict; the second is redundant. |
| 369 if (entry->check_ != NULL) { | 369 if (entry->check_ != NULL) { |
| 370 DCHECK_NE(HCheckTableEntry::UNCHECKED_STABLE, entry->state_); | 370 DCHECK_NE(HCheckTableEntry::UNCHECKED_STABLE, entry->state_); |
| 371 TRACE(("Replacing redundant CheckMaps #%d at B%d with #%d\n", | 371 TRACE(("Replacing redundant CheckMaps #%d at B%d with #%d\n", |
| 372 instr->id(), instr->block()->block_id(), entry->check_->id())); | 372 instr->id(), instr->block()->block_id(), entry->check_->id())); |
| 373 instr->DeleteAndReplaceWith(entry->check_); | 373 instr->DeleteAndReplaceWith(entry->check_); |
| 374 INC_STAT(redundant_); | 374 INC_STAT(redundant_); |
| 375 } else if (entry->state_ == HCheckTableEntry::UNCHECKED_STABLE) { | 375 } else if (entry->state_ == HCheckTableEntry::UNCHECKED_STABLE) { |
| 376 DCHECK_EQ(NULL, entry->check_); | 376 DCHECK(!entry->check_); |
| 377 TRACE(("Marking redundant CheckMaps #%d at B%d as stability check\n", | 377 TRACE(("Marking redundant CheckMaps #%d at B%d as stability check\n", |
| 378 instr->id(), instr->block()->block_id())); | 378 instr->id(), instr->block()->block_id())); |
| 379 instr->set_maps(entry->maps_->Copy(graph->zone())); | 379 instr->set_maps(entry->maps_->Copy(graph->zone())); |
| 380 instr->MarkAsStabilityCheck(); | 380 instr->MarkAsStabilityCheck(); |
| 381 entry->state_ = HCheckTableEntry::CHECKED_STABLE; | 381 entry->state_ = HCheckTableEntry::CHECKED_STABLE; |
| 382 } else if (!instr->IsStabilityCheck()) { | 382 } else if (!instr->IsStabilityCheck()) { |
| 383 TRACE(("Marking redundant CheckMaps #%d at B%d as dead\n", | 383 TRACE(("Marking redundant CheckMaps #%d at B%d as dead\n", |
| 384 instr->id(), instr->block()->block_id())); | 384 instr->id(), instr->block()->block_id())); |
| 385 // Mark check as dead but leave it in the graph as a checkpoint for | 385 // Mark check as dead but leave it in the graph as a checkpoint for |
| 386 // subsequent checks. | 386 // subsequent checks. |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 void Kill() { | 659 void Kill() { |
| 660 size_ = 0; | 660 size_ = 0; |
| 661 cursor_ = 0; | 661 cursor_ = 0; |
| 662 } | 662 } |
| 663 | 663 |
| 664 // Kill all unstable entries in the table. | 664 // Kill all unstable entries in the table. |
| 665 void KillUnstableEntries() { | 665 void KillUnstableEntries() { |
| 666 bool compact = false; | 666 bool compact = false; |
| 667 for (int i = 0; i < size_; ++i) { | 667 for (int i = 0; i < size_; ++i) { |
| 668 HCheckTableEntry* entry = &entries_[i]; | 668 HCheckTableEntry* entry = &entries_[i]; |
| 669 DCHECK_NOT_NULL(entry->object_); | 669 DCHECK(entry->object_); |
| 670 if (entry->state_ == HCheckTableEntry::CHECKED) { | 670 if (entry->state_ == HCheckTableEntry::CHECKED) { |
| 671 entry->object_ = NULL; | 671 entry->object_ = NULL; |
| 672 compact = true; | 672 compact = true; |
| 673 } else { | 673 } else { |
| 674 // All checked stable entries become unchecked stable. | 674 // All checked stable entries become unchecked stable. |
| 675 entry->state_ = HCheckTableEntry::UNCHECKED_STABLE; | 675 entry->state_ = HCheckTableEntry::UNCHECKED_STABLE; |
| 676 entry->check_ = NULL; | 676 entry->check_ = NULL; |
| 677 } | 677 } |
| 678 } | 678 } |
| 679 if (compact) Compact(); | 679 if (compact) Compact(); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 PRINT_STAT(removed_cit); | 894 PRINT_STAT(removed_cit); |
| 895 PRINT_STAT(narrowed); | 895 PRINT_STAT(narrowed); |
| 896 PRINT_STAT(loads); | 896 PRINT_STAT(loads); |
| 897 PRINT_STAT(empty); | 897 PRINT_STAT(empty); |
| 898 PRINT_STAT(compares_true); | 898 PRINT_STAT(compares_true); |
| 899 PRINT_STAT(compares_false); | 899 PRINT_STAT(compares_false); |
| 900 PRINT_STAT(transitions); | 900 PRINT_STAT(transitions); |
| 901 } | 901 } |
| 902 | 902 |
| 903 } } // namespace v8::internal | 903 } } // namespace v8::internal |
| OLD | NEW |