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

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

Issue 11358024: Changes outside pkg/ and lib/ for directory refactoring (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
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 "vm/benchmark_test.h" 5 #include "vm/benchmark_test.h"
6 6
7 #include "bin/file.h" 7 #include "bin/file.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 10
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 benchmark->set_score(elapsed_time); 226 benchmark->set_score(elapsed_time);
227 } 227 }
228 228
229 229
230 // 230 //
231 // Measure compile of all dart2js(compiler) functions. 231 // Measure compile of all dart2js(compiler) functions.
232 // 232 //
233 static char* ComputeDart2JSPath(const char* arg) { 233 static char* ComputeDart2JSPath(const char* arg) {
234 char buffer[2048]; 234 char buffer[2048];
235 char* dart2js_path = strdup(File::GetCanonicalPath(arg)); 235 char* dart2js_path = strdup(File::GetCanonicalPath(arg));
236 const char* compiler_path = "%s%slib%scompiler%scompiler.dart"; 236 const char* compiler_path =
237 "%s%ssdk%slib%siinternal%scompiler%scompiler.dart";
237 const char* path_separator = File::PathSeparator(); 238 const char* path_separator = File::PathSeparator();
238 ASSERT(path_separator != NULL && strlen(path_separator) == 1); 239 ASSERT(path_separator != NULL && strlen(path_separator) == 1);
239 char* ptr = strrchr(dart2js_path, *path_separator); 240 char* ptr = strrchr(dart2js_path, *path_separator);
240 while (ptr != NULL) { 241 while (ptr != NULL) {
241 *ptr = '\0'; 242 *ptr = '\0';
242 OS::SNPrint(buffer, 2048, compiler_path, 243 OS::SNPrint(buffer, 2048, compiler_path,
243 dart2js_path, 244 dart2js_path,
244 path_separator, 245 path_separator,
245 path_separator, 246 path_separator,
246 path_separator); 247 path_separator);
(...skipping 17 matching lines...) Expand all
264 static Dart_NativeFunction NativeResolver(Dart_Handle name, 265 static Dart_NativeFunction NativeResolver(Dart_Handle name,
265 int arg_count) { 266 int arg_count) {
266 return &func; 267 return &func;
267 } 268 }
268 269
269 270
270 BENCHMARK(Dart2JSCompileAll) { 271 BENCHMARK(Dart2JSCompileAll) {
271 char* dart_root = ComputeDart2JSPath(Benchmark::Executable()); 272 char* dart_root = ComputeDart2JSPath(Benchmark::Executable());
272 char* script = NULL; 273 char* script = NULL;
273 if (dart_root != NULL) { 274 if (dart_root != NULL) {
274 const char* kFormatStr ="#import('%s/lib/compiler/compiler.dart');"; 275 const char* kFormatStr =
276 "#import('%s/sdk/lib/_internal/compiler/compiler.dart');";
275 intptr_t len = OS::SNPrint(NULL, 0, kFormatStr, dart_root) + 1; 277 intptr_t len = OS::SNPrint(NULL, 0, kFormatStr, dart_root) + 1;
276 script = reinterpret_cast<char*>(malloc(len)); 278 script = reinterpret_cast<char*>(malloc(len));
277 EXPECT(script != NULL); 279 EXPECT(script != NULL);
278 OS::SNPrint(script, len, kFormatStr, dart_root); 280 OS::SNPrint(script, len, kFormatStr, dart_root);
279 Dart_Handle lib = TestCase::LoadTestScript( 281 Dart_Handle lib = TestCase::LoadTestScript(
280 script, 282 script,
281 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); 283 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver));
282 EXPECT_VALID(lib); 284 EXPECT_VALID(lib);
283 } else { 285 } else {
284 Dart_Handle lib = TestCase::LoadTestScript( 286 Dart_Handle lib = TestCase::LoadTestScript(
285 "#import('lib/compiler/compiler.dart');", 287 "#import('sdk/lib/_internal/compiler/compiler.dart');",
286 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); 288 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver));
287 EXPECT_VALID(lib); 289 EXPECT_VALID(lib);
288 } 290 }
289 Timer timer(true, "Compile all of dart2js benchmark"); 291 Timer timer(true, "Compile all of dart2js benchmark");
290 timer.Start(); 292 timer.Start();
291 Dart_Handle result = Dart_CompileAll(); 293 Dart_Handle result = Dart_CompileAll();
292 EXPECT_VALID(result); 294 EXPECT_VALID(result);
293 timer.Stop(); 295 timer.Stop();
294 int64_t elapsed_time = timer.TotalElapsedTime(); 296 int64_t elapsed_time = timer.TotalElapsedTime();
295 benchmark->set_score(elapsed_time); 297 benchmark->set_score(elapsed_time);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrameTest")); 382 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrameTest"));
381 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL); 383 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL);
382 EXPECT_VALID(result); 384 EXPECT_VALID(result);
383 int64_t elapsed_time = 0; 385 int64_t elapsed_time = 0;
384 result = Dart_IntegerToInt64(result, &elapsed_time); 386 result = Dart_IntegerToInt64(result, &elapsed_time);
385 EXPECT_VALID(result); 387 EXPECT_VALID(result);
386 benchmark->set_score(elapsed_time); 388 benchmark->set_score(elapsed_time);
387 } 389 }
388 390
389 } // namespace dart 391 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698