OLD | NEW |
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 #include "vm/clustered_snapshot.h" | 5 #include "vm/clustered_snapshot.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
(...skipping 5331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5342 // generated from a VM that has loaded this snapshots, much like app-jit | 5342 // generated from a VM that has loaded this snapshots, much like app-jit |
5343 // snapshots. | 5343 // snapshots. |
5344 if ((vm_snapshot_data_buffer != NULL) && (kind != Snapshot::kFullAOT)) { | 5344 if ((vm_snapshot_data_buffer != NULL) && (kind != Snapshot::kFullAOT)) { |
5345 NOT_IN_PRODUCT(TimelineDurationScope tds( | 5345 NOT_IN_PRODUCT(TimelineDurationScope tds( |
5346 thread(), Timeline::GetIsolateStream(), "PrepareNewVMIsolate")); | 5346 thread(), Timeline::GetIsolateStream(), "PrepareNewVMIsolate")); |
5347 | 5347 |
5348 // Collect all the token stream objects into an array so that we can write | 5348 // Collect all the token stream objects into an array so that we can write |
5349 // it out as part of the VM isolate snapshot. We first count the number of | 5349 // it out as part of the VM isolate snapshot. We first count the number of |
5350 // token streams, allocate an array and then fill it up with the token | 5350 // token streams, allocate an array and then fill it up with the token |
5351 // streams. | 5351 // streams. |
5352 SnapshotTokenStreamVisitor token_streams_counter(thread()); | 5352 { |
5353 heap()->IterateOldObjects(&token_streams_counter); | 5353 HeapIterationScope iteration(thread()); |
5354 Dart::vm_isolate()->heap()->IterateOldObjects(&token_streams_counter); | 5354 SnapshotTokenStreamVisitor token_streams_counter(thread()); |
5355 intptr_t count = token_streams_counter.count(); | 5355 iteration.IterateObjects(&token_streams_counter); |
5356 token_streams_ = Array::New(count, Heap::kOld); | 5356 iteration.IterateVMIsolateObjects(&token_streams_counter); |
5357 SnapshotTokenStreamVisitor script_visitor(thread(), &token_streams_); | 5357 intptr_t count = token_streams_counter.count(); |
5358 heap()->IterateOldObjects(&script_visitor); | 5358 token_streams_ = Array::New(count, Heap::kOld); |
5359 Dart::vm_isolate()->heap()->IterateOldObjects(&script_visitor); | 5359 SnapshotTokenStreamVisitor script_visitor(thread(), &token_streams_); |
5360 ASSERT(script_visitor.count() == count); | 5360 iteration.IterateObjects(&script_visitor); |
| 5361 iteration.IterateVMIsolateObjects(&script_visitor); |
| 5362 ASSERT(script_visitor.count() == count); |
| 5363 } |
5361 | 5364 |
5362 // Tuck away the current symbol table. | 5365 // Tuck away the current symbol table. |
5363 saved_symbol_table_ = object_store->symbol_table(); | 5366 saved_symbol_table_ = object_store->symbol_table(); |
5364 | 5367 |
5365 // Create a unified symbol table that will be written as the vm isolate's | 5368 // Create a unified symbol table that will be written as the vm isolate's |
5366 // symbol table. | 5369 // symbol table. |
5367 new_vm_symbol_table_ = Symbols::UnifiedSymbolTable(); | 5370 new_vm_symbol_table_ = Symbols::UnifiedSymbolTable(); |
5368 | 5371 |
5369 // Create an empty symbol table that will be written as the isolate's symbol | 5372 // Create an empty symbol table that will be written as the isolate's symbol |
5370 // table. | 5373 // table. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5531 thread_->isolate()->SetupImagePage(data_buffer_, | 5534 thread_->isolate()->SetupImagePage(data_buffer_, |
5532 /* is_executable */ false); | 5535 /* is_executable */ false); |
5533 } | 5536 } |
5534 | 5537 |
5535 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); | 5538 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); |
5536 | 5539 |
5537 return ApiError::null(); | 5540 return ApiError::null(); |
5538 } | 5541 } |
5539 | 5542 |
5540 } // namespace dart | 5543 } // namespace dart |
OLD | NEW |