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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 | 274 |
275 static void func(Dart_NativeArguments args) { | 275 static void func(Dart_NativeArguments args) { |
276 } | 276 } |
277 | 277 |
278 | 278 |
279 // Emulates DartUtils::PrepareForScriptLoading. | 279 // Emulates DartUtils::PrepareForScriptLoading. |
280 static Dart_Handle PreparePackageRoot(const char* package_root, | 280 static Dart_Handle PreparePackageRoot(const char* package_root, |
281 Dart_Handle builtin_lib) { | 281 Dart_Handle builtin_lib) { |
282 // First ensure all required libraries are available. | 282 // First ensure all required libraries are available. |
283 Dart_Handle url = NewString(bin::DartUtils::kCoreLibURL); | 283 Dart_Handle url = NewString(bin::DartUtils::kUriLibURL); |
284 DART_CHECK_VALID(url); | 284 DART_CHECK_VALID(url); |
285 Dart_Handle core_lib = Dart_LookupLibrary(url); | 285 Dart_Handle uri_lib = Dart_LookupLibrary(url); |
286 DART_CHECK_VALID(core_lib); | 286 DART_CHECK_VALID(uri_lib); |
287 url = NewString(bin::DartUtils::kAsyncLibURL); | 287 url = NewString(bin::DartUtils::kAsyncLibURL); |
288 DART_CHECK_VALID(url); | 288 DART_CHECK_VALID(url); |
289 Dart_Handle async_lib = Dart_LookupLibrary(url); | 289 Dart_Handle async_lib = Dart_LookupLibrary(url); |
290 DART_CHECK_VALID(async_lib); | 290 DART_CHECK_VALID(async_lib); |
291 url = NewString(bin::DartUtils::kIsolateLibURL); | 291 url = NewString(bin::DartUtils::kIsolateLibURL); |
292 DART_CHECK_VALID(url); | 292 DART_CHECK_VALID(url); |
293 Dart_Handle isolate_lib = Dart_LookupLibrary(url); | 293 Dart_Handle isolate_lib = Dart_LookupLibrary(url); |
294 DART_CHECK_VALID(isolate_lib); | 294 DART_CHECK_VALID(isolate_lib); |
295 url = NewString(bin::DartUtils::kInternalLibURL); | 295 url = NewString(bin::DartUtils::kInternalLibURL); |
296 DART_CHECK_VALID(url); | 296 DART_CHECK_VALID(url); |
(...skipping 27 matching lines...) Expand all Loading... |
324 const int kNumArgs = 1; | 324 const int kNumArgs = 1; |
325 Dart_Handle dart_args[kNumArgs]; | 325 Dart_Handle dart_args[kNumArgs]; |
326 dart_args[0] = result; | 326 dart_args[0] = result; |
327 result = Dart_Invoke(builtin_lib, | 327 result = Dart_Invoke(builtin_lib, |
328 NewString("_setPackageRoot"), | 328 NewString("_setPackageRoot"), |
329 kNumArgs, | 329 kNumArgs, |
330 dart_args); | 330 dart_args); |
331 DART_CHECK_VALID(result); | 331 DART_CHECK_VALID(result); |
332 | 332 |
333 bin::DartUtils::PrepareAsyncLibrary(async_lib, isolate_lib); | 333 bin::DartUtils::PrepareAsyncLibrary(async_lib, isolate_lib); |
334 bin::DartUtils::PrepareCoreLibrary(core_lib, builtin_lib, false); | 334 bin::DartUtils::PrepareUriLibrary(uri_lib, builtin_lib, false); |
335 bin::DartUtils::PrepareIsolateLibrary(isolate_lib); | 335 bin::DartUtils::PrepareIsolateLibrary(isolate_lib); |
336 bin::DartUtils::PrepareIOLibrary(io_lib); | 336 bin::DartUtils::PrepareIOLibrary(io_lib); |
337 return Dart_True(); | 337 return Dart_True(); |
338 } | 338 } |
339 | 339 |
340 | 340 |
341 static Dart_NativeFunction NativeResolver(Dart_Handle name, | 341 static Dart_NativeFunction NativeResolver(Dart_Handle name, |
342 int arg_count, | 342 int arg_count, |
343 bool* auto_setup_scope) { | 343 bool* auto_setup_scope) { |
344 ASSERT(auto_setup_scope != NULL); | 344 ASSERT(auto_setup_scope != NULL); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 thread); | 748 thread); |
749 reader.ReadObject(); | 749 reader.ReadObject(); |
750 free(buffer); | 750 free(buffer); |
751 } | 751 } |
752 timer.Stop(); | 752 timer.Stop(); |
753 int64_t elapsed_time = timer.TotalElapsedTime(); | 753 int64_t elapsed_time = timer.TotalElapsedTime(); |
754 benchmark->set_score(elapsed_time); | 754 benchmark->set_score(elapsed_time); |
755 } | 755 } |
756 | 756 |
757 } // namespace dart | 757 } // namespace dart |
OLD | NEW |