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

Unified Diff: src/lithium-allocator.h

Issue 12867002: Fixed two register allocator bugs (off-by-one error/failure propagation). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed MIPS Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/lithium-allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lithium-allocator.h
diff --git a/src/lithium-allocator.h b/src/lithium-allocator.h
index 2ca853763e893343bf01315f2dafbfd5018c43d5..0e24d54dc47cc9803f44496b3f6ab484a27124b5 100644
--- a/src/lithium-allocator.h
+++ b/src/lithium-allocator.h
@@ -427,8 +427,10 @@ class LAllocator BASE_EMBEDDED {
Zone* zone() const { return zone_; }
int GetVirtualRegister() {
- if (next_virtual_register_ > LUnallocated::kMaxVirtualRegisters) {
+ if (next_virtual_register_ >= LUnallocated::kMaxVirtualRegisters) {
allocation_ok_ = false;
+ // Maintain the invariant that we return something below the maximum.
+ return 0;
}
return next_virtual_register_++;
}
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/lithium-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698