Commit aade11ed authored by verwaest@chromium.org's avatar verwaest@chromium.org

We should never allocate a 0-sized buffer, so never grow from 0.

BUG=
R=ishell@chromium.org

Review URL: https://codereview.chromium.org/446933003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22947 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7692ec62
......@@ -3202,9 +3202,7 @@ void Assembler::GrowBuffer() {
// Compute new buffer size.
CodeDesc desc; // the new buffer
if (buffer_size_ == 0) {
desc.buffer_size = kMinimalBufferSize;
} else if (buffer_size_ < 1*MB) {
if (buffer_size_ < 1 * MB) {
desc.buffer_size = 2*buffer_size_;
} else {
desc.buffer_size = buffer_size_ + 1*MB;
......
......@@ -2771,9 +2771,7 @@ void Assembler::GrowBuffer() {
// Compute new buffer size.
CodeDesc desc; // the new buffer
if (buffer_size_ == 0) {
desc.buffer_size = kMinimalBufferSize;
} else if (buffer_size_ < 1 * MB) {
if (buffer_size_ < 1 * MB) {
desc.buffer_size = 2 * buffer_size_;
} else {
desc.buffer_size = buffer_size_ + 1 * MB;
......
......@@ -134,15 +134,10 @@ AssemblerBase::AssemblerBase(Isolate* isolate, void* buffer, int buffer_size)
if (FLAG_mask_constants_with_cookie && isolate != NULL) {
jit_cookie_ = isolate->random_number_generator()->NextInt();
}
if (buffer == NULL) {
// Do our own buffer management.
buffer = NewArray<byte>(buffer_size);
own_buffer_ = true;
} else {
// Use externally provided buffer instead.
DCHECK(buffer_size > 0);
own_buffer_ = false;
}
own_buffer_ = buffer == NULL;
if (buffer_size == 0) buffer_size = kMinimalBufferSize;
DCHECK(buffer_size > 0);
if (own_buffer_) buffer = NewArray<byte>(buffer_size);
buffer_ = static_cast<byte*>(buffer);
buffer_size_ = buffer_size;
......
......@@ -2497,11 +2497,8 @@ void Assembler::GrowBuffer() {
// Compute new buffer size.
CodeDesc desc; // the new buffer
if (buffer_size_ == 0) {
desc.buffer_size = kMinimalBufferSize;
} else {
desc.buffer_size = 2*buffer_size_;
}
desc.buffer_size = 2 * buffer_size_;
// Some internal data structures overflow for very large buffers,
// they must ensure that kMaximalBufferSize is not too large.
if ((desc.buffer_size > kMaximalBufferSize) ||
......
......@@ -457,8 +457,7 @@ LChunk* LChunk::NewChunk(HGraph* graph) {
Handle<Code> LChunk::Codegen() {
MacroAssembler assembler(info()->isolate(), NULL,
Assembler::kMinimalBufferSize);
MacroAssembler assembler(info()->isolate(), NULL, 0);
LOG_CODE_EVENT(info()->isolate(),
CodeStartLinePosInfoRecordEvent(
assembler.positions_recorder()));
......
......@@ -331,11 +331,8 @@ void Assembler::GrowBuffer() {
// Compute new buffer size.
CodeDesc desc; // the new buffer
if (buffer_size_ == 0) {
desc.buffer_size = kMinimalBufferSize;
} else {
desc.buffer_size = 2*buffer_size_;
}
desc.buffer_size = 2 * buffer_size_;
// Some internal data structures overflow for very large buffers,
// they must ensure that kMaximalBufferSize is not too large.
if ((desc.buffer_size > kMaximalBufferSize) ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment