| 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 // Need to load the script into the dart: core library due to | 521 // Need to load the script into the dart: core library due to |
| 522 // the import of dart:_internal. | 522 // the import of dart:_internal. |
| 523 TestCase::LoadCoreTestScript(kScriptChars, NULL); | 523 TestCase::LoadCoreTestScript(kScriptChars, NULL); |
| 524 Api::CheckAndFinalizePendingClasses(thread); | 524 Api::CheckAndFinalizePendingClasses(thread); |
| 525 | 525 |
| 526 // Write snapshot with object content. | 526 // Write snapshot with object content. |
| 527 FullSnapshotWriter writer(Snapshot::kCore, | 527 FullSnapshotWriter writer(Snapshot::kCore, |
| 528 &vm_isolate_snapshot_buffer, | 528 &vm_isolate_snapshot_buffer, |
| 529 &isolate_snapshot_buffer, | 529 &isolate_snapshot_buffer, |
| 530 &malloc_allocator, | 530 &malloc_allocator, |
| 531 NULL, /* instructions_writer */ | 531 NULL /* instructions_writer */); |
| 532 true /* vm_isolate_is_symbolic */); | |
| 533 writer.WriteFullSnapshot(); | 532 writer.WriteFullSnapshot(); |
| 534 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); | 533 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); |
| 535 ASSERT(snapshot->kind() == Snapshot::kCore); | 534 ASSERT(snapshot->kind() == Snapshot::kCore); |
| 536 benchmark->set_score(snapshot->length()); | 535 benchmark->set_score(snapshot->length()); |
| 537 } | 536 } |
| 538 | 537 |
| 539 | 538 |
| 540 BENCHMARK_SIZE(StandaloneSnapshotSize) { | 539 BENCHMARK_SIZE(StandaloneSnapshotSize) { |
| 541 const char* kScriptChars = | 540 const char* kScriptChars = |
| 542 "import 'dart:async';\n" | 541 "import 'dart:async';\n" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 558 // Need to load the script into the dart: core library due to | 557 // Need to load the script into the dart: core library due to |
| 559 // the import of dart:_internal. | 558 // the import of dart:_internal. |
| 560 TestCase::LoadCoreTestScript(kScriptChars, NULL); | 559 TestCase::LoadCoreTestScript(kScriptChars, NULL); |
| 561 Api::CheckAndFinalizePendingClasses(thread); | 560 Api::CheckAndFinalizePendingClasses(thread); |
| 562 | 561 |
| 563 // Write snapshot with object content. | 562 // Write snapshot with object content. |
| 564 FullSnapshotWriter writer(Snapshot::kCore, | 563 FullSnapshotWriter writer(Snapshot::kCore, |
| 565 &vm_isolate_snapshot_buffer, | 564 &vm_isolate_snapshot_buffer, |
| 566 &isolate_snapshot_buffer, | 565 &isolate_snapshot_buffer, |
| 567 &malloc_allocator, | 566 &malloc_allocator, |
| 568 NULL, /* instructions_writer */ | 567 NULL /* instructions_writer */); |
| 569 true /* vm_isolate_is_symbolic */); | |
| 570 writer.WriteFullSnapshot(); | 568 writer.WriteFullSnapshot(); |
| 571 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); | 569 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); |
| 572 ASSERT(snapshot->kind() == Snapshot::kCore); | 570 ASSERT(snapshot->kind() == Snapshot::kCore); |
| 573 benchmark->set_score(snapshot->length()); | 571 benchmark->set_score(snapshot->length()); |
| 574 } | 572 } |
| 575 | 573 |
| 576 | 574 |
| 577 BENCHMARK(CreateMirrorSystem) { | 575 BENCHMARK(CreateMirrorSystem) { |
| 578 const char* kScriptChars = | 576 const char* kScriptChars = |
| 579 "import 'dart:mirrors';\n" | 577 "import 'dart:mirrors';\n" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 thread); | 723 thread); |
| 726 reader.ReadObject(); | 724 reader.ReadObject(); |
| 727 free(buffer); | 725 free(buffer); |
| 728 } | 726 } |
| 729 timer.Stop(); | 727 timer.Stop(); |
| 730 int64_t elapsed_time = timer.TotalElapsedTime(); | 728 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 731 benchmark->set_score(elapsed_time); | 729 benchmark->set_score(elapsed_time); |
| 732 } | 730 } |
| 733 | 731 |
| 734 } // namespace dart | 732 } // namespace dart |
| OLD | NEW |