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

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

Issue 1918313003: Split Snapshot::kFull into kCore, kAppWithJIT, and kAppNoJIT. Remove snapshot_code flag. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 8 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
« no previous file with comments | « no previous file | runtime/vm/dart.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "bin/isolate_data.h" 9 #include "bin/isolate_data.h"
10 10
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 517
518 // Start an Isolate, load a script and create a full snapshot. 518 // Start an Isolate, load a script and create a full snapshot.
519 uint8_t* vm_isolate_snapshot_buffer; 519 uint8_t* vm_isolate_snapshot_buffer;
520 uint8_t* isolate_snapshot_buffer; 520 uint8_t* isolate_snapshot_buffer;
521 // Need to load the script into the dart: core library due to 521 // Need to load the script into the dart: core library due to
522 // the import of dart:_internal. 522 // the import of dart:_internal.
523 TestCase::LoadCoreTestScript(kScriptChars, NULL); 523 TestCase::LoadCoreTestScript(kScriptChars, NULL);
524 Api::CheckAndFinalizePendingClasses(thread); 524 Api::CheckAndFinalizePendingClasses(thread);
525 525
526 // Write snapshot with object content. 526 // Write snapshot with object content.
527 FullSnapshotWriter writer(&vm_isolate_snapshot_buffer, 527 FullSnapshotWriter writer(Snapshot::kCore,
528 &vm_isolate_snapshot_buffer,
528 &isolate_snapshot_buffer, 529 &isolate_snapshot_buffer,
529 &malloc_allocator, 530 &malloc_allocator,
530 NULL, /* instructions_writer */ 531 NULL, /* instructions_writer */
531 false, /* snapshot_code */
532 true /* vm_isolate_is_symbolic */); 532 true /* vm_isolate_is_symbolic */);
533 writer.WriteFullSnapshot(); 533 writer.WriteFullSnapshot();
534 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); 534 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer);
535 ASSERT(snapshot->kind() == Snapshot::kFull); 535 ASSERT(snapshot->kind() == Snapshot::kCore);
536 benchmark->set_score(snapshot->length()); 536 benchmark->set_score(snapshot->length());
537 } 537 }
538 538
539 539
540 BENCHMARK_SIZE(StandaloneSnapshotSize) { 540 BENCHMARK_SIZE(StandaloneSnapshotSize) {
541 const char* kScriptChars = 541 const char* kScriptChars =
542 "import 'dart:async';\n" 542 "import 'dart:async';\n"
543 "import 'dart:core';\n" 543 "import 'dart:core';\n"
544 "import 'dart:collection';\n" 544 "import 'dart:collection';\n"
545 "import 'dart:_internal';\n" 545 "import 'dart:_internal';\n"
546 "import 'dart:convert';\n" 546 "import 'dart:convert';\n"
547 "import 'dart:math';\n" 547 "import 'dart:math';\n"
548 "import 'dart:isolate';\n" 548 "import 'dart:isolate';\n"
549 "import 'dart:mirrors';\n" 549 "import 'dart:mirrors';\n"
550 "import 'dart:typed_data';\n" 550 "import 'dart:typed_data';\n"
551 "import 'dart:_builtin';\n" 551 "import 'dart:_builtin';\n"
552 "import 'dart:io';\n" 552 "import 'dart:io';\n"
553 "\n"; 553 "\n";
554 554
555 // Start an Isolate, load a script and create a full snapshot. 555 // Start an Isolate, load a script and create a full snapshot.
556 uint8_t* vm_isolate_snapshot_buffer; 556 uint8_t* vm_isolate_snapshot_buffer;
557 uint8_t* isolate_snapshot_buffer; 557 uint8_t* isolate_snapshot_buffer;
558 // Need to load the script into the dart: core library due to 558 // Need to load the script into the dart: core library due to
559 // the import of dart:_internal. 559 // the import of dart:_internal.
560 TestCase::LoadCoreTestScript(kScriptChars, NULL); 560 TestCase::LoadCoreTestScript(kScriptChars, NULL);
561 Api::CheckAndFinalizePendingClasses(thread); 561 Api::CheckAndFinalizePendingClasses(thread);
562 562
563 // Write snapshot with object content. 563 // Write snapshot with object content.
564 FullSnapshotWriter writer(&vm_isolate_snapshot_buffer, 564 FullSnapshotWriter writer(Snapshot::kCore,
565 &vm_isolate_snapshot_buffer,
565 &isolate_snapshot_buffer, 566 &isolate_snapshot_buffer,
566 &malloc_allocator, 567 &malloc_allocator,
567 NULL, /* instructions_writer */ 568 NULL, /* instructions_writer */
568 false, /* snapshot_code */
569 true /* vm_isolate_is_symbolic */); 569 true /* vm_isolate_is_symbolic */);
570 writer.WriteFullSnapshot(); 570 writer.WriteFullSnapshot();
571 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); 571 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer);
572 ASSERT(snapshot->kind() == Snapshot::kFull); 572 ASSERT(snapshot->kind() == Snapshot::kCore);
573 benchmark->set_score(snapshot->length()); 573 benchmark->set_score(snapshot->length());
574 } 574 }
575 575
576 576
577 BENCHMARK(CreateMirrorSystem) { 577 BENCHMARK(CreateMirrorSystem) {
578 const char* kScriptChars = 578 const char* kScriptChars =
579 "import 'dart:mirrors';\n" 579 "import 'dart:mirrors';\n"
580 "\n" 580 "\n"
581 "void benchmark() {\n" 581 "void benchmark() {\n"
582 " currentMirrorSystem();\n" 582 " currentMirrorSystem();\n"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 thread); 725 thread);
726 reader.ReadObject(); 726 reader.ReadObject();
727 free(buffer); 727 free(buffer);
728 } 728 }
729 timer.Stop(); 729 timer.Stop();
730 int64_t elapsed_time = timer.TotalElapsedTime(); 730 int64_t elapsed_time = timer.TotalElapsedTime();
731 benchmark->set_score(elapsed_time); 731 benchmark->set_score(elapsed_time);
732 } 732 }
733 733
734 } // namespace dart 734 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698