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 |
11 #include "platform/assert.h" | 11 #include "platform/assert.h" |
12 #include "platform/globals.h" | 12 #include "platform/globals.h" |
13 | 13 |
14 #include "vm/clustered_snapshot.h" | 14 #include "vm/clustered_snapshot.h" |
15 #include "vm/compiler_stats.h" | 15 #include "vm/compiler_stats.h" |
16 #include "vm/dart_api_impl.h" | 16 #include "vm/dart_api_impl.h" |
17 #include "vm/stack_frame.h" | 17 #include "vm/stack_frame.h" |
18 #include "vm/unit_test.h" | 18 #include "vm/unit_test.h" |
19 | 19 |
20 using dart::bin::File; | 20 using dart::bin::File; |
21 | 21 |
22 namespace dart { | 22 namespace dart { |
23 | 23 |
| 24 DECLARE_FLAG(bool, use_dart_frontend); |
| 25 |
24 Benchmark* Benchmark::first_ = NULL; | 26 Benchmark* Benchmark::first_ = NULL; |
25 Benchmark* Benchmark::tail_ = NULL; | 27 Benchmark* Benchmark::tail_ = NULL; |
26 const char* Benchmark::executable_ = NULL; | 28 const char* Benchmark::executable_ = NULL; |
27 | 29 |
28 // | 30 // |
29 // Measure compile of all dart2js(compiler) functions. | 31 // Measure compile of all dart2js(compiler) functions. |
30 // | 32 // |
31 static char* ComputeDart2JSPath(const char* arg) { | 33 static char* ComputeDart2JSPath(const char* arg) { |
32 char buffer[2048]; | 34 char buffer[2048]; |
33 char* dart2js_path = strdup(File::GetCanonicalPath(arg)); | 35 char* dart2js_path = strdup(File::GetCanonicalPath(arg)); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 Benchmark* benchmark = first_; | 87 Benchmark* benchmark = first_; |
86 while (benchmark != NULL) { | 88 while (benchmark != NULL) { |
87 benchmark->RunBenchmark(); | 89 benchmark->RunBenchmark(); |
88 benchmark = benchmark->next_; | 90 benchmark = benchmark->next_; |
89 } | 91 } |
90 } | 92 } |
91 | 93 |
92 Dart_Isolate Benchmark::CreateIsolate(const uint8_t* snapshot_data, | 94 Dart_Isolate Benchmark::CreateIsolate(const uint8_t* snapshot_data, |
93 const uint8_t* snapshot_instructions) { | 95 const uint8_t* snapshot_instructions) { |
94 char* err = NULL; | 96 char* err = NULL; |
| 97 Dart_IsolateFlags api_flags; |
| 98 Isolate::FlagsInitialize(&api_flags); |
| 99 api_flags.use_dart_frontend = FLAG_use_dart_frontend; |
95 isolate_ = Dart_CreateIsolate(NULL, NULL, snapshot_data, | 100 isolate_ = Dart_CreateIsolate(NULL, NULL, snapshot_data, |
96 snapshot_instructions, NULL, NULL, &err); | 101 snapshot_instructions, &api_flags, NULL, &err); |
97 EXPECT(isolate_ != NULL); | 102 EXPECT(isolate_ != NULL); |
98 free(err); | 103 free(err); |
99 return isolate_; | 104 return isolate_; |
100 } | 105 } |
101 | 106 |
102 // | 107 // |
103 // Measure compile of all functions in dart core lib classes. | 108 // Measure compile of all functions in dart core lib classes. |
104 // | 109 // |
105 BENCHMARK(CorelibCompileAll) { | 110 BENCHMARK(CorelibCompileAll) { |
106 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); | 111 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 timer.Stop(); | 699 timer.Stop(); |
695 int64_t elapsed_time = timer.TotalElapsedTime(); | 700 int64_t elapsed_time = timer.TotalElapsedTime(); |
696 benchmark->set_score(elapsed_time); | 701 benchmark->set_score(elapsed_time); |
697 } | 702 } |
698 | 703 |
699 BENCHMARK_MEMORY(InitialRSS) { | 704 BENCHMARK_MEMORY(InitialRSS) { |
700 benchmark->set_score(OS::MaxRSS()); | 705 benchmark->set_score(OS::MaxRSS()); |
701 } | 706 } |
702 | 707 |
703 } // namespace dart | 708 } // namespace dart |
OLD | NEW |