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

Side by Side Diff: vm/benchmark_test.cc

Issue 10269020: Fix build break. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 #include "platform/assert.h" 5 #include "platform/assert.h"
6 6
7 #include "vm/benchmark_test.h" 7 #include "vm/benchmark_test.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/stack_frame.h" 9 #include "vm/stack_frame.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 Dart_Invoke(lib, 174 Dart_Invoke(lib,
175 Dart_NewString("benchmark"), 175 Dart_NewString("benchmark"),
176 1, 176 1,
177 args); 177 args);
178 timer.Stop(); 178 timer.Stop();
179 int64_t elapsed_time = timer.TotalElapsedTime(); 179 int64_t elapsed_time = timer.TotalElapsedTime();
180 benchmark->set_score(elapsed_time); 180 benchmark->set_score(elapsed_time);
181 } 181 }
182 182
183 183
184 #if 0
184 // 185 //
185 // Measure compile of all dart2js(compiler) functions. 186 // Measure compile of all dart2js(compiler) functions.
186 // 187 //
187 static void func(Dart_NativeArguments args) { 188 static void func(Dart_NativeArguments args) {
188 } 189 }
189 190
190 191
191 static Dart_NativeFunction NativeResolver(Dart_Handle name, 192 static Dart_NativeFunction NativeResolver(Dart_Handle name,
192 int arg_count) { 193 int arg_count) {
193 return &func; 194 return &func;
194 } 195 }
195 196
196 197
197 BENCHMARK(Dart2JSCompileAll) { 198 BENCHMARK(Dart2JSCompileAll) {
198 const char* kScriptChars = "#import('../lib/compiler/compiler.dart');"; 199 const char* kScriptChars = "#import('lib/compiler/compiler.dart');";
199 Dart_Handle lib = TestCase::LoadTestScript( 200 Dart_Handle lib = TestCase::LoadTestScript(
200 kScriptChars, 201 kScriptChars,
201 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); 202 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver));
202 EXPECT(!Dart_IsError(lib)); 203 EXPECT(!Dart_IsError(lib));
203 Timer timer(true, "Compile all of dart2js benchmark"); 204 Timer timer(true, "Compile all of dart2js benchmark");
204 timer.Start(); 205 timer.Start();
205 Dart_Handle result = Dart_CompileAll(); 206 Dart_Handle result = Dart_CompileAll();
206 EXPECT(!Dart_IsError(result)); 207 EXPECT(!Dart_IsError(result));
207 timer.Stop(); 208 timer.Stop();
208 int64_t elapsed_time = timer.TotalElapsedTime(); 209 int64_t elapsed_time = timer.TotalElapsedTime();
209 benchmark->set_score(elapsed_time); 210 benchmark->set_score(elapsed_time);
210 } 211 }
212 #endif
211 213
212 214
213 // 215 //
214 // Measure frame lookup during stack traversal. 216 // Measure frame lookup during stack traversal.
215 // 217 //
216 static void StackFrame_accessFrame(Dart_NativeArguments args) { 218 static void StackFrame_accessFrame(Dart_NativeArguments args) {
217 const int kNumIterations = 100; 219 const int kNumIterations = 100;
218 Dart_EnterScope(); 220 Dart_EnterScope();
219 Code& code = Code::Handle(); 221 Code& code = Code::Handle();
220 Timer timer(true, "LookupDartCode benchmark"); 222 Timer timer(true, "LookupDartCode benchmark");
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 reinterpret_cast<Dart_NativeEntryResolver>(StackFrameNativeResolver)); 293 reinterpret_cast<Dart_NativeEntryResolver>(StackFrameNativeResolver));
292 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrameTest")); 294 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrameTest"));
293 Dart_Handle result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL); 295 Dart_Handle result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL);
294 EXPECT_VALID(result); 296 EXPECT_VALID(result);
295 int64_t elapsed_time = 0; 297 int64_t elapsed_time = 0;
296 EXPECT(!Dart_IsError(Dart_IntegerToInt64(result, &elapsed_time))); 298 EXPECT(!Dart_IsError(Dart_IntegerToInt64(result, &elapsed_time)));
297 benchmark->set_score(elapsed_time); 299 benchmark->set_score(elapsed_time);
298 } 300 }
299 301
300 } // namespace dart 302 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698