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

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

Issue 2654183002: Rename references to "external pages" as "snapshot pages" to avoid confusion with the kind of exter… (Closed)
Patch Set: image 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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_CLUSTERED_SNAPSHOT_H_ 5 #ifndef RUNTIME_VM_CLUSTERED_SNAPSHOT_H_
6 #define RUNTIME_VM_CLUSTERED_SNAPSHOT_H_ 6 #define RUNTIME_VM_CLUSTERED_SNAPSHOT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/bitfield.h" 10 #include "vm/bitfield.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 typedef DirectChainedHashMap<SmiObjectIdPairTrait> SmiObjectIdMap; 112 typedef DirectChainedHashMap<SmiObjectIdPairTrait> SmiObjectIdMap;
113 113
114 114
115 class Serializer : public StackResource { 115 class Serializer : public StackResource {
116 public: 116 public:
117 Serializer(Thread* thread, 117 Serializer(Thread* thread,
118 Snapshot::Kind kind, 118 Snapshot::Kind kind,
119 uint8_t** buffer, 119 uint8_t** buffer,
120 ReAlloc alloc, 120 ReAlloc alloc,
121 intptr_t initial_size, 121 intptr_t initial_size,
122 InstructionsWriter* instructions_writer_); 122 ImageWriter* image_writer_);
123 ~Serializer(); 123 ~Serializer();
124 124
125 intptr_t WriteVMSnapshot(const Array& symbols, const Array& scripts); 125 intptr_t WriteVMSnapshot(const Array& symbols, const Array& scripts);
126 void WriteIsolateSnapshot(intptr_t num_base_objects, 126 void WriteIsolateSnapshot(intptr_t num_base_objects,
127 ObjectStore* object_store); 127 ObjectStore* object_store);
128 128
129 void AddVMIsolateBaseObjects(); 129 void AddVMIsolateBaseObjects();
130 130
131 void AddBaseObject(RawObject* base_object) { 131 void AddBaseObject(RawObject* base_object) {
132 AssignRef(base_object); 132 AssignRef(base_object);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 void WriteTokenPosition(TokenPosition pos) { 252 void WriteTokenPosition(TokenPosition pos) {
253 Write<int32_t>(pos.SnapshotEncode()); 253 Write<int32_t>(pos.SnapshotEncode());
254 } 254 }
255 255
256 void WriteCid(intptr_t cid) { 256 void WriteCid(intptr_t cid) {
257 COMPILE_ASSERT(RawObject::kClassIdTagSize <= 32); 257 COMPILE_ASSERT(RawObject::kClassIdTagSize <= 32);
258 Write<int32_t>(cid); 258 Write<int32_t>(cid);
259 } 259 }
260 260
261 int32_t GetTextOffset(RawInstructions* instr, RawCode* code) { 261 int32_t GetTextOffset(RawInstructions* instr, RawCode* code) {
262 return instructions_writer_->GetOffsetFor(instr, code); 262 return image_writer_->GetOffsetFor(instr, code);
263 } 263 }
264 264
265 int32_t GetRODataOffset(RawObject* object) { 265 int32_t GetRODataOffset(RawObject* object) {
266 return instructions_writer_->GetObjectOffsetFor(object); 266 return image_writer_->GetObjectOffsetFor(object);
267 } 267 }
268 268
269 Snapshot::Kind kind() const { return kind_; } 269 Snapshot::Kind kind() const { return kind_; }
270 270
271 private: 271 private:
272 Heap* heap_; 272 Heap* heap_;
273 Zone* zone_; 273 Zone* zone_;
274 Snapshot::Kind kind_; 274 Snapshot::Kind kind_;
275 WriteStream stream_; 275 WriteStream stream_;
276 InstructionsWriter* instructions_writer_; 276 ImageWriter* image_writer_;
277 SerializationCluster** clusters_by_cid_; 277 SerializationCluster** clusters_by_cid_;
278 GrowableArray<RawObject*> stack_; 278 GrowableArray<RawObject*> stack_;
279 intptr_t num_cids_; 279 intptr_t num_cids_;
280 intptr_t num_base_objects_; 280 intptr_t num_base_objects_;
281 intptr_t num_written_objects_; 281 intptr_t num_written_objects_;
282 intptr_t next_ref_index_; 282 intptr_t next_ref_index_;
283 SmiObjectIdMap smi_ids_; 283 SmiObjectIdMap smi_ids_;
284 284
285 DISALLOW_IMPLICIT_CONSTRUCTORS(Serializer); 285 DISALLOW_IMPLICIT_CONSTRUCTORS(Serializer);
286 }; 286 };
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 }; 385 };
386 386
387 387
388 class FullSnapshotWriter { 388 class FullSnapshotWriter {
389 public: 389 public:
390 static const intptr_t kInitialSize = 64 * KB; 390 static const intptr_t kInitialSize = 64 * KB;
391 FullSnapshotWriter(Snapshot::Kind kind, 391 FullSnapshotWriter(Snapshot::Kind kind,
392 uint8_t** vm_snapshot_data_buffer, 392 uint8_t** vm_snapshot_data_buffer,
393 uint8_t** isolate_snapshot_data_buffer, 393 uint8_t** isolate_snapshot_data_buffer,
394 ReAlloc alloc, 394 ReAlloc alloc,
395 InstructionsWriter* vm_instructions_writer, 395 ImageWriter* vm_image_writer,
396 InstructionsWriter* iso_instructions_writer); 396 ImageWriter* iso_image_writer);
397 ~FullSnapshotWriter(); 397 ~FullSnapshotWriter();
398 398
399 uint8_t** vm_snapshot_data_buffer() const { return vm_snapshot_data_buffer_; } 399 uint8_t** vm_snapshot_data_buffer() const { return vm_snapshot_data_buffer_; }
400 400
401 uint8_t** isolate_snapshot_data_buffer() const { 401 uint8_t** isolate_snapshot_data_buffer() const {
402 return isolate_snapshot_data_buffer_; 402 return isolate_snapshot_data_buffer_;
403 } 403 }
404 404
405 Thread* thread() const { return thread_; } 405 Thread* thread() const { return thread_; }
406 Zone* zone() const { return thread_->zone(); } 406 Zone* zone() const { return thread_->zone(); }
(...skipping 14 matching lines...) Expand all
421 void WriteIsolateSnapshot(intptr_t num_base_objects); 421 void WriteIsolateSnapshot(intptr_t num_base_objects);
422 422
423 Thread* thread_; 423 Thread* thread_;
424 Snapshot::Kind kind_; 424 Snapshot::Kind kind_;
425 uint8_t** vm_snapshot_data_buffer_; 425 uint8_t** vm_snapshot_data_buffer_;
426 uint8_t** isolate_snapshot_data_buffer_; 426 uint8_t** isolate_snapshot_data_buffer_;
427 ReAlloc alloc_; 427 ReAlloc alloc_;
428 intptr_t vm_isolate_snapshot_size_; 428 intptr_t vm_isolate_snapshot_size_;
429 intptr_t isolate_snapshot_size_; 429 intptr_t isolate_snapshot_size_;
430 ForwardList* forward_list_; 430 ForwardList* forward_list_;
431 InstructionsWriter* vm_instructions_writer_; 431 ImageWriter* vm_image_writer_;
432 InstructionsWriter* isolate_instructions_writer_; 432 ImageWriter* isolate_image_writer_;
433 Array& token_streams_; 433 Array& token_streams_;
434 Array& saved_symbol_table_; 434 Array& saved_symbol_table_;
435 Array& new_vm_symbol_table_; 435 Array& new_vm_symbol_table_;
436 436
437 // Stats for benchmarking. 437 // Stats for benchmarking.
438 intptr_t clustered_vm_size_; 438 intptr_t clustered_vm_size_;
439 intptr_t clustered_isolate_size_; 439 intptr_t clustered_isolate_size_;
440 intptr_t mapped_data_size_; 440 intptr_t mapped_data_size_;
441 intptr_t mapped_instructions_size_; 441 intptr_t mapped_instructions_size_;
442 442
(...skipping 18 matching lines...) Expand all
461 intptr_t size_; 461 intptr_t size_;
462 const uint8_t* instructions_buffer_; 462 const uint8_t* instructions_buffer_;
463 const uint8_t* data_buffer_; 463 const uint8_t* data_buffer_;
464 464
465 DISALLOW_COPY_AND_ASSIGN(FullSnapshotReader); 465 DISALLOW_COPY_AND_ASSIGN(FullSnapshotReader);
466 }; 466 };
467 467
468 } // namespace dart 468 } // namespace dart
469 469
470 #endif // RUNTIME_VM_CLUSTERED_SNAPSHOT_H_ 470 #endif // RUNTIME_VM_CLUSTERED_SNAPSHOT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698