| OLD | NEW |
| 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 #include "vm/benchmark_test.h" | 5 #include "vm/benchmark_test.h" |
| 6 | 6 |
| 7 #include "bin/builtin.h" | 7 #include "bin/builtin.h" |
| 8 #include "bin/file.h" | 8 #include "bin/file.h" |
| 9 #include "bin/isolate_data.h" | 9 #include "bin/isolate_data.h" |
| 10 | 10 |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 "\n"; | 489 "\n"; |
| 490 | 490 |
| 491 // Start an Isolate, load a script and create a full snapshot. | 491 // Start an Isolate, load a script and create a full snapshot. |
| 492 uint8_t* vm_snapshot_data_buffer; | 492 uint8_t* vm_snapshot_data_buffer; |
| 493 uint8_t* isolate_snapshot_data_buffer; | 493 uint8_t* isolate_snapshot_data_buffer; |
| 494 // Need to load the script into the dart: core library due to | 494 // Need to load the script into the dart: core library due to |
| 495 // the import of dart:_internal. | 495 // the import of dart:_internal. |
| 496 TestCase::LoadCoreTestScript(kScriptChars, NULL); | 496 TestCase::LoadCoreTestScript(kScriptChars, NULL); |
| 497 Api::CheckAndFinalizePendingClasses(thread); | 497 Api::CheckAndFinalizePendingClasses(thread); |
| 498 | 498 |
| 499 TransitionNativeToVM transition(thread); |
| 499 // Write snapshot with object content. | 500 // Write snapshot with object content. |
| 500 FullSnapshotWriter writer(Snapshot::kFull, &vm_snapshot_data_buffer, | 501 FullSnapshotWriter writer(Snapshot::kFull, &vm_snapshot_data_buffer, |
| 501 &isolate_snapshot_data_buffer, &malloc_allocator, | 502 &isolate_snapshot_data_buffer, &malloc_allocator, |
| 502 NULL, NULL /* image_writer */); | 503 NULL, NULL /* image_writer */); |
| 503 writer.WriteFullSnapshot(); | 504 writer.WriteFullSnapshot(); |
| 504 const Snapshot* snapshot = | 505 const Snapshot* snapshot = |
| 505 Snapshot::SetupFromBuffer(isolate_snapshot_data_buffer); | 506 Snapshot::SetupFromBuffer(isolate_snapshot_data_buffer); |
| 506 ASSERT(snapshot->kind() == Snapshot::kFull); | 507 ASSERT(snapshot->kind() == Snapshot::kFull); |
| 507 benchmark->set_score(snapshot->length()); | 508 benchmark->set_score(snapshot->length()); |
| 508 | 509 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 526 "\n"; | 527 "\n"; |
| 527 | 528 |
| 528 // Start an Isolate, load a script and create a full snapshot. | 529 // Start an Isolate, load a script and create a full snapshot. |
| 529 uint8_t* vm_snapshot_data_buffer; | 530 uint8_t* vm_snapshot_data_buffer; |
| 530 uint8_t* isolate_snapshot_data_buffer; | 531 uint8_t* isolate_snapshot_data_buffer; |
| 531 // Need to load the script into the dart: core library due to | 532 // Need to load the script into the dart: core library due to |
| 532 // the import of dart:_internal. | 533 // the import of dart:_internal. |
| 533 TestCase::LoadCoreTestScript(kScriptChars, NULL); | 534 TestCase::LoadCoreTestScript(kScriptChars, NULL); |
| 534 Api::CheckAndFinalizePendingClasses(thread); | 535 Api::CheckAndFinalizePendingClasses(thread); |
| 535 | 536 |
| 537 TransitionNativeToVM transition(thread); |
| 536 // Write snapshot with object content. | 538 // Write snapshot with object content. |
| 537 FullSnapshotWriter writer(Snapshot::kFull, &vm_snapshot_data_buffer, | 539 FullSnapshotWriter writer(Snapshot::kFull, &vm_snapshot_data_buffer, |
| 538 &isolate_snapshot_data_buffer, &malloc_allocator, | 540 &isolate_snapshot_data_buffer, &malloc_allocator, |
| 539 NULL, NULL /* image_writer */); | 541 NULL, NULL /* image_writer */); |
| 540 writer.WriteFullSnapshot(); | 542 writer.WriteFullSnapshot(); |
| 541 const Snapshot* snapshot = | 543 const Snapshot* snapshot = |
| 542 Snapshot::SetupFromBuffer(isolate_snapshot_data_buffer); | 544 Snapshot::SetupFromBuffer(isolate_snapshot_data_buffer); |
| 543 ASSERT(snapshot->kind() == Snapshot::kFull); | 545 ASSERT(snapshot->kind() == Snapshot::kFull); |
| 544 benchmark->set_score(snapshot->length()); | 546 benchmark->set_score(snapshot->length()); |
| 545 | 547 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 timer.Stop(); | 694 timer.Stop(); |
| 693 int64_t elapsed_time = timer.TotalElapsedTime(); | 695 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 694 benchmark->set_score(elapsed_time); | 696 benchmark->set_score(elapsed_time); |
| 695 } | 697 } |
| 696 | 698 |
| 697 BENCHMARK_MEMORY(InitialRSS) { | 699 BENCHMARK_MEMORY(InitialRSS) { |
| 698 benchmark->set_score(OS::MaxRSS()); | 700 benchmark->set_score(OS::MaxRSS()); |
| 699 } | 701 } |
| 700 | 702 |
| 701 } // namespace dart | 703 } // namespace dart |
| OLD | NEW |