Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: runtime/vm/benchmark_test.h

Issue 2628283002: Support spawnUri in app snapshots. (Closed)
Patch Set: const pointer Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 RUNTIME_VM_BENCHMARK_TEST_H_ 5 #ifndef RUNTIME_VM_BENCHMARK_TEST_H_
6 #define RUNTIME_VM_BENCHMARK_TEST_H_ 6 #define RUNTIME_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, old_gen_growth_space_ratio); 20 DECLARE_FLAG(int, old_gen_growth_space_ratio);
21 21
22 namespace bin { 22 namespace bin {
23 // vm_isolate_snapshot_buffer points to a snapshot for the vm isolate if we 23 // vm_isolate_snapshot_buffer points to a snapshot for the vm isolate if we
24 // link in a snapshot otherwise it is initialized to NULL. 24 // link in a snapshot otherwise it is initialized to NULL.
25 extern const uint8_t* vm_isolate_snapshot_buffer; 25 extern const uint8_t* vm_isolate_snapshot_buffer;
26 26
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* const core_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, \
38 Thread* thread); \ 38 Thread* thread); \
39 void Dart_Benchmark##name(Benchmark* benchmark) { \ 39 void Dart_Benchmark##name(Benchmark* benchmark) { \
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 Dart_Isolate isolate_; 103 Dart_Isolate isolate_;
104 Benchmark* next_; 104 Benchmark* next_;
105 105
106 DISALLOW_COPY_AND_ASSIGN(Benchmark); 106 DISALLOW_COPY_AND_ASSIGN(Benchmark);
107 }; 107 };
108 108
109 109
110 class BenchmarkIsolateScope { 110 class BenchmarkIsolateScope {
111 public: 111 public:
112 explicit BenchmarkIsolateScope(Benchmark* benchmark) : benchmark_(benchmark) { 112 explicit BenchmarkIsolateScope(Benchmark* benchmark) : benchmark_(benchmark) {
113 benchmark_->CreateIsolate(bin::isolate_snapshot_buffer); 113 benchmark_->CreateIsolate(bin::core_isolate_snapshot_buffer);
114 Dart_EnterScope(); // Create a Dart API scope for unit benchmarks. 114 Dart_EnterScope(); // Create a Dart API scope for unit benchmarks.
115 } 115 }
116 ~BenchmarkIsolateScope() { 116 ~BenchmarkIsolateScope() {
117 Dart_ExitScope(); // Exit the Dart API scope created for unit tests. 117 Dart_ExitScope(); // Exit the Dart API scope created for unit tests.
118 ASSERT(benchmark_->isolate() == Isolate::Current()); 118 ASSERT(benchmark_->isolate() == Isolate::Current());
119 Dart_ShutdownIsolate(); 119 Dart_ShutdownIsolate();
120 benchmark_ = NULL; 120 benchmark_ = NULL;
121 } 121 }
122 Benchmark* benchmark() const { return benchmark_; } 122 Benchmark* benchmark() const { return benchmark_; }
123 123
124 private: 124 private:
125 Benchmark* benchmark_; 125 Benchmark* benchmark_;
126 126
127 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); 127 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope);
128 }; 128 };
129 129
130 } // namespace dart 130 } // namespace dart
131 131
132 #endif // RUNTIME_VM_BENCHMARK_TEST_H_ 132 #endif // RUNTIME_VM_BENCHMARK_TEST_H_
OLDNEW
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698