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

Side by Side Diff: runtime/vm/datastream.h

Issue 12340086: Force WriteByte to be inlined (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Line re-appeared Created 7 years, 9 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
« runtime/platform/globals.h ('K') | « runtime/platform/globals.h ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_DATASTREAM_H_ 5 #ifndef VM_DATASTREAM_H_
6 #define VM_DATASTREAM_H_ 6 #define VM_DATASTREAM_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 void Write(T value) { 211 void Write(T value) {
212 T v = value; 212 T v = value;
213 while (v < kMinDataPerByte || 213 while (v < kMinDataPerByte ||
214 v > kMaxDataPerByte) { 214 v > kMaxDataPerByte) {
215 WriteByte(static_cast<uint8_t>(v & kByteMask)); 215 WriteByte(static_cast<uint8_t>(v & kByteMask));
216 v = v >> kDataBitsPerByte; 216 v = v >> kDataBitsPerByte;
217 } 217 }
218 WriteByte(static_cast<uint8_t>(v + kEndByteMarker)); 218 WriteByte(static_cast<uint8_t>(v + kEndByteMarker));
219 } 219 }
220 220
221 void WriteByte(uint8_t value) { 221 DART_FORCE_INLINE void WriteByte(uint8_t value) {
222 if (current_ >= end_) { 222 if (current_ >= end_) {
223 Resize(1); 223 Resize(1);
224 } 224 }
225 ASSERT(current_ < end_); 225 ASSERT(current_ < end_);
226 *current_++ = value; 226 *current_++ = value;
227 } 227 }
228 228
229 void Resize(intptr_t size_needed) { 229 void Resize(intptr_t size_needed) {
230 intptr_t position = current_ - *buffer_; 230 intptr_t position = current_ - *buffer_;
231 intptr_t new_size = current_size_ + 231 intptr_t new_size = current_size_ +
(...skipping 15 matching lines...) Expand all
247 intptr_t current_size_; 247 intptr_t current_size_;
248 ReAlloc alloc_; 248 ReAlloc alloc_;
249 intptr_t increment_size_; 249 intptr_t increment_size_;
250 250
251 DISALLOW_COPY_AND_ASSIGN(WriteStream); 251 DISALLOW_COPY_AND_ASSIGN(WriteStream);
252 }; 252 };
253 253
254 } // namespace dart 254 } // namespace dart
255 255
256 #endif // VM_DATASTREAM_H_ 256 #endif // VM_DATASTREAM_H_
OLDNEW
« runtime/platform/globals.h ('K') | « runtime/platform/globals.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698