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

Side by Side Diff: vm/benchmark_test.cc

Issue 10911025: Get rid of support for string interpolation in #import strings. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 3 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 | « tests/vm/vm.status ('k') | vm/dart_api_impl.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 #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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 272
273 273
274 static Dart_NativeFunction NativeResolver(Dart_Handle name, 274 static Dart_NativeFunction NativeResolver(Dart_Handle name,
275 int arg_count) { 275 int arg_count) {
276 return &func; 276 return &func;
277 } 277 }
278 278
279 279
280 BENCHMARK(Dart2JSCompileAll) { 280 BENCHMARK(Dart2JSCompileAll) {
281 char* dart_root = ComputeDart2JSPath(Benchmark::Executable()); 281 char* dart_root = ComputeDart2JSPath(Benchmark::Executable());
282 Dart_Handle import_map; 282 char* script = NULL;
283 if (dart_root != NULL) { 283 if (dart_root != NULL) {
284 import_map = Dart_NewList(2); 284 const char* kFormatStr ="#import('%s/lib/compiler/compiler.dart');";
285 Dart_ListSetAt(import_map, 0, Dart_NewString("DART_ROOT")); 285 intptr_t len = OS::SNPrint(NULL, 0, kFormatStr, dart_root) + 1;
286 Dart_ListSetAt(import_map, 1, Dart_NewString(dart_root)); 286 script = reinterpret_cast<char*>(malloc(len));
287 EXPECT(script != NULL);
288 OS::SNPrint(script, len, kFormatStr, dart_root);
289 Dart_Handle lib = TestCase::LoadTestScript(
290 script,
291 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver));
292 EXPECT_VALID(lib);
287 } else { 293 } else {
288 import_map = Dart_NewList(0); 294 Dart_Handle lib = TestCase::LoadTestScript(
295 "#import('lib/compiler/compiler.dart');",
296 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver));
297 EXPECT_VALID(lib);
289 } 298 }
290 const char* kScriptChars =
291 "#import('${DART_ROOT}/lib/compiler/compiler.dart');";
292 Dart_Handle lib = TestCase::LoadTestScript(
293 kScriptChars,
294 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver),
295 import_map);
296 EXPECT_VALID(lib);
297 Timer timer(true, "Compile all of dart2js benchmark"); 299 Timer timer(true, "Compile all of dart2js benchmark");
298 timer.Start(); 300 timer.Start();
299 Dart_Handle result = Dart_CompileAll(); 301 Dart_Handle result = Dart_CompileAll();
300 EXPECT_VALID(result); 302 EXPECT_VALID(result);
301 timer.Stop(); 303 timer.Stop();
302 int64_t elapsed_time = timer.TotalElapsedTime(); 304 int64_t elapsed_time = timer.TotalElapsedTime();
303 benchmark->set_score(elapsed_time); 305 benchmark->set_score(elapsed_time);
304 free(dart_root); 306 free(dart_root);
307 free(script);
305 } 308 }
306 309
307 310
308 // 311 //
309 // Measure frame lookup during stack traversal. 312 // Measure frame lookup during stack traversal.
310 // 313 //
311 static void StackFrame_accessFrame(Dart_NativeArguments args) { 314 static void StackFrame_accessFrame(Dart_NativeArguments args) {
312 const int kNumIterations = 100; 315 const int kNumIterations = 100;
313 Dart_EnterScope(); 316 Dart_EnterScope();
314 Code& code = Code::Handle(); 317 Code& code = Code::Handle();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrameTest")); 390 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrameTest"));
388 Dart_Handle result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL); 391 Dart_Handle result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL);
389 EXPECT_VALID(result); 392 EXPECT_VALID(result);
390 int64_t elapsed_time = 0; 393 int64_t elapsed_time = 0;
391 result = Dart_IntegerToInt64(result, &elapsed_time); 394 result = Dart_IntegerToInt64(result, &elapsed_time);
392 EXPECT_VALID(result); 395 EXPECT_VALID(result);
393 benchmark->set_score(elapsed_time); 396 benchmark->set_score(elapsed_time);
394 } 397 }
395 398
396 } // namespace dart 399 } // namespace dart
OLDNEW
« no previous file with comments | « tests/vm/vm.status ('k') | vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698