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

Side by Side Diff: src/ia32/assembler-ia32.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/assembler.cc ('k') | src/lithium.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 2479 matching lines...) Expand 10 before | Expand all | Expand 10 after
2490 } 2490 }
2491 } 2491 }
2492 2492
2493 2493
2494 void Assembler::GrowBuffer() { 2494 void Assembler::GrowBuffer() {
2495 DCHECK(buffer_overflow()); 2495 DCHECK(buffer_overflow());
2496 if (!own_buffer_) FATAL("external code buffer is too small"); 2496 if (!own_buffer_) FATAL("external code buffer is too small");
2497 2497
2498 // Compute new buffer size. 2498 // Compute new buffer size.
2499 CodeDesc desc; // the new buffer 2499 CodeDesc desc; // the new buffer
2500 if (buffer_size_ == 0) { 2500 desc.buffer_size = 2 * buffer_size_;
2501 desc.buffer_size = kMinimalBufferSize; 2501
2502 } else {
2503 desc.buffer_size = 2*buffer_size_;
2504 }
2505 // Some internal data structures overflow for very large buffers, 2502 // Some internal data structures overflow for very large buffers,
2506 // they must ensure that kMaximalBufferSize is not too large. 2503 // they must ensure that kMaximalBufferSize is not too large.
2507 if ((desc.buffer_size > kMaximalBufferSize) || 2504 if ((desc.buffer_size > kMaximalBufferSize) ||
2508 (desc.buffer_size > isolate()->heap()->MaxOldGenerationSize())) { 2505 (desc.buffer_size > isolate()->heap()->MaxOldGenerationSize())) {
2509 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); 2506 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer");
2510 } 2507 }
2511 2508
2512 // Set up new buffer. 2509 // Set up new buffer.
2513 desc.buffer = NewArray<byte>(desc.buffer_size); 2510 desc.buffer = NewArray<byte>(desc.buffer_size);
2514 desc.instr_size = pc_offset(); 2511 desc.instr_size = pc_offset();
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2665 fprintf(coverage_log, "%s\n", file_line); 2662 fprintf(coverage_log, "%s\n", file_line);
2666 fflush(coverage_log); 2663 fflush(coverage_log);
2667 } 2664 }
2668 } 2665 }
2669 2666
2670 #endif 2667 #endif
2671 2668
2672 } } // namespace v8::internal 2669 } } // namespace v8::internal
2673 2670
2674 #endif // V8_TARGET_ARCH_IA32 2671 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/lithium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698