| 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); |
| 20 |
| 19 // The BENCHMARK macro is used for benchmarking a specific functionality | 21 // The BENCHMARK macro is used for benchmarking a specific functionality |
| 20 // of the VM | 22 // of the VM |
| 21 #define BENCHMARK(name) \ | 23 #define BENCHMARK(name) \ |
| 22 void Dart_Benchmark##name(Benchmark* benchmark); \ | 24 void Dart_Benchmark##name(Benchmark* benchmark); \ |
| 23 static const Benchmark kRegister##name(Dart_Benchmark##name, #name); \ | 25 static const Benchmark kRegister##name(Dart_Benchmark##name, #name); \ |
| 24 static void Dart_BenchmarkHelper##name(Benchmark* benchmark); \ | 26 static void Dart_BenchmarkHelper##name(Benchmark* benchmark); \ |
| 25 void Dart_Benchmark##name(Benchmark* benchmark) { \ | 27 void Dart_Benchmark##name(Benchmark* benchmark) { \ |
| 28 FLAG_code_heap_size = 10; \ |
| 26 BenchmarkIsolateScope __isolate__(benchmark); \ | 29 BenchmarkIsolateScope __isolate__(benchmark); \ |
| 27 Zone __zone__(benchmark->isolate()); \ | 30 Zone __zone__(benchmark->isolate()); \ |
| 28 HandleScope __hs__(benchmark->isolate()); \ | 31 HandleScope __hs__(benchmark->isolate()); \ |
| 29 Dart_BenchmarkHelper##name(benchmark); \ | 32 Dart_BenchmarkHelper##name(benchmark); \ |
| 30 } \ | 33 } \ |
| 31 static void Dart_BenchmarkHelper##name(Benchmark* benchmark) | 34 static void Dart_BenchmarkHelper##name(Benchmark* benchmark) |
| 32 | 35 |
| 33 | 36 |
| 34 class Benchmark { | 37 class Benchmark { |
| 35 public: | 38 public: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 104 |
| 102 private: | 105 private: |
| 103 Benchmark* benchmark_; | 106 Benchmark* benchmark_; |
| 104 | 107 |
| 105 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); | 108 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); |
| 106 }; | 109 }; |
| 107 | 110 |
| 108 } // namespace dart | 111 } // namespace dart |
| 109 | 112 |
| 110 #endif // VM_BENCHMARK_TEST_H_ | 113 #endif // VM_BENCHMARK_TEST_H_ |
| OLD | NEW |