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

Side by Side Diff: src/lithium-allocator.cc

Issue 769263002: Add support for enabling DCHECKs in release mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 6 years 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/hydrogen.h" 7 #include "src/hydrogen.h"
8 #include "src/lithium-inl.h" 8 #include "src/lithium-inl.h"
9 #include "src/lithium-allocator-inl.h" 9 #include "src/lithium-allocator-inl.h"
10 #include "src/string-stream.h" 10 #include "src/string-stream.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 void UseInterval::SplitAt(LifetimePosition pos, Zone* zone) { 59 void UseInterval::SplitAt(LifetimePosition pos, Zone* zone) {
60 DCHECK(Contains(pos) && pos.Value() != start().Value()); 60 DCHECK(Contains(pos) && pos.Value() != start().Value());
61 UseInterval* after = new(zone) UseInterval(pos, end_); 61 UseInterval* after = new(zone) UseInterval(pos, end_);
62 after->next_ = next_; 62 after->next_ = next_;
63 next_ = after; 63 next_ = after;
64 end_ = pos; 64 end_ = pos;
65 } 65 }
66 66
67 67
68 #ifdef DEBUG 68 #ifdef DEBUG
Jakob Kummerow 2014/12/03 10:53:53 forgotten?
69 69
70 70
71 void LiveRange::Verify() const { 71 void LiveRange::Verify() const {
72 UsePosition* cur = first_pos_; 72 UsePosition* cur = first_pos_;
73 while (cur != NULL) { 73 while (cur != NULL) {
74 DCHECK(Start().Value() <= cur->pos().Value() && 74 DCHECK(Start().Value() <= cur->pos().Value() &&
75 cur->pos().Value() <= End().Value()); 75 cur->pos().Value() <= End().Value());
76 cur = cur->next(); 76 cur = cur->next();
77 } 77 }
78 } 78 }
79 79
80 80
81 bool LiveRange::HasOverlap(UseInterval* target) const { 81 bool LiveRange::HasOverlap(UseInterval* target) const {
Jakob Kummerow 2014/12/03 10:53:53 This is dead code. Delete it while you're here, al
82 UseInterval* current_interval = first_interval_; 82 UseInterval* current_interval = first_interval_;
83 while (current_interval != NULL) { 83 while (current_interval != NULL) {
84 // Intervals overlap if the start of one is contained in the other. 84 // Intervals overlap if the start of one is contained in the other.
85 if (current_interval->Contains(target->start()) || 85 if (current_interval->Contains(target->start()) ||
86 target->Contains(current_interval->start())) { 86 target->Contains(current_interval->start())) {
87 return true; 87 return true;
88 } 88 }
89 current_interval = current_interval->next(); 89 current_interval = current_interval->next();
90 } 90 }
91 return false; 91 return false;
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 LiveRange* range = LiveRangeFor(operand_index); 1323 LiveRange* range = LiveRangeFor(operand_index);
1324 range->EnsureInterval(start, end, zone()); 1324 range->EnsureInterval(start, end, zone());
1325 iterator.Advance(); 1325 iterator.Advance();
1326 } 1326 }
1327 1327
1328 for (int i = block->block_id() + 1; i <= back_edge->block_id(); ++i) { 1328 for (int i = block->block_id() + 1; i <= back_edge->block_id(); ++i) {
1329 live_in_sets_[i]->Union(*live); 1329 live_in_sets_[i]->Union(*live);
1330 } 1330 }
1331 } 1331 }
1332 1332
1333 #ifdef DEBUG 1333 #ifdef DEBUG
Jakob Kummerow 2014/12/03 10:53:53 forgotten?
1334 if (block_id == 0) { 1334 if (block_id == 0) {
1335 BitVector::Iterator iterator(live); 1335 BitVector::Iterator iterator(live);
1336 bool found = false; 1336 bool found = false;
1337 while (!iterator.Done()) { 1337 while (!iterator.Done()) {
1338 found = true; 1338 found = true;
1339 int operand_index = iterator.Current(); 1339 int operand_index = iterator.Current();
1340 if (chunk_->info()->IsStub()) { 1340 if (chunk_->info()->IsStub()) {
1341 CodeStub::Major major_key = chunk_->info()->code_stub()->MajorKey(); 1341 CodeStub::Major major_key = chunk_->info()->code_stub()->MajorKey();
1342 PrintF("Function: %s\n", CodeStub::MajorName(major_key, false)); 1342 PrintF("Function: %s\n", CodeStub::MajorName(major_key, false));
1343 } else { 1343 } else {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 AddToInactive(current); 1512 AddToInactive(current);
1513 } 1513 }
1514 } 1514 }
1515 } 1515 }
1516 1516
1517 while (!unhandled_live_ranges_.is_empty()) { 1517 while (!unhandled_live_ranges_.is_empty()) {
1518 DCHECK(UnhandledIsSorted()); 1518 DCHECK(UnhandledIsSorted());
1519 LiveRange* current = unhandled_live_ranges_.RemoveLast(); 1519 LiveRange* current = unhandled_live_ranges_.RemoveLast();
1520 DCHECK(UnhandledIsSorted()); 1520 DCHECK(UnhandledIsSorted());
1521 LifetimePosition position = current->Start(); 1521 LifetimePosition position = current->Start();
1522 #ifdef DEBUG 1522 #if DCHECK_IS_ON
1523 allocation_finger_ = position; 1523 allocation_finger_ = position;
1524 #endif 1524 #endif
1525 TraceAlloc("Processing interval %d start=%d\n", 1525 TraceAlloc("Processing interval %d start=%d\n",
1526 current->id(), 1526 current->id(),
1527 position.Value()); 1527 position.Value());
1528 1528
1529 if (current->HasAllocatedSpillOperand()) { 1529 if (current->HasAllocatedSpillOperand()) {
1530 TraceAlloc("Live range %d already has a spill operand\n", current->id()); 1530 TraceAlloc("Live range %d already has a spill operand\n", current->id());
1531 LifetimePosition next_pos = position; 1531 LifetimePosition next_pos = position;
1532 if (IsGapAt(next_pos.InstructionIndex())) { 1532 if (IsGapAt(next_pos.InstructionIndex())) {
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
2142 } 2142 }
2143 range->MakeSpilled(chunk()->zone()); 2143 range->MakeSpilled(chunk()->zone());
2144 } 2144 }
2145 2145
2146 2146
2147 int LAllocator::RegisterCount() const { 2147 int LAllocator::RegisterCount() const {
2148 return num_registers_; 2148 return num_registers_;
2149 } 2149 }
2150 2150
2151 2151
2152 #ifdef DEBUG 2152 #ifdef DEBUG
Jakob Kummerow 2014/12/03 10:53:53 forgotten?
2153 2153
2154 2154
2155 void LAllocator::Verify() const { 2155 void LAllocator::Verify() const {
2156 for (int i = 0; i < live_ranges()->length(); ++i) { 2156 for (int i = 0; i < live_ranges()->length(); ++i) {
2157 LiveRange* current = live_ranges()->at(i); 2157 LiveRange* current = live_ranges()->at(i);
2158 if (current != NULL) current->Verify(); 2158 if (current != NULL) current->Verify();
2159 } 2159 }
2160 } 2160 }
2161 2161
2162 2162
(...skipping 15 matching lines...) Expand all
2178 unsigned size = allocator_->zone()->allocation_size() - 2178 unsigned size = allocator_->zone()->allocation_size() -
2179 allocator_zone_start_allocation_size_; 2179 allocator_zone_start_allocation_size_;
2180 isolate()->GetHStatistics()->SaveTiming(name(), base::TimeDelta(), size); 2180 isolate()->GetHStatistics()->SaveTiming(name(), base::TimeDelta(), size);
2181 } 2181 }
2182 2182
2183 if (ShouldProduceTraceOutput()) { 2183 if (ShouldProduceTraceOutput()) {
2184 isolate()->GetHTracer()->TraceLithium(name(), allocator_->chunk()); 2184 isolate()->GetHTracer()->TraceLithium(name(), allocator_->chunk());
2185 isolate()->GetHTracer()->TraceLiveRanges(name(), allocator_); 2185 isolate()->GetHTracer()->TraceLiveRanges(name(), allocator_);
2186 } 2186 }
2187 2187
2188 #ifdef DEBUG 2188 #ifdef DEBUG
Jakob Kummerow 2014/12/03 10:53:53 forgotten?
2189 if (allocator_ != NULL) allocator_->Verify(); 2189 if (allocator_ != NULL) allocator_->Verify();
2190 #endif 2190 #endif
2191 } 2191 }
2192 2192
2193 2193
2194 } } // namespace v8::internal 2194 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698