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

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

Issue 2622053002: Refactor snapshots pieces to include a section for loading instructions into the heap of a regular … (Closed)
Patch Set: . Created 3 years, 11 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
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/gc_sweeper.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) 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 RUNTIME_VM_DATASTREAM_H_ 5 #ifndef RUNTIME_VM_DATASTREAM_H_
6 #define RUNTIME_VM_DATASTREAM_H_ 6 #define RUNTIME_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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 current_ = *buffer_; 307 current_ = *buffer_;
308 current_size_ = initial_size_; 308 current_size_ = initial_size_;
309 end_ = *buffer_ + initial_size_; 309 end_ = *buffer_ + initial_size_;
310 } 310 }
311 311
312 uint8_t* buffer() const { return *buffer_; } 312 uint8_t* buffer() const { return *buffer_; }
313 intptr_t bytes_written() const { return current_ - *buffer_; } 313 intptr_t bytes_written() const { return current_ - *buffer_; }
314 314
315 void set_current(uint8_t* value) { current_ = value; } 315 void set_current(uint8_t* value) { current_ = value; }
316 316
317 void Align(intptr_t alignment) {
318 intptr_t position = current_ - *buffer_;
319 position = Utils::RoundUp(position, alignment);
320 current_ = *buffer_ + position;
321 }
322
317 template <int N, typename T> 323 template <int N, typename T>
318 class Raw {}; 324 class Raw {};
319 325
320 template <typename T> 326 template <typename T>
321 class Raw<1, T> { 327 class Raw<1, T> {
322 public: 328 public:
323 static void Write(WriteStream* st, T value) { 329 static void Write(WriteStream* st, T value) {
324 st->WriteByte(bit_cast<int8_t>(value)); 330 st->WriteByte(bit_cast<int8_t>(value));
325 } 331 }
326 }; 332 };
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 intptr_t current_size_; 456 intptr_t current_size_;
451 ReAlloc alloc_; 457 ReAlloc alloc_;
452 intptr_t initial_size_; 458 intptr_t initial_size_;
453 459
454 DISALLOW_COPY_AND_ASSIGN(WriteStream); 460 DISALLOW_COPY_AND_ASSIGN(WriteStream);
455 }; 461 };
456 462
457 } // namespace dart 463 } // namespace dart
458 464
459 #endif // RUNTIME_VM_DATASTREAM_H_ 465 #endif // RUNTIME_VM_DATASTREAM_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/gc_sweeper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698