OLD | NEW |
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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 uint8_t* vm_isolate_snapshot_buffer; | 494 uint8_t* vm_isolate_snapshot_buffer; |
495 uint8_t* isolate_snapshot_buffer; | 495 uint8_t* isolate_snapshot_buffer; |
496 // Need to load the script into the dart: core library due to | 496 // Need to load the script into the dart: core library due to |
497 // the import of dart:_internal. | 497 // the import of dart:_internal. |
498 TestCase::LoadCoreTestScript(kScriptChars, NULL); | 498 TestCase::LoadCoreTestScript(kScriptChars, NULL); |
499 Api::CheckAndFinalizePendingClasses(Isolate::Current()); | 499 Api::CheckAndFinalizePendingClasses(Isolate::Current()); |
500 | 500 |
501 // Write snapshot with object content. | 501 // Write snapshot with object content. |
502 FullSnapshotWriter writer(&vm_isolate_snapshot_buffer, | 502 FullSnapshotWriter writer(&vm_isolate_snapshot_buffer, |
503 &isolate_snapshot_buffer, | 503 &isolate_snapshot_buffer, |
| 504 NULL, /* instructions_snapshot_buffer */ |
504 &malloc_allocator, | 505 &malloc_allocator, |
505 false /* snapshot_code */); | 506 false, /* snapshot_code */ |
| 507 true /* vm_isolate_is_symbolic */); |
506 writer.WriteFullSnapshot(); | 508 writer.WriteFullSnapshot(); |
507 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); | 509 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); |
508 ASSERT(snapshot->kind() == Snapshot::kFull); | 510 ASSERT(snapshot->kind() == Snapshot::kFull); |
509 benchmark->set_score(snapshot->length()); | 511 benchmark->set_score(snapshot->length()); |
510 } | 512 } |
511 | 513 |
512 | 514 |
513 BENCHMARK_SIZE(StandaloneSnapshotSize) { | 515 BENCHMARK_SIZE(StandaloneSnapshotSize) { |
514 const char* kScriptChars = | 516 const char* kScriptChars = |
515 "import 'dart:async';\n" | 517 "import 'dart:async';\n" |
(...skipping 13 matching lines...) Expand all Loading... |
529 uint8_t* vm_isolate_snapshot_buffer; | 531 uint8_t* vm_isolate_snapshot_buffer; |
530 uint8_t* isolate_snapshot_buffer; | 532 uint8_t* isolate_snapshot_buffer; |
531 // Need to load the script into the dart: core library due to | 533 // Need to load the script into the dart: core library due to |
532 // the import of dart:_internal. | 534 // the import of dart:_internal. |
533 TestCase::LoadCoreTestScript(kScriptChars, NULL); | 535 TestCase::LoadCoreTestScript(kScriptChars, NULL); |
534 Api::CheckAndFinalizePendingClasses(Isolate::Current()); | 536 Api::CheckAndFinalizePendingClasses(Isolate::Current()); |
535 | 537 |
536 // Write snapshot with object content. | 538 // Write snapshot with object content. |
537 FullSnapshotWriter writer(&vm_isolate_snapshot_buffer, | 539 FullSnapshotWriter writer(&vm_isolate_snapshot_buffer, |
538 &isolate_snapshot_buffer, | 540 &isolate_snapshot_buffer, |
| 541 NULL, /* instructions_snapshot_buffer */ |
539 &malloc_allocator, | 542 &malloc_allocator, |
540 false /* snapshot_code */); | 543 false, /* snapshot_code */ |
| 544 true /* vm_isolate_is_symbolic */); |
541 writer.WriteFullSnapshot(); | 545 writer.WriteFullSnapshot(); |
542 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); | 546 const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer); |
543 ASSERT(snapshot->kind() == Snapshot::kFull); | 547 ASSERT(snapshot->kind() == Snapshot::kFull); |
544 benchmark->set_score(snapshot->length()); | 548 benchmark->set_score(snapshot->length()); |
545 } | 549 } |
546 | 550 |
547 | 551 |
548 BENCHMARK(CreateMirrorSystem) { | 552 BENCHMARK(CreateMirrorSystem) { |
549 const char* kScriptChars = | 553 const char* kScriptChars = |
550 "import 'dart:mirrors';\n" | 554 "import 'dart:mirrors';\n" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 thread); | 703 thread); |
700 reader.ReadObject(); | 704 reader.ReadObject(); |
701 free(buffer); | 705 free(buffer); |
702 } | 706 } |
703 timer.Stop(); | 707 timer.Stop(); |
704 int64_t elapsed_time = timer.TotalElapsedTime(); | 708 int64_t elapsed_time = timer.TotalElapsedTime(); |
705 benchmark->set_score(elapsed_time); | 709 benchmark->set_score(elapsed_time); |
706 } | 710 } |
707 | 711 |
708 } // namespace dart | 712 } // namespace dart |
OLD | NEW |