| 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/file.h" | 7 #include "bin/file.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 | 10 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 int arg_count) { | 268 int arg_count) { |
| 269 return &func; | 269 return &func; |
| 270 } | 270 } |
| 271 | 271 |
| 272 | 272 |
| 273 BENCHMARK(Dart2JSCompileAll) { | 273 BENCHMARK(Dart2JSCompileAll) { |
| 274 char* dart_root = ComputeDart2JSPath(Benchmark::Executable()); | 274 char* dart_root = ComputeDart2JSPath(Benchmark::Executable()); |
| 275 char* script = NULL; | 275 char* script = NULL; |
| 276 if (dart_root != NULL) { | 276 if (dart_root != NULL) { |
| 277 const char* kFormatStr = | 277 const char* kFormatStr = |
| 278 "#import('%s/sdk/lib/_internal/compiler/compiler.dart');"; | 278 "import '%s/sdk/lib/_internal/compiler/compiler.dart';"; |
| 279 intptr_t len = OS::SNPrint(NULL, 0, kFormatStr, dart_root) + 1; | 279 intptr_t len = OS::SNPrint(NULL, 0, kFormatStr, dart_root) + 1; |
| 280 script = reinterpret_cast<char*>(malloc(len)); | 280 script = reinterpret_cast<char*>(malloc(len)); |
| 281 EXPECT(script != NULL); | 281 EXPECT(script != NULL); |
| 282 OS::SNPrint(script, len, kFormatStr, dart_root); | 282 OS::SNPrint(script, len, kFormatStr, dart_root); |
| 283 Dart_Handle lib = TestCase::LoadTestScript( | 283 Dart_Handle lib = TestCase::LoadTestScript( |
| 284 script, | 284 script, |
| 285 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); | 285 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); |
| 286 EXPECT_VALID(lib); | 286 EXPECT_VALID(lib); |
| 287 } else { | 287 } else { |
| 288 Dart_Handle lib = TestCase::LoadTestScript( | 288 Dart_Handle lib = TestCase::LoadTestScript( |
| 289 "#import('sdk/lib/_internal/compiler/compiler.dart');", | 289 "import 'sdk/lib/_internal/compiler/compiler.dart';", |
| 290 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); | 290 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); |
| 291 EXPECT_VALID(lib); | 291 EXPECT_VALID(lib); |
| 292 } | 292 } |
| 293 Timer timer(true, "Compile all of dart2js benchmark"); | 293 Timer timer(true, "Compile all of dart2js benchmark"); |
| 294 timer.Start(); | 294 timer.Start(); |
| 295 Dart_Handle result = Dart_CompileAll(); | 295 Dart_Handle result = Dart_CompileAll(); |
| 296 EXPECT_VALID(result); | 296 EXPECT_VALID(result); |
| 297 timer.Stop(); | 297 timer.Stop(); |
| 298 int64_t elapsed_time = timer.TotalElapsedTime(); | 298 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 299 benchmark->set_score(elapsed_time); | 299 benchmark->set_score(elapsed_time); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrameTest")); | 384 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrameTest")); |
| 385 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL); | 385 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL); |
| 386 EXPECT_VALID(result); | 386 EXPECT_VALID(result); |
| 387 int64_t elapsed_time = 0; | 387 int64_t elapsed_time = 0; |
| 388 result = Dart_IntegerToInt64(result, &elapsed_time); | 388 result = Dart_IntegerToInt64(result, &elapsed_time); |
| 389 EXPECT_VALID(result); | 389 EXPECT_VALID(result); |
| 390 benchmark->set_score(elapsed_time); | 390 benchmark->set_score(elapsed_time); |
| 391 } | 391 } |
| 392 | 392 |
| 393 } // namespace dart | 393 } // namespace dart |
| OLD | NEW |