| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 static Dart_NativeFunction NativeResolver(Dart_Handle name, | 265 static Dart_NativeFunction NativeResolver(Dart_Handle name, |
| 266 int arg_count) { | 266 int arg_count) { |
| 267 return &func; | 267 return &func; |
| 268 } | 268 } |
| 269 | 269 |
| 270 | 270 |
| 271 BENCHMARK(Dart2JSCompileAll) { | 271 BENCHMARK(Dart2JSCompileAll) { |
| 272 char* dart_root = ComputeDart2JSPath(Benchmark::Executable()); | 272 char* dart_root = ComputeDart2JSPath(Benchmark::Executable()); |
| 273 char* script = NULL; | 273 char* script = NULL; |
| 274 if (dart_root != NULL) { | 274 if (dart_root != NULL) { |
| 275 Isolate* isolate = Isolate::Current(); |
| 276 HANDLESCOPE(isolate); |
| 275 const char* kFormatStr = | 277 const char* kFormatStr = |
| 276 "import '%s/sdk/lib/_internal/compiler/compiler.dart';"; | 278 "import '%s/sdk/lib/_internal/compiler/compiler.dart';"; |
| 277 intptr_t len = OS::SNPrint(NULL, 0, kFormatStr, dart_root) + 1; | 279 intptr_t len = OS::SNPrint(NULL, 0, kFormatStr, dart_root) + 1; |
| 278 script = reinterpret_cast<char*>(malloc(len)); | 280 script = reinterpret_cast<char*>(malloc(len)); |
| 279 EXPECT(script != NULL); | 281 EXPECT(script != NULL); |
| 280 OS::SNPrint(script, len, kFormatStr, dart_root); | 282 OS::SNPrint(script, len, kFormatStr, dart_root); |
| 281 Dart_Handle lib = TestCase::LoadTestScript( | 283 Dart_Handle lib = TestCase::LoadTestScript( |
| 282 script, | 284 script, |
| 283 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); | 285 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); |
| 284 EXPECT_VALID(lib); | 286 EXPECT_VALID(lib); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrameTest")); | 384 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrameTest")); |
| 383 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL); | 385 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL); |
| 384 EXPECT_VALID(result); | 386 EXPECT_VALID(result); |
| 385 int64_t elapsed_time = 0; | 387 int64_t elapsed_time = 0; |
| 386 result = Dart_IntegerToInt64(result, &elapsed_time); | 388 result = Dart_IntegerToInt64(result, &elapsed_time); |
| 387 EXPECT_VALID(result); | 389 EXPECT_VALID(result); |
| 388 benchmark->set_score(elapsed_time); | 390 benchmark->set_score(elapsed_time); |
| 389 } | 391 } |
| 390 | 392 |
| 391 } // namespace dart | 393 } // namespace dart |
| OLD | NEW |