| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 SetExecutable(executable); | 89 SetExecutable(executable); |
| 90 Benchmark* benchmark = first_; | 90 Benchmark* benchmark = first_; |
| 91 while (benchmark != NULL) { | 91 while (benchmark != NULL) { |
| 92 benchmark->RunBenchmark(); | 92 benchmark->RunBenchmark(); |
| 93 benchmark = benchmark->next_; | 93 benchmark = benchmark->next_; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 | 97 |
| 98 Dart_Isolate Benchmark::CreateIsolate(const uint8_t* buffer) { | 98 Dart_Isolate Benchmark::CreateIsolate(const uint8_t* buffer) { |
| 99 bin::IsolateData* isolate_data = new bin::IsolateData(NULL, NULL, NULL); | |
| 100 char* err = NULL; | 99 char* err = NULL; |
| 101 isolate_ = Dart_CreateIsolate(NULL, NULL, buffer, NULL, isolate_data, &err); | 100 isolate_ = Dart_CreateIsolate(NULL, NULL, buffer, NULL, NULL, &err); |
| 102 EXPECT(isolate_ != NULL); | 101 EXPECT(isolate_ != NULL); |
| 103 free(err); | 102 free(err); |
| 104 return isolate_; | 103 return isolate_; |
| 105 } | 104 } |
| 106 | 105 |
| 107 | 106 |
| 108 // | 107 // |
| 109 // Measure compile of all functions in dart core lib classes. | 108 // Measure compile of all functions in dart core lib classes. |
| 110 // | 109 // |
| 111 BENCHMARK(CorelibCompileAll) { | 110 BENCHMARK(CorelibCompileAll) { |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 Api::CheckAndFinalizePendingClasses(thread); | 512 Api::CheckAndFinalizePendingClasses(thread); |
| 514 | 513 |
| 515 // Write snapshot with object content. | 514 // Write snapshot with object content. |
| 516 FullSnapshotWriter writer(Snapshot::kCore, &vm_isolate_snapshot_buffer, | 515 FullSnapshotWriter writer(Snapshot::kCore, &vm_isolate_snapshot_buffer, |
| 517 &isolate_snapshot_buffer, &malloc_allocator, | 516 &isolate_snapshot_buffer, &malloc_allocator, |
| 518 NULL /* instructions_writer */); | 517 NULL /* instructions_writer */); |
| 519 writer.WriteFullSnapshot(); | 518 writer.WriteFullSnapshot(); |
| 520 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); | 519 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); |
| 521 ASSERT(snapshot->kind() == Snapshot::kCore); | 520 ASSERT(snapshot->kind() == Snapshot::kCore); |
| 522 benchmark->set_score(snapshot->length()); | 521 benchmark->set_score(snapshot->length()); |
| 522 |
| 523 free(vm_isolate_snapshot_buffer); |
| 524 free(isolate_snapshot_buffer); |
| 523 } | 525 } |
| 524 | 526 |
| 525 | 527 |
| 526 BENCHMARK_SIZE(StandaloneSnapshotSize) { | 528 BENCHMARK_SIZE(StandaloneSnapshotSize) { |
| 527 const char* kScriptChars = | 529 const char* kScriptChars = |
| 528 "import 'dart:async';\n" | 530 "import 'dart:async';\n" |
| 529 "import 'dart:core';\n" | 531 "import 'dart:core';\n" |
| 530 "import 'dart:collection';\n" | 532 "import 'dart:collection';\n" |
| 531 "import 'dart:_internal';\n" | 533 "import 'dart:_internal';\n" |
| 532 "import 'dart:convert';\n" | 534 "import 'dart:convert';\n" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 547 Api::CheckAndFinalizePendingClasses(thread); | 549 Api::CheckAndFinalizePendingClasses(thread); |
| 548 | 550 |
| 549 // Write snapshot with object content. | 551 // Write snapshot with object content. |
| 550 FullSnapshotWriter writer(Snapshot::kCore, &vm_isolate_snapshot_buffer, | 552 FullSnapshotWriter writer(Snapshot::kCore, &vm_isolate_snapshot_buffer, |
| 551 &isolate_snapshot_buffer, &malloc_allocator, | 553 &isolate_snapshot_buffer, &malloc_allocator, |
| 552 NULL /* instructions_writer */); | 554 NULL /* instructions_writer */); |
| 553 writer.WriteFullSnapshot(); | 555 writer.WriteFullSnapshot(); |
| 554 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); | 556 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); |
| 555 ASSERT(snapshot->kind() == Snapshot::kCore); | 557 ASSERT(snapshot->kind() == Snapshot::kCore); |
| 556 benchmark->set_score(snapshot->length()); | 558 benchmark->set_score(snapshot->length()); |
| 559 |
| 560 free(vm_isolate_snapshot_buffer); |
| 561 free(isolate_snapshot_buffer); |
| 557 } | 562 } |
| 558 | 563 |
| 559 | 564 |
| 560 BENCHMARK(CreateMirrorSystem) { | 565 BENCHMARK(CreateMirrorSystem) { |
| 561 const char* kScriptChars = | 566 const char* kScriptChars = |
| 562 "import 'dart:mirrors';\n" | 567 "import 'dart:mirrors';\n" |
| 563 "\n" | 568 "\n" |
| 564 "void benchmark() {\n" | 569 "void benchmark() {\n" |
| 565 " currentMirrorSystem();\n" | 570 " currentMirrorSystem();\n" |
| 566 "}\n"; | 571 "}\n"; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 int64_t elapsed_time = timer.TotalElapsedTime(); | 711 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 707 benchmark->set_score(elapsed_time); | 712 benchmark->set_score(elapsed_time); |
| 708 } | 713 } |
| 709 | 714 |
| 710 | 715 |
| 711 BENCHMARK_MEMORY(InitialRSS) { | 716 BENCHMARK_MEMORY(InitialRSS) { |
| 712 benchmark->set_score(OS::MaxRSS()); | 717 benchmark->set_score(OS::MaxRSS()); |
| 713 } | 718 } |
| 714 | 719 |
| 715 } // namespace dart | 720 } // namespace dart |
| OLD | NEW |