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

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

Issue 2622053002: Refactor snapshots pieces to include a section for loading instructions into the heap of a regular … (Closed)
Patch Set: . Created 3 years, 11 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 | « runtime/vm/benchmark_test.h ('k') | runtime/vm/clustered_snapshot.h » ('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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void Benchmark::RunAll(const char* executable) { 88 void Benchmark::RunAll(const char* executable) {
89 SetExecutable(executable); 89 SetExecutable(executable);
90 Benchmark* benchmark = first_; 90 Benchmark* benchmark = first_;
91 while (benchmark != NULL) { 91 while (benchmark != NULL) {
92 benchmark->RunBenchmark(); 92 benchmark->RunBenchmark();
93 benchmark = benchmark->next_; 93 benchmark = benchmark->next_;
94 } 94 }
95 } 95 }
96 96
97 97
98 Dart_Isolate Benchmark::CreateIsolate(const uint8_t* buffer) { 98 Dart_Isolate Benchmark::CreateIsolate(const uint8_t* snapshot_data,
99 const uint8_t* snapshot_instructions) {
99 char* err = NULL; 100 char* err = NULL;
100 isolate_ = Dart_CreateIsolate(NULL, NULL, buffer, NULL, NULL, &err); 101 isolate_ = Dart_CreateIsolate(NULL, NULL, snapshot_data,
102 snapshot_instructions, NULL, NULL, &err);
101 EXPECT(isolate_ != NULL); 103 EXPECT(isolate_ != NULL);
102 free(err); 104 free(err);
103 return isolate_; 105 return isolate_;
104 } 106 }
105 107
106 108
107 // 109 //
108 // Measure compile of all functions in dart core lib classes. 110 // Measure compile of all functions in dart core lib classes.
109 // 111 //
110 BENCHMARK(CorelibCompileAll) { 112 BENCHMARK(CorelibCompileAll) {
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 "import 'dart:core';\n" 504 "import 'dart:core';\n"
503 "import 'dart:collection';\n" 505 "import 'dart:collection';\n"
504 "import 'dart:_internal';\n" 506 "import 'dart:_internal';\n"
505 "import 'dart:math';\n" 507 "import 'dart:math';\n"
506 "import 'dart:isolate';\n" 508 "import 'dart:isolate';\n"
507 "import 'dart:mirrors';\n" 509 "import 'dart:mirrors';\n"
508 "import 'dart:typed_data';\n" 510 "import 'dart:typed_data';\n"
509 "\n"; 511 "\n";
510 512
511 // Start an Isolate, load a script and create a full snapshot. 513 // Start an Isolate, load a script and create a full snapshot.
512 uint8_t* vm_isolate_snapshot_buffer; 514 uint8_t* vm_snapshot_data_buffer;
513 uint8_t* isolate_snapshot_buffer; 515 uint8_t* isolate_snapshot_data_buffer;
514 // Need to load the script into the dart: core library due to 516 // Need to load the script into the dart: core library due to
515 // the import of dart:_internal. 517 // the import of dart:_internal.
516 TestCase::LoadCoreTestScript(kScriptChars, NULL); 518 TestCase::LoadCoreTestScript(kScriptChars, NULL);
517 Api::CheckAndFinalizePendingClasses(thread); 519 Api::CheckAndFinalizePendingClasses(thread);
518 520
519 // Write snapshot with object content. 521 // Write snapshot with object content.
520 FullSnapshotWriter writer(Snapshot::kCore, &vm_isolate_snapshot_buffer, 522 FullSnapshotWriter writer(Snapshot::kCore, &vm_snapshot_data_buffer,
521 &isolate_snapshot_buffer, &malloc_allocator, 523 &isolate_snapshot_data_buffer, &malloc_allocator,
522 NULL /* instructions_writer */); 524 NULL, NULL /* instructions_writer */);
523 writer.WriteFullSnapshot(); 525 writer.WriteFullSnapshot();
524 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); 526 const Snapshot* snapshot =
527 Snapshot::SetupFromBuffer(isolate_snapshot_data_buffer);
525 ASSERT(snapshot->kind() == Snapshot::kCore); 528 ASSERT(snapshot->kind() == Snapshot::kCore);
526 benchmark->set_score(snapshot->length()); 529 benchmark->set_score(snapshot->length());
527 530
528 free(vm_isolate_snapshot_buffer); 531 free(vm_snapshot_data_buffer);
529 free(isolate_snapshot_buffer); 532 free(isolate_snapshot_data_buffer);
530 } 533 }
531 534
532 535
533 BENCHMARK_SIZE(StandaloneSnapshotSize) { 536 BENCHMARK_SIZE(StandaloneSnapshotSize) {
534 const char* kScriptChars = 537 const char* kScriptChars =
535 "import 'dart:async';\n" 538 "import 'dart:async';\n"
536 "import 'dart:core';\n" 539 "import 'dart:core';\n"
537 "import 'dart:collection';\n" 540 "import 'dart:collection';\n"
538 "import 'dart:_internal';\n" 541 "import 'dart:_internal';\n"
539 "import 'dart:convert';\n" 542 "import 'dart:convert';\n"
540 "import 'dart:math';\n" 543 "import 'dart:math';\n"
541 "import 'dart:isolate';\n" 544 "import 'dart:isolate';\n"
542 "import 'dart:mirrors';\n" 545 "import 'dart:mirrors';\n"
543 "import 'dart:typed_data';\n" 546 "import 'dart:typed_data';\n"
544 "import 'dart:_builtin';\n" 547 "import 'dart:_builtin';\n"
545 "import 'dart:io';\n" 548 "import 'dart:io';\n"
546 "\n"; 549 "\n";
547 550
548 // Start an Isolate, load a script and create a full snapshot. 551 // Start an Isolate, load a script and create a full snapshot.
549 uint8_t* vm_isolate_snapshot_buffer; 552 uint8_t* vm_snapshot_data_buffer;
550 uint8_t* isolate_snapshot_buffer; 553 uint8_t* isolate_snapshot_data_buffer;
551 // Need to load the script into the dart: core library due to 554 // Need to load the script into the dart: core library due to
552 // the import of dart:_internal. 555 // the import of dart:_internal.
553 TestCase::LoadCoreTestScript(kScriptChars, NULL); 556 TestCase::LoadCoreTestScript(kScriptChars, NULL);
554 Api::CheckAndFinalizePendingClasses(thread); 557 Api::CheckAndFinalizePendingClasses(thread);
555 558
556 // Write snapshot with object content. 559 // Write snapshot with object content.
557 FullSnapshotWriter writer(Snapshot::kCore, &vm_isolate_snapshot_buffer, 560 FullSnapshotWriter writer(Snapshot::kCore, &vm_snapshot_data_buffer,
558 &isolate_snapshot_buffer, &malloc_allocator, 561 &isolate_snapshot_data_buffer, &malloc_allocator,
559 NULL /* instructions_writer */); 562 NULL, NULL /* instructions_writer */);
560 writer.WriteFullSnapshot(); 563 writer.WriteFullSnapshot();
561 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); 564 const Snapshot* snapshot =
565 Snapshot::SetupFromBuffer(isolate_snapshot_data_buffer);
562 ASSERT(snapshot->kind() == Snapshot::kCore); 566 ASSERT(snapshot->kind() == Snapshot::kCore);
563 benchmark->set_score(snapshot->length()); 567 benchmark->set_score(snapshot->length());
564 568
565 free(vm_isolate_snapshot_buffer); 569 free(vm_snapshot_data_buffer);
566 free(isolate_snapshot_buffer); 570 free(isolate_snapshot_data_buffer);
567 } 571 }
568 572
569 573
570 BENCHMARK(CreateMirrorSystem) { 574 BENCHMARK(CreateMirrorSystem) {
571 const char* kScriptChars = 575 const char* kScriptChars =
572 "import 'dart:mirrors';\n" 576 "import 'dart:mirrors';\n"
573 "\n" 577 "\n"
574 "void benchmark() {\n" 578 "void benchmark() {\n"
575 " currentMirrorSystem();\n" 579 " currentMirrorSystem();\n"
576 "}\n"; 580 "}\n";
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 int64_t elapsed_time = timer.TotalElapsedTime(); 723 int64_t elapsed_time = timer.TotalElapsedTime();
720 benchmark->set_score(elapsed_time); 724 benchmark->set_score(elapsed_time);
721 } 725 }
722 726
723 727
724 BENCHMARK_MEMORY(InitialRSS) { 728 BENCHMARK_MEMORY(InitialRSS) {
725 benchmark->set_score(OS::MaxRSS()); 729 benchmark->set_score(OS::MaxRSS());
726 } 730 }
727 731
728 } // namespace dart 732 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/benchmark_test.h ('k') | runtime/vm/clustered_snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698