| 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" |
| 11 #include "vm/globals.h" | 11 #include "vm/globals.h" |
| 12 #include "vm/heap.h" | 12 #include "vm/heap.h" |
| 13 #include "vm/isolate.h" | 13 #include "vm/isolate.h" |
| 14 #include "vm/object.h" | 14 #include "vm/object.h" |
| 15 #include "vm/zone.h" | 15 #include "vm/zone.h" |
| 16 | 16 |
| 17 namespace dart { | 17 namespace dart { |
| 18 | 18 |
| 19 DECLARE_FLAG(int, code_heap_size); | 19 DECLARE_FLAG(int, code_heap_size); |
| 20 DECLARE_FLAG(int, heap_growth_space_ratio); | 20 DECLARE_FLAG(int, old_gen_growth_space_ratio); |
| 21 | 21 |
| 22 // snapshot_buffer points to a snapshot if we link in a snapshot otherwise | 22 // snapshot_buffer points to a snapshot if we link in a snapshot otherwise |
| 23 // it is initialized to NULL. | 23 // it is initialized to NULL. |
| 24 namespace bin { | 24 namespace bin { |
| 25 extern const uint8_t* snapshot_buffer; | 25 extern const uint8_t* snapshot_buffer; |
| 26 } | 26 } |
| 27 | 27 |
| 28 // The BENCHMARK macros are used for benchmarking a specific functionality | 28 // The BENCHMARK macros are used for benchmarking a specific functionality |
| 29 // of the VM. | 29 // of the VM. |
| 30 #define BENCHMARK_HELPER(name, kind) \ | 30 #define BENCHMARK_HELPER(name, kind) \ |
| 31 void Dart_Benchmark##name(Benchmark* benchmark); \ | 31 void Dart_Benchmark##name(Benchmark* benchmark); \ |
| 32 static Benchmark kRegister##name(Dart_Benchmark##name, #name, kind); \ | 32 static Benchmark kRegister##name(Dart_Benchmark##name, #name, kind); \ |
| 33 static void Dart_BenchmarkHelper##name(Benchmark* benchmark); \ | 33 static void Dart_BenchmarkHelper##name(Benchmark* benchmark); \ |
| 34 void Dart_Benchmark##name(Benchmark* benchmark) { \ | 34 void Dart_Benchmark##name(Benchmark* benchmark) { \ |
| 35 FLAG_heap_growth_space_ratio = 100; \ | 35 FLAG_old_gen_growth_space_ratio = 100; \ |
| 36 BenchmarkIsolateScope __isolate__(benchmark); \ | 36 BenchmarkIsolateScope __isolate__(benchmark); \ |
| 37 StackZone __zone__(benchmark->isolate()); \ | 37 StackZone __zone__(benchmark->isolate()); \ |
| 38 HandleScope __hs__(benchmark->isolate()); \ | 38 HandleScope __hs__(benchmark->isolate()); \ |
| 39 Dart_BenchmarkHelper##name(benchmark); \ | 39 Dart_BenchmarkHelper##name(benchmark); \ |
| 40 } \ | 40 } \ |
| 41 static void Dart_BenchmarkHelper##name(Benchmark* benchmark) | 41 static void Dart_BenchmarkHelper##name(Benchmark* benchmark) |
| 42 | 42 |
| 43 #define BENCHMARK(name) BENCHMARK_HELPER(name, "RunTime") | 43 #define BENCHMARK(name) BENCHMARK_HELPER(name, "RunTime") |
| 44 #define BENCHMARK_SIZE(name) BENCHMARK_HELPER(name, "CodeSize") | 44 #define BENCHMARK_SIZE(name) BENCHMARK_HELPER(name, "CodeSize") |
| 45 | 45 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 Benchmark* benchmark_; | 124 Benchmark* benchmark_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); | 126 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace dart | 129 } // namespace dart |
| 130 | 130 |
| 131 #endif // VM_BENCHMARK_TEST_H_ | 131 #endif // VM_BENCHMARK_TEST_H_ |
| OLD | NEW |