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

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

Issue 1318803002: Toward precompiled snapshots. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months 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
OLDNEW
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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 uint8_t* vm_isolate_snapshot_buffer; 495 uint8_t* vm_isolate_snapshot_buffer;
496 uint8_t* isolate_snapshot_buffer; 496 uint8_t* isolate_snapshot_buffer;
497 // Need to load the script into the dart: core library due to 497 // Need to load the script into the dart: core library due to
498 // the import of dart:_internal. 498 // the import of dart:_internal.
499 TestCase::LoadCoreTestScript(kScriptChars, NULL); 499 TestCase::LoadCoreTestScript(kScriptChars, NULL);
500 Api::CheckAndFinalizePendingClasses(Isolate::Current()); 500 Api::CheckAndFinalizePendingClasses(Isolate::Current());
501 501
502 // Write snapshot with object content. 502 // Write snapshot with object content.
503 FullSnapshotWriter writer(&vm_isolate_snapshot_buffer, 503 FullSnapshotWriter writer(&vm_isolate_snapshot_buffer,
504 &isolate_snapshot_buffer, 504 &isolate_snapshot_buffer,
505 NULL, /* instructions_snapshot_buffer */
505 &malloc_allocator, 506 &malloc_allocator,
506 false /* snapshot_code */); 507 false, /* snapshot_code */
508 true /* vm_isolate_is_symbolic */);
507 writer.WriteFullSnapshot(); 509 writer.WriteFullSnapshot();
508 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); 510 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer);
509 ASSERT(snapshot->kind() == Snapshot::kFull); 511 ASSERT(snapshot->kind() == Snapshot::kFull);
510 benchmark->set_score(snapshot->length()); 512 benchmark->set_score(snapshot->length());
511 } 513 }
512 514
513 515
514 BENCHMARK_SIZE(StandaloneSnapshotSize) { 516 BENCHMARK_SIZE(StandaloneSnapshotSize) {
515 const char* kScriptChars = 517 const char* kScriptChars =
516 "import 'dart:async';\n" 518 "import 'dart:async';\n"
(...skipping 13 matching lines...) Expand all
530 uint8_t* vm_isolate_snapshot_buffer; 532 uint8_t* vm_isolate_snapshot_buffer;
531 uint8_t* isolate_snapshot_buffer; 533 uint8_t* isolate_snapshot_buffer;
532 // Need to load the script into the dart: core library due to 534 // Need to load the script into the dart: core library due to
533 // the import of dart:_internal. 535 // the import of dart:_internal.
534 TestCase::LoadCoreTestScript(kScriptChars, NULL); 536 TestCase::LoadCoreTestScript(kScriptChars, NULL);
535 Api::CheckAndFinalizePendingClasses(Isolate::Current()); 537 Api::CheckAndFinalizePendingClasses(Isolate::Current());
536 538
537 // Write snapshot with object content. 539 // Write snapshot with object content.
538 FullSnapshotWriter writer(&vm_isolate_snapshot_buffer, 540 FullSnapshotWriter writer(&vm_isolate_snapshot_buffer,
539 &isolate_snapshot_buffer, 541 &isolate_snapshot_buffer,
542 NULL, /* instructions_snapshot_buffer */
540 &malloc_allocator, 543 &malloc_allocator,
541 false /* snapshot_code */); 544 false, /* snapshot_code */
545 true /* vm_isolate_is_symbolic */);
542 writer.WriteFullSnapshot(); 546 writer.WriteFullSnapshot();
543 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); 547 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer);
544 ASSERT(snapshot->kind() == Snapshot::kFull); 548 ASSERT(snapshot->kind() == Snapshot::kFull);
545 benchmark->set_score(snapshot->length()); 549 benchmark->set_score(snapshot->length());
546 } 550 }
547 551
548 552
549 BENCHMARK(CreateMirrorSystem) { 553 BENCHMARK(CreateMirrorSystem) {
550 const char* kScriptChars = 554 const char* kScriptChars =
551 "import 'dart:mirrors';\n" 555 "import 'dart:mirrors';\n"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 zone.GetZone()); 708 zone.GetZone());
705 reader.ReadObject(); 709 reader.ReadObject();
706 free(buffer); 710 free(buffer);
707 } 711 }
708 timer.Stop(); 712 timer.Stop();
709 int64_t elapsed_time = timer.TotalElapsedTime(); 713 int64_t elapsed_time = timer.TotalElapsedTime();
710 benchmark->set_score(elapsed_time); 714 benchmark->set_score(elapsed_time);
711 } 715 }
712 716
713 } // namespace dart 717 } // namespace dart
OLDNEW
« runtime/bin/main.cc ('K') | « runtime/include/dart_native_api.h ('k') | runtime/vm/dart.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698