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

Unified Diff: src/assembler.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm64/assembler-arm64.cc ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/assembler.cc
diff --git a/src/assembler.cc b/src/assembler.cc
index c35c81cc9f3f59dfbd85fc8e8ae5fba3e5095147..23746347aec6ca22676bb7491783d98afb1bfe8c 100644
--- a/src/assembler.cc
+++ b/src/assembler.cc
@@ -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;
« no previous file with comments | « src/arm64/assembler-arm64.cc ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698