Index: src/mips64/assembler-mips64.cc |
diff --git a/src/mips64/assembler-mips64.cc b/src/mips64/assembler-mips64.cc |
index 52a3b3947cd8b25def5aea5f0b3885e26e6993fc..f70ee313351f29d6bda3bd51d0717a6fc7bd0328 100644 |
--- a/src/mips64/assembler-mips64.cc |
+++ b/src/mips64/assembler-mips64.cc |
@@ -3795,13 +3795,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); |