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" |
11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
12 #include "vm/exceptions.h" | 12 #include "vm/exceptions.h" |
13 #include "vm/heap.h" | 13 #include "vm/heap.h" |
14 #include "vm/lockers.h" | 14 #include "vm/lockers.h" |
15 #include "vm/longjump.h" | 15 #include "vm/longjump.h" |
16 #include "vm/native_entry.h" | 16 #include "vm/native_entry.h" |
17 #include "vm/object.h" | 17 #include "vm/object.h" |
18 #include "vm/object_store.h" | 18 #include "vm/object_store.h" |
19 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
20 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
21 #include "vm/timeline.h" | 21 #include "vm/timeline.h" |
22 #include "vm/version.h" | 22 #include "vm/version.h" |
23 | 23 |
24 namespace dart { | 24 namespace dart { |
25 | 25 |
| 26 DEFINE_FLAG(bool, print_instruction_stats, false, |
| 27 "Print instruction statistics"); |
| 28 |
26 static RawObject* AllocateUninitialized(PageSpace* old_space, intptr_t size) { | 29 static RawObject* AllocateUninitialized(PageSpace* old_space, intptr_t size) { |
27 ASSERT(Utils::IsAligned(size, kObjectAlignment)); | 30 ASSERT(Utils::IsAligned(size, kObjectAlignment)); |
28 uword address = | 31 uword address = |
29 old_space->TryAllocateDataBumpLocked(size, PageSpace::kForceGrowth); | 32 old_space->TryAllocateDataBumpLocked(size, PageSpace::kForceGrowth); |
30 if (address == 0) { | 33 if (address == 0) { |
31 OUT_OF_MEMORY(); | 34 OUT_OF_MEMORY(); |
32 } | 35 } |
33 return reinterpret_cast<RawObject*>(address + kHeapObjectTag); | 36 return reinterpret_cast<RawObject*>(address + kHeapObjectTag); |
34 } | 37 } |
35 | 38 |
(...skipping 5289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5325 OS::Print("Instructions(CodeSize): %" Pd "\n", | 5328 OS::Print("Instructions(CodeSize): %" Pd "\n", |
5326 instructions_writer_->text_size()); | 5329 instructions_writer_->text_size()); |
5327 } | 5330 } |
5328 total_size += | 5331 total_size += |
5329 instructions_writer_->data_size() + instructions_writer_->text_size(); | 5332 instructions_writer_->data_size() + instructions_writer_->text_size(); |
5330 } | 5333 } |
5331 | 5334 |
5332 if (FLAG_print_snapshot_sizes) { | 5335 if (FLAG_print_snapshot_sizes) { |
5333 OS::Print("Total(CodeSize): %" Pd "\n", total_size); | 5336 OS::Print("Total(CodeSize): %" Pd "\n", total_size); |
5334 } | 5337 } |
| 5338 |
| 5339 if (FLAG_print_instruction_stats) { |
| 5340 instructions_writer_->DumpCombinedCodeStatistics(); |
| 5341 } |
5335 } | 5342 } |
5336 | 5343 |
5337 | 5344 |
5338 RawApiError* IsolateSnapshotReader::ReadFullSnapshot() { | 5345 RawApiError* IsolateSnapshotReader::ReadFullSnapshot() { |
5339 Deserializer deserializer(thread_, kind_, buffer_, size_, | 5346 Deserializer deserializer(thread_, kind_, buffer_, size_, |
5340 instructions_buffer_, data_buffer_); | 5347 instructions_buffer_, data_buffer_); |
5341 | 5348 |
5342 RawApiError* error = deserializer.VerifyVersionAndFeatures(); | 5349 RawApiError* error = deserializer.VerifyVersionAndFeatures(); |
5343 if (error != ApiError::null()) { | 5350 if (error != ApiError::null()) { |
5344 return error; | 5351 return error; |
(...skipping 16 matching lines...) Expand all Loading... |
5361 | 5368 |
5362 deserializer.ReadVMSnapshot(); | 5369 deserializer.ReadVMSnapshot(); |
5363 | 5370 |
5364 Dart::set_instructions_snapshot_buffer(instructions_buffer_); | 5371 Dart::set_instructions_snapshot_buffer(instructions_buffer_); |
5365 Dart::set_data_snapshot_buffer(data_buffer_); | 5372 Dart::set_data_snapshot_buffer(data_buffer_); |
5366 | 5373 |
5367 return ApiError::null(); | 5374 return ApiError::null(); |
5368 } | 5375 } |
5369 | 5376 |
5370 } // namespace dart | 5377 } // namespace dart |
OLD | NEW |