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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm64/assembler-arm64.cc ('k') | src/ia32/assembler-ia32.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 are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 : isolate_(isolate), 127 : isolate_(isolate),
128 jit_cookie_(0), 128 jit_cookie_(0),
129 enabled_cpu_features_(0), 129 enabled_cpu_features_(0),
130 emit_debug_code_(FLAG_debug_code), 130 emit_debug_code_(FLAG_debug_code),
131 predictable_code_size_(false), 131 predictable_code_size_(false),
132 // We may use the assembler without an isolate. 132 // We may use the assembler without an isolate.
133 serializer_enabled_(isolate && isolate->serializer_enabled()) { 133 serializer_enabled_(isolate && isolate->serializer_enabled()) {
134 if (FLAG_mask_constants_with_cookie && isolate != NULL) { 134 if (FLAG_mask_constants_with_cookie && isolate != NULL) {
135 jit_cookie_ = isolate->random_number_generator()->NextInt(); 135 jit_cookie_ = isolate->random_number_generator()->NextInt();
136 } 136 }
137 if (buffer == NULL) { 137 own_buffer_ = buffer == NULL;
138 // Do our own buffer management. 138 if (buffer_size == 0) buffer_size = kMinimalBufferSize;
139 buffer = NewArray<byte>(buffer_size); 139 DCHECK(buffer_size > 0);
140 own_buffer_ = true; 140 if (own_buffer_) buffer = NewArray<byte>(buffer_size);
141 } else {
142 // Use externally provided buffer instead.
143 DCHECK(buffer_size > 0);
144 own_buffer_ = false;
145 }
146 buffer_ = static_cast<byte*>(buffer); 141 buffer_ = static_cast<byte*>(buffer);
147 buffer_size_ = buffer_size; 142 buffer_size_ = buffer_size;
148 143
149 pc_ = buffer_; 144 pc_ = buffer_;
150 } 145 }
151 146
152 147
153 AssemblerBase::~AssemblerBase() { 148 AssemblerBase::~AssemblerBase() {
154 if (own_buffer_) DeleteArray(buffer_); 149 if (own_buffer_) DeleteArray(buffer_);
155 } 150 }
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 r2 = r2 - ad; 1596 r2 = r2 - ad;
1602 } 1597 }
1603 delta = ad - r2; 1598 delta = ad - r2;
1604 } while (q1 < delta || (q1 == delta && r1 == 0)); 1599 } while (q1 < delta || (q1 == delta && r1 == 0));
1605 int32_t mul = static_cast<int32_t>(q2 + 1); 1600 int32_t mul = static_cast<int32_t>(q2 + 1);
1606 multiplier_ = (d < 0) ? -mul : mul; 1601 multiplier_ = (d < 0) ? -mul : mul;
1607 shift_ = p - 32; 1602 shift_ = p - 32;
1608 } 1603 }
1609 1604
1610 } } // namespace v8::internal 1605 } } // namespace v8::internal
OLDNEW
« 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