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

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

Issue 1290933002: Toward precompiled snapshots. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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_api_impl.cc » ('j') | runtime/vm/raw_object_snapshot.cc » ('J')
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 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 &malloc_allocator); 505 &malloc_allocator,
506 false /* snapshot_code */);
506 writer.WriteFullSnapshot(); 507 writer.WriteFullSnapshot();
507 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); 508 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer);
508 ASSERT(snapshot->kind() == Snapshot::kFull); 509 ASSERT(snapshot->kind() == Snapshot::kFull);
509 benchmark->set_score(snapshot->length()); 510 benchmark->set_score(snapshot->length());
510 } 511 }
511 512
512 513
513 BENCHMARK_SIZE(StandaloneSnapshotSize) { 514 BENCHMARK_SIZE(StandaloneSnapshotSize) {
514 const char* kScriptChars = 515 const char* kScriptChars =
515 "import 'dart:async';\n" 516 "import 'dart:async';\n"
(...skipping 13 matching lines...) Expand all
529 uint8_t* vm_isolate_snapshot_buffer; 530 uint8_t* vm_isolate_snapshot_buffer;
530 uint8_t* isolate_snapshot_buffer; 531 uint8_t* isolate_snapshot_buffer;
531 // Need to load the script into the dart: core library due to 532 // Need to load the script into the dart: core library due to
532 // the import of dart:_internal. 533 // the import of dart:_internal.
533 TestCase::LoadCoreTestScript(kScriptChars, NULL); 534 TestCase::LoadCoreTestScript(kScriptChars, NULL);
534 Api::CheckAndFinalizePendingClasses(Isolate::Current()); 535 Api::CheckAndFinalizePendingClasses(Isolate::Current());
535 536
536 // Write snapshot with object content. 537 // Write snapshot with object content.
537 FullSnapshotWriter writer(&vm_isolate_snapshot_buffer, 538 FullSnapshotWriter writer(&vm_isolate_snapshot_buffer,
538 &isolate_snapshot_buffer, 539 &isolate_snapshot_buffer,
539 &malloc_allocator); 540 &malloc_allocator,
541 false /* snapshot_code */);
540 writer.WriteFullSnapshot(); 542 writer.WriteFullSnapshot();
541 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); 543 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer);
542 ASSERT(snapshot->kind() == Snapshot::kFull); 544 ASSERT(snapshot->kind() == Snapshot::kFull);
543 benchmark->set_score(snapshot->length()); 545 benchmark->set_score(snapshot->length());
544 } 546 }
545 547
546 548
547 BENCHMARK(CreateMirrorSystem) { 549 BENCHMARK(CreateMirrorSystem) {
548 const char* kScriptChars = 550 const char* kScriptChars =
549 "import 'dart:mirrors';\n" 551 "import 'dart:mirrors';\n"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 zone.GetZone()); 704 zone.GetZone());
703 reader.ReadObject(); 705 reader.ReadObject();
704 free(buffer); 706 free(buffer);
705 } 707 }
706 timer.Stop(); 708 timer.Stop();
707 int64_t elapsed_time = timer.TotalElapsedTime(); 709 int64_t elapsed_time = timer.TotalElapsedTime();
708 benchmark->set_score(elapsed_time); 710 benchmark->set_score(elapsed_time);
709 } 711 }
710 712
711 } // namespace dart 713 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | runtime/vm/raw_object_snapshot.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698