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 #ifndef VM_BENCHMARK_TEST_H_ | 5 #ifndef VM_BENCHMARK_TEST_H_ |
6 #define VM_BENCHMARK_TEST_H_ | 6 #define VM_BENCHMARK_TEST_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 void Dart_Benchmark##name(Benchmark* benchmark) { \ | 28 void Dart_Benchmark##name(Benchmark* benchmark) { \ |
29 FLAG_heap_growth_space_ratio = 100; \ | 29 FLAG_heap_growth_space_ratio = 100; \ |
30 BenchmarkIsolateScope __isolate__(benchmark); \ | 30 BenchmarkIsolateScope __isolate__(benchmark); \ |
31 StackZone __zone__(benchmark->isolate()); \ | 31 StackZone __zone__(benchmark->isolate()); \ |
32 HandleScope __hs__(benchmark->isolate()); \ | 32 HandleScope __hs__(benchmark->isolate()); \ |
33 Dart_BenchmarkHelper##name(benchmark); \ | 33 Dart_BenchmarkHelper##name(benchmark); \ |
34 } \ | 34 } \ |
35 static void Dart_BenchmarkHelper##name(Benchmark* benchmark) | 35 static void Dart_BenchmarkHelper##name(Benchmark* benchmark) |
36 | 36 |
37 | 37 |
| 38 inline Dart_Handle NewString(const char* str) { |
| 39 return Dart_NewStringFromCString(str); |
| 40 } |
| 41 |
| 42 |
38 class Benchmark { | 43 class Benchmark { |
39 public: | 44 public: |
40 typedef void (RunEntry)(Benchmark* benchmark); | 45 typedef void (RunEntry)(Benchmark* benchmark); |
41 | 46 |
42 Benchmark(RunEntry* run, const char* name) : | 47 Benchmark(RunEntry* run, const char* name) : |
43 run_(run), | 48 run_(run), |
44 name_(name), | 49 name_(name), |
45 score_(0), | 50 score_(0), |
46 isolate_(NULL), | 51 isolate_(NULL), |
47 next_(NULL) { | 52 next_(NULL) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 110 |
106 private: | 111 private: |
107 Benchmark* benchmark_; | 112 Benchmark* benchmark_; |
108 | 113 |
109 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); | 114 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); |
110 }; | 115 }; |
111 | 116 |
112 } // namespace dart | 117 } // namespace dart |
113 | 118 |
114 #endif // VM_BENCHMARK_TEST_H_ | 119 #endif // VM_BENCHMARK_TEST_H_ |
OLD | NEW |