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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // The BENCHMARK macros are used for benchmarking a specific functionality | 32 // The BENCHMARK macros are used for benchmarking a specific functionality |
33 // of the VM. | 33 // of the VM. |
34 #define BENCHMARK_HELPER(name, kind) \ | 34 #define BENCHMARK_HELPER(name, kind) \ |
35 void Dart_Benchmark##name(Benchmark* benchmark); \ | 35 void Dart_Benchmark##name(Benchmark* benchmark); \ |
36 static Benchmark kRegister##name(Dart_Benchmark##name, #name, kind); \ | 36 static Benchmark kRegister##name(Dart_Benchmark##name, #name, kind); \ |
37 static void Dart_BenchmarkHelper##name(Benchmark* benchmark); \ | 37 static void Dart_BenchmarkHelper##name(Benchmark* benchmark); \ |
38 void Dart_Benchmark##name(Benchmark* benchmark) { \ | 38 void Dart_Benchmark##name(Benchmark* benchmark) { \ |
39 FLAG_old_gen_growth_space_ratio = 100; \ | 39 FLAG_old_gen_growth_space_ratio = 100; \ |
40 BenchmarkIsolateScope __isolate__(benchmark); \ | 40 BenchmarkIsolateScope __isolate__(benchmark); \ |
41 StackZone __zone__(benchmark->isolate()); \ | 41 Thread* __thread__ = Thread::Current(); \ |
42 HandleScope __hs__(benchmark->isolate()); \ | 42 ASSERT(__thread__->isolate() == benchmark->isolate()); \ |
| 43 StackZone __zone__(__thread__); \ |
| 44 HandleScope __hs__(__thread__); \ |
43 Dart_BenchmarkHelper##name(benchmark); \ | 45 Dart_BenchmarkHelper##name(benchmark); \ |
44 } \ | 46 } \ |
45 static void Dart_BenchmarkHelper##name(Benchmark* benchmark) | 47 static void Dart_BenchmarkHelper##name(Benchmark* benchmark) |
46 | 48 |
47 #define BENCHMARK(name) BENCHMARK_HELPER(name, "RunTime") | 49 #define BENCHMARK(name) BENCHMARK_HELPER(name, "RunTime") |
48 #define BENCHMARK_SIZE(name) BENCHMARK_HELPER(name, "CodeSize") | 50 #define BENCHMARK_SIZE(name) BENCHMARK_HELPER(name, "CodeSize") |
49 | 51 |
50 | 52 |
51 inline Dart_Handle NewString(const char* str) { | 53 inline Dart_Handle NewString(const char* str) { |
52 return Dart_NewStringFromCString(str); | 54 return Dart_NewStringFromCString(str); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 128 |
127 private: | 129 private: |
128 Benchmark* benchmark_; | 130 Benchmark* benchmark_; |
129 | 131 |
130 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); | 132 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); |
131 }; | 133 }; |
132 | 134 |
133 } // namespace dart | 135 } // namespace dart |
134 | 136 |
135 #endif // VM_BENCHMARK_TEST_H_ | 137 #endif // VM_BENCHMARK_TEST_H_ |
OLD | NEW |