| 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 30 matching lines...) Expand all Loading... |
| 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, __thread__); \ | 45 Dart_BenchmarkHelper##name(benchmark, __thread__); \ |
| 46 } \ | 46 } \ |
| 47 static void Dart_BenchmarkHelper##name(Benchmark* benchmark, Thread* thread) | 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 #define BENCHMARK_MEMORY(name) BENCHMARK_HELPER(name, "Memory") |
| 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 |
| 58 class Benchmark { | 58 class Benchmark { |
| 59 public: | 59 public: |
| 60 typedef void (RunEntry)(Benchmark* benchmark); | 60 typedef void (RunEntry)(Benchmark* benchmark); |
| 61 | 61 |
| (...skipping 60 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 |