Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: runtime/vm/snapshot_test.cc

Issue 8528010: Changes to pass the current isolate to all runtime and native calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 Dart_CreateIsolate(NULL, NULL); 335 Dart_CreateIsolate(NULL, NULL);
336 { 336 {
337 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. 337 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
338 338
339 // Create a test library and Load up a test script in it. 339 // Create a test library and Load up a test script in it.
340 TestCase::LoadTestScript(kScriptChars, NULL); 340 TestCase::LoadTestScript(kScriptChars, NULL);
341 timer1.Stop(); 341 timer1.Stop();
342 OS::PrintErr("Without Snapshot: %dus\n", timer1.TotalElapsedTime()); 342 OS::PrintErr("Without Snapshot: %dus\n", timer1.TotalElapsedTime());
343 343
344 // Write snapshot with object content. 344 // Write snapshot with object content.
345 Zone zone; 345 Isolate* isolate = Isolate::Current();
346 HandleScope hs; 346 Zone zone(isolate);
347 HandleScope scope(isolate);
347 SnapshotWriter writer(true, &buffer, &allocator); 348 SnapshotWriter writer(true, &buffer, &allocator);
348 writer.WriteFullSnapshot(); 349 writer.WriteFullSnapshot();
349 350
350 Dart_ExitScope(); // Exit the Dart API scope. 351 Dart_ExitScope(); // Exit the Dart API scope.
351 } 352 }
352 Dart_ShutdownIsolate(); 353 Dart_ShutdownIsolate();
353 354
354 // Now Create another isolate using the snapshot and execute a method 355 // Now Create another isolate using the snapshot and execute a method
355 // from the script. 356 // from the script.
356 Timer timer2(true, "Snapshot_test"); 357 Timer timer2(true, "Snapshot_test");
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 const char* kScriptChars = kFullSnapshotScriptChars; 389 const char* kScriptChars = kFullSnapshotScriptChars;
389 390
390 uint8_t* buffer; 391 uint8_t* buffer;
391 392
392 // Start an Isolate, load a script and create a full snapshot. 393 // Start an Isolate, load a script and create a full snapshot.
393 Timer timer1(true, "Snapshot_test"); 394 Timer timer1(true, "Snapshot_test");
394 timer1.Start(); 395 timer1.Start();
395 Dart_CreateIsolate(NULL, NULL); 396 Dart_CreateIsolate(NULL, NULL);
396 { 397 {
397 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. 398 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
398 Zone zone; 399 Isolate* isolate = Isolate::Current();
399 HandleScope hs; 400 Zone zone(isolate);
401 HandleScope scope(isolate);
400 402
401 // Create a test library and Load up a test script in it. 403 // Create a test library and Load up a test script in it.
402 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 404 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
403 ClassFinalizer::FinalizePendingClasses(); 405 ClassFinalizer::FinalizePendingClasses();
404 timer1.Stop(); 406 timer1.Stop();
405 OS::PrintErr("Without Snapshot: %dus\n", timer1.TotalElapsedTime()); 407 OS::PrintErr("Without Snapshot: %dus\n", timer1.TotalElapsedTime());
406 408
407 // Write snapshot with object content. 409 // Write snapshot with object content.
408 SnapshotWriter writer(true, &buffer, &allocator); 410 SnapshotWriter writer(true, &buffer, &allocator);
409 writer.WriteFullSnapshot(); 411 writer.WriteFullSnapshot();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 456
455 Dart_ExitScope(); // Exit the Dart API scope. 457 Dart_ExitScope(); // Exit the Dart API scope.
456 } 458 }
457 Dart_ShutdownIsolate(); 459 Dart_ShutdownIsolate();
458 460
459 free(buffer); 461 free(buffer);
460 } 462 }
461 #endif // TARGET_ARCH_IA32. 463 #endif // TARGET_ARCH_IA32.
462 464
463 } // namespace dart 465 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698