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 16 matching lines...) Expand all Loading... |
27 // isolate_snapshot_buffer points to a snapshot for an isolate if we link in a | 27 // isolate_snapshot_buffer points to a snapshot for an isolate if we link in a |
28 // snapshot otherwise it is initialized to NULL. | 28 // snapshot otherwise it is initialized to NULL. |
29 extern const uint8_t* isolate_snapshot_buffer; | 29 extern const uint8_t* isolate_snapshot_buffer; |
30 } | 30 } |
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, Thread* thread);\ |
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 Thread* __thread__ = Thread::Current(); \ | 41 Thread* __thread__ = Thread::Current(); \ |
42 ASSERT(__thread__->isolate() == benchmark->isolate()); \ | 42 ASSERT(__thread__->isolate() == benchmark->isolate()); \ |
43 StackZone __zone__(__thread__); \ | 43 StackZone __zone__(__thread__); \ |
44 HandleScope __hs__(__thread__); \ | 44 HandleScope __hs__(__thread__); \ |
45 Dart_BenchmarkHelper##name(benchmark); \ | 45 Dart_BenchmarkHelper##name(benchmark, __thread__); \ |
46 } \ | 46 } \ |
47 static void Dart_BenchmarkHelper##name(Benchmark* benchmark) | 47 static void Dart_BenchmarkHelper##name(Benchmark* benchmark, Thread* thread) |
48 | 48 |
49 #define BENCHMARK(name) BENCHMARK_HELPER(name, "RunTime") | 49 #define BENCHMARK(name) BENCHMARK_HELPER(name, "RunTime") |
50 #define BENCHMARK_SIZE(name) BENCHMARK_HELPER(name, "CodeSize") | 50 #define BENCHMARK_SIZE(name) BENCHMARK_HELPER(name, "CodeSize") |
51 | 51 |
52 | 52 |
53 inline Dart_Handle NewString(const char* str) { | 53 inline Dart_Handle NewString(const char* str) { |
54 return Dart_NewStringFromCString(str); | 54 return Dart_NewStringFromCString(str); |
55 } | 55 } |
56 | 56 |
57 | 57 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 private: | 129 private: |
130 Benchmark* benchmark_; | 130 Benchmark* benchmark_; |
131 | 131 |
132 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); | 132 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); |
133 }; | 133 }; |
134 | 134 |
135 } // namespace dart | 135 } // namespace dart |
136 | 136 |
137 #endif // VM_BENCHMARK_TEST_H_ | 137 #endif // VM_BENCHMARK_TEST_H_ |
OLD | NEW |