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 #include "vm/benchmark_test.h" | 5 #include "vm/benchmark_test.h" |
6 | 6 |
7 #include "bin/builtin.h" | 7 #include "bin/builtin.h" |
8 #include "bin/file.h" | 8 #include "bin/file.h" |
9 | 9 |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 } | 347 } |
348 | 348 |
349 BENCHMARK(Dart2JSCompileAll) { | 349 BENCHMARK(Dart2JSCompileAll) { |
350 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); | 350 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); |
351 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); | 351 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); |
352 SetupDart2JSPackagePath(); | 352 SetupDart2JSPackagePath(); |
353 char* dart_root = ComputeDart2JSPath(Benchmark::Executable()); | 353 char* dart_root = ComputeDart2JSPath(Benchmark::Executable()); |
354 char* script = NULL; | 354 char* script = NULL; |
355 if (dart_root != NULL) { | 355 if (dart_root != NULL) { |
356 HANDLESCOPE(thread); | 356 HANDLESCOPE(thread); |
357 const char* kFormatStr = | 357 script = OS::SCreate(NULL, |
358 "import '%s/pkg/compiler/lib/compiler.dart';"; | 358 "import '%s/pkg/compiler/lib/compiler.dart';", dart_root); |
359 intptr_t len = OS::SNPrint(NULL, 0, kFormatStr, dart_root) + 1; | |
360 script = reinterpret_cast<char*>(malloc(len)); | |
361 EXPECT(script != NULL); | |
362 OS::SNPrint(script, len, kFormatStr, dart_root); | |
363 Dart_Handle lib = TestCase::LoadTestScript( | 359 Dart_Handle lib = TestCase::LoadTestScript( |
364 script, | 360 script, |
365 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); | 361 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); |
366 EXPECT_VALID(lib); | 362 EXPECT_VALID(lib); |
367 } else { | 363 } else { |
368 Dart_Handle lib = TestCase::LoadTestScript( | 364 Dart_Handle lib = TestCase::LoadTestScript( |
369 "import 'pkg/compiler/lib/compiler.dart';", | 365 "import 'pkg/compiler/lib/compiler.dart';", |
370 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); | 366 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); |
371 EXPECT_VALID(lib); | 367 EXPECT_VALID(lib); |
372 } | 368 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 thread); | 695 thread); |
700 reader.ReadObject(); | 696 reader.ReadObject(); |
701 free(buffer); | 697 free(buffer); |
702 } | 698 } |
703 timer.Stop(); | 699 timer.Stop(); |
704 int64_t elapsed_time = timer.TotalElapsedTime(); | 700 int64_t elapsed_time = timer.TotalElapsedTime(); |
705 benchmark->set_score(elapsed_time); | 701 benchmark->set_score(elapsed_time); |
706 } | 702 } |
707 | 703 |
708 } // namespace dart | 704 } // namespace dart |
OLD | NEW |