Index: src/mips/assembler-mips.cc |
diff --git a/src/mips/assembler-mips.cc b/src/mips/assembler-mips.cc |
index 8558767d2da774b8d80e4e7eea264f4f79dc6862..3a37c16e5a0efdde2470d7312793b33bd2419a8a 100644 |
--- a/src/mips/assembler-mips.cc |
+++ b/src/mips/assembler-mips.cc |
@@ -3549,13 +3549,20 @@ void Assembler::GrowBuffer() { |
if (!own_buffer_) FATAL("external code buffer is too small"); |
// Compute new buffer size. |
- CodeDesc desc; // The new buffer. |
+ CodeDesc desc; // the new buffer |
if (buffer_size_ < 1 * MB) { |
desc.buffer_size = 2*buffer_size_; |
} else { |
desc.buffer_size = buffer_size_ + 1*MB; |
} |
- CHECK_GT(desc.buffer_size, 0); // No overflow. |
+ |
+ // Some internal data structures overflow for very large buffers, |
+ // they must ensure that kMaximalBufferSize is not too large. |
+ if (desc.buffer_size > kMaximalBufferSize || |
+ static_cast<size_t>(desc.buffer_size) > |
+ isolate_data().max_old_generation_size_) { |
+ V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); |
+ } |
// Set up new buffer. |
desc.buffer = NewArray<byte>(desc.buffer_size); |