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

Side by Side Diff: src/x64/assembler-x64.cc

Issue 446933003: We should never allocate a 0-sized buffer, so never grow from 0. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Restore 0 as indication that you want kMinimalBufferSize Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/lithium.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 #include "src/serialize.h" 10 #include "src/serialize.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 bind_to(L, pc_offset()); 324 bind_to(L, pc_offset());
325 } 325 }
326 326
327 327
328 void Assembler::GrowBuffer() { 328 void Assembler::GrowBuffer() {
329 DCHECK(buffer_overflow()); 329 DCHECK(buffer_overflow());
330 if (!own_buffer_) FATAL("external code buffer is too small"); 330 if (!own_buffer_) FATAL("external code buffer is too small");
331 331
332 // Compute new buffer size. 332 // Compute new buffer size.
333 CodeDesc desc; // the new buffer 333 CodeDesc desc; // the new buffer
334 if (buffer_size_ == 0) { 334 desc.buffer_size = 2 * buffer_size_;
335 desc.buffer_size = kMinimalBufferSize; 335
336 } else {
337 desc.buffer_size = 2*buffer_size_;
338 }
339 // Some internal data structures overflow for very large buffers, 336 // Some internal data structures overflow for very large buffers,
340 // they must ensure that kMaximalBufferSize is not too large. 337 // they must ensure that kMaximalBufferSize is not too large.
341 if ((desc.buffer_size > kMaximalBufferSize) || 338 if ((desc.buffer_size > kMaximalBufferSize) ||
342 (desc.buffer_size > isolate()->heap()->MaxOldGenerationSize())) { 339 (desc.buffer_size > isolate()->heap()->MaxOldGenerationSize())) {
343 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); 340 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer");
344 } 341 }
345 342
346 // Set up new buffer. 343 // Set up new buffer.
347 desc.buffer = NewArray<byte>(desc.buffer_size); 344 desc.buffer = NewArray<byte>(desc.buffer_size);
348 desc.instr_size = pc_offset(); 345 desc.instr_size = pc_offset();
(...skipping 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after
2989 2986
2990 2987
2991 bool RelocInfo::IsInConstantPool() { 2988 bool RelocInfo::IsInConstantPool() {
2992 return false; 2989 return false;
2993 } 2990 }
2994 2991
2995 2992
2996 } } // namespace v8::internal 2993 } } // namespace v8::internal
2997 2994
2998 #endif // V8_TARGET_ARCH_X64 2995 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/lithium.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698