| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/snapshot.h" | 5 #include "vm/snapshot.h" |
| 6 | 6 |
| 7 #include "vm/assert.h" | 7 #include "vm/assert.h" |
| 8 #include "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 Timer timer1(true, "Snapshot_test"); | 393 Timer timer1(true, "Snapshot_test"); |
| 394 timer1.Start(); | 394 timer1.Start(); |
| 395 Dart_CreateIsolate(NULL, NULL); | 395 Dart_CreateIsolate(NULL, NULL); |
| 396 { | 396 { |
| 397 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. | 397 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. |
| 398 Zone zone; | 398 Zone zone; |
| 399 HandleScope hs; | 399 HandleScope hs; |
| 400 | 400 |
| 401 // Create a test library and Load up a test script in it. | 401 // Create a test library and Load up a test script in it. |
| 402 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 402 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 403 ClassFinalizer::FinalizeAllClasses(); | 403 ClassFinalizer::FinalizePendingClasses(); |
| 404 timer1.Stop(); | 404 timer1.Stop(); |
| 405 OS::PrintErr("Without Snapshot: %dus\n", timer1.TotalElapsedTime()); | 405 OS::PrintErr("Without Snapshot: %dus\n", timer1.TotalElapsedTime()); |
| 406 | 406 |
| 407 // Write snapshot with object content. | 407 // Write snapshot with object content. |
| 408 SnapshotWriter writer(true, &buffer, &allocator); | 408 SnapshotWriter writer(true, &buffer, &allocator); |
| 409 writer.WriteFullSnapshot(); | 409 writer.WriteFullSnapshot(); |
| 410 | 410 |
| 411 // Invoke a function which returns an object. | 411 // Invoke a function which returns an object. |
| 412 Dart_Handle result = Dart_InvokeStatic(lib, | 412 Dart_Handle result = Dart_InvokeStatic(lib, |
| 413 Dart_NewString("FieldsTest"), | 413 Dart_NewString("FieldsTest"), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 454 |
| 455 Dart_ExitScope(); // Exit the Dart API scope. | 455 Dart_ExitScope(); // Exit the Dart API scope. |
| 456 } | 456 } |
| 457 Dart_ShutdownIsolate(); | 457 Dart_ShutdownIsolate(); |
| 458 | 458 |
| 459 free(buffer); | 459 free(buffer); |
| 460 } | 460 } |
| 461 #endif // TARGET_ARCH_IA32. | 461 #endif // TARGET_ARCH_IA32. |
| 462 | 462 |
| 463 } // namespace dart | 463 } // namespace dart |
| OLD | NEW |