Index: src/lithium-allocator.h |
diff --git a/src/lithium-allocator.h b/src/lithium-allocator.h |
index 2953550ae8e879742ed19d0c4a9bba6cfc5bf5af..c7d910a0c4a7336ac55f28019220ed4261fb64a0 100644 |
--- a/src/lithium-allocator.h |
+++ b/src/lithium-allocator.h |
@@ -426,8 +426,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_++; |
} |