OLD | NEW |
---|---|
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/clustered_snapshot.h" | 5 #include "vm/clustered_snapshot.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
504 objects_.Add(func); | 504 objects_.Add(func); |
505 | 505 |
506 RawObject** from = func->from(); | 506 RawObject** from = func->from(); |
507 RawObject** to = func->to_snapshot(); | 507 RawObject** to = func->to_snapshot(); |
508 for (RawObject** p = from; p <= to; p++) { | 508 for (RawObject** p = from; p <= to; p++) { |
509 s->Push(*p); | 509 s->Push(*p); |
510 } | 510 } |
511 if (s->kind() == Snapshot::kAppNoJIT) { | 511 if (s->kind() == Snapshot::kAppNoJIT) { |
512 s->Push(func->ptr()->code_); | 512 s->Push(func->ptr()->code_); |
513 } else if (s->kind() == Snapshot::kAppWithJIT) { | 513 } else if (s->kind() == Snapshot::kAppWithJIT) { |
514 s->Push(func->ptr()->unoptimized_code_); | 514 NOT_IN_PRECOMPILED(s->Push(func->ptr()->unoptimized_code_)); |
515 s->Push(func->ptr()->ic_data_array_); | 515 s->Push(func->ptr()->ic_data_array_); |
516 } | 516 } |
517 } | 517 } |
518 | 518 |
519 void WriteAlloc(Serializer* s) { | 519 void WriteAlloc(Serializer* s) { |
520 s->WriteCid(kFunctionCid); | 520 s->WriteCid(kFunctionCid); |
521 intptr_t count = objects_.length(); | 521 intptr_t count = objects_.length(); |
522 s->Write<int32_t>(count); | 522 s->Write<int32_t>(count); |
523 for (intptr_t i = 0; i < count; i++) { | 523 for (intptr_t i = 0; i < count; i++) { |
524 RawFunction* func = objects_[i]; | 524 RawFunction* func = objects_[i]; |
525 s->AssignRef(func); | 525 s->AssignRef(func); |
526 } | 526 } |
527 } | 527 } |
528 | 528 |
529 void WriteFill(Serializer* s) { | 529 void WriteFill(Serializer* s) { |
530 Snapshot::Kind kind = s->kind(); | 530 Snapshot::Kind kind = s->kind(); |
531 intptr_t count = objects_.length(); | 531 intptr_t count = objects_.length(); |
532 for (intptr_t i = 0; i < count; i++) { | 532 for (intptr_t i = 0; i < count; i++) { |
533 RawFunction* func = objects_[i]; | 533 RawFunction* func = objects_[i]; |
534 RawObject** from = func->from(); | 534 RawObject** from = func->from(); |
535 RawObject** to = func->to_snapshot(); | 535 RawObject** to = func->to_snapshot(); |
536 for (RawObject** p = from; p <= to; p++) { | 536 for (RawObject** p = from; p <= to; p++) { |
537 s->WriteRef(*p); | 537 s->WriteRef(*p); |
538 } | 538 } |
539 if (kind == Snapshot::kAppNoJIT) { | 539 if (kind == Snapshot::kAppNoJIT) { |
540 s->WriteRef(func->ptr()->code_); | 540 s->WriteRef(func->ptr()->code_); |
541 } else if (s->kind() == Snapshot::kAppWithJIT) { | 541 } else if (s->kind() == Snapshot::kAppWithJIT) { |
542 s->WriteRef(func->ptr()->unoptimized_code_); | 542 NOT_IN_PRECOMPILED(s->WriteRef(func->ptr()->unoptimized_code_)); |
543 s->WriteRef(func->ptr()->ic_data_array_); | 543 s->WriteRef(func->ptr()->ic_data_array_); |
544 } | 544 } |
545 | 545 |
546 s->WriteTokenPosition(func->ptr()->token_pos_); | 546 #if !defined(DART_PRECOMPILED_RUNTIME) |
Florian Schneider
2016/09/14 21:32:52
The reading code will be needed at startup, But wo
rmacnak
2016/09/15 17:01:22
Done.
| |
547 s->WriteTokenPosition(func->ptr()->end_token_pos_); | 547 if (kind != Snapshot::kAppNoJIT) { |
548 s->WriteTokenPosition(func->ptr()->token_pos_); | |
549 s->WriteTokenPosition(func->ptr()->end_token_pos_); | |
550 } | |
551 #endif | |
548 s->Write<int16_t>(func->ptr()->num_fixed_parameters_); | 552 s->Write<int16_t>(func->ptr()->num_fixed_parameters_); |
549 s->Write<int16_t>(func->ptr()->num_optional_parameters_); | 553 s->Write<int16_t>(func->ptr()->num_optional_parameters_); |
550 s->Write<uint32_t>(func->ptr()->kind_tag_); | 554 s->Write<uint32_t>(func->ptr()->kind_tag_); |
551 if (kind == Snapshot::kAppNoJIT) { | 555 if (kind == Snapshot::kAppNoJIT) { |
552 // Omit fields used to support de/reoptimization. | 556 // Omit fields used to support de/reoptimization. |
553 } else { | 557 } else { |
558 #if !defined(DART_PRECOMPILED_RUNTIME) | |
554 bool is_optimized = Code::IsOptimized(func->ptr()->code_); | 559 bool is_optimized = Code::IsOptimized(func->ptr()->code_); |
555 if (is_optimized) { | 560 if (is_optimized) { |
556 s->Write<int32_t>(FLAG_optimization_counter_threshold); | 561 s->Write<int32_t>(FLAG_optimization_counter_threshold); |
557 } else { | 562 } else { |
558 s->Write<int32_t>(0); | 563 s->Write<int32_t>(0); |
559 } | 564 } |
560 s->Write<int8_t>(func->ptr()->deoptimization_counter_); | 565 s->Write<int8_t>(func->ptr()->deoptimization_counter_); |
561 s->Write<uint16_t>(func->ptr()->optimized_instruction_count_); | 566 s->Write<uint16_t>(func->ptr()->optimized_instruction_count_); |
562 s->Write<uint16_t>(func->ptr()->optimized_call_site_count_); | 567 s->Write<uint16_t>(func->ptr()->optimized_call_site_count_); |
568 #endif | |
563 } | 569 } |
564 } | 570 } |
565 } | 571 } |
566 | 572 |
567 private: | 573 private: |
568 GrowableArray<RawFunction*> objects_; | 574 GrowableArray<RawFunction*> objects_; |
569 }; | 575 }; |
570 | 576 |
571 | 577 |
572 class FunctionDeserializationCluster : public DeserializationCluster { | 578 class FunctionDeserializationCluster : public DeserializationCluster { |
(...skipping 25 matching lines...) Expand all Loading... | |
598 RawObject** to = func->to(); | 604 RawObject** to = func->to(); |
599 for (RawObject** p = from; p <= to_snapshot; p++) { | 605 for (RawObject** p = from; p <= to_snapshot; p++) { |
600 *p = d->ReadRef(); | 606 *p = d->ReadRef(); |
601 } | 607 } |
602 for (RawObject** p = to_snapshot + 1; p <= to; p++) { | 608 for (RawObject** p = to_snapshot + 1; p <= to; p++) { |
603 *p = Object::null(); | 609 *p = Object::null(); |
604 } | 610 } |
605 if (kind == Snapshot::kAppNoJIT) { | 611 if (kind == Snapshot::kAppNoJIT) { |
606 func->ptr()->code_ = reinterpret_cast<RawCode*>(d->ReadRef()); | 612 func->ptr()->code_ = reinterpret_cast<RawCode*>(d->ReadRef()); |
607 } else if (kind == Snapshot::kAppWithJIT) { | 613 } else if (kind == Snapshot::kAppWithJIT) { |
608 func->ptr()->unoptimized_code_ = | 614 NOT_IN_PRECOMPILED(func->ptr()->unoptimized_code_ = |
609 reinterpret_cast<RawCode*>(d->ReadRef()); | 615 reinterpret_cast<RawCode*>(d->ReadRef())); |
610 func->ptr()->ic_data_array_ = reinterpret_cast<RawArray*>(d->ReadRef()); | 616 func->ptr()->ic_data_array_ = reinterpret_cast<RawArray*>(d->ReadRef()); |
611 } | 617 } |
612 | 618 |
613 #if defined(DEBUG) | 619 #if defined(DEBUG) |
614 func->ptr()->entry_point_ = 0; | 620 func->ptr()->entry_point_ = 0; |
615 #endif | 621 #endif |
616 | 622 |
617 func->ptr()->token_pos_ = d->ReadTokenPosition(); | 623 #if !defined(DART_PRECOMPILED_RUNTIME) |
618 func->ptr()->end_token_pos_ = d->ReadTokenPosition(); | 624 if (kind != Snapshot::kAppNoJIT) { |
625 func->ptr()->token_pos_ = d->ReadTokenPosition(); | |
626 func->ptr()->end_token_pos_ = d->ReadTokenPosition(); | |
627 } | |
628 #endif | |
619 func->ptr()->num_fixed_parameters_ = d->Read<int16_t>(); | 629 func->ptr()->num_fixed_parameters_ = d->Read<int16_t>(); |
620 func->ptr()->num_optional_parameters_ = d->Read<int16_t>(); | 630 func->ptr()->num_optional_parameters_ = d->Read<int16_t>(); |
621 func->ptr()->kind_tag_ = d->Read<uint32_t>(); | 631 func->ptr()->kind_tag_ = d->Read<uint32_t>(); |
622 if (kind == Snapshot::kAppNoJIT) { | 632 if (kind == Snapshot::kAppNoJIT) { |
623 // Omit fields used to support de/reoptimization. | 633 // Omit fields used to support de/reoptimization. |
624 } else { | 634 } else { |
635 #if !defined(DART_PRECOMPILED_RUNTIME) | |
625 func->ptr()->usage_counter_ = d->Read<int32_t>(); | 636 func->ptr()->usage_counter_ = d->Read<int32_t>(); |
626 func->ptr()->deoptimization_counter_ = d->Read<int8_t>(); | 637 func->ptr()->deoptimization_counter_ = d->Read<int8_t>(); |
627 func->ptr()->optimized_instruction_count_ = d->Read<uint16_t>(); | 638 func->ptr()->optimized_instruction_count_ = d->Read<uint16_t>(); |
628 func->ptr()->optimized_call_site_count_ = d->Read<uint16_t>(); | 639 func->ptr()->optimized_call_site_count_ = d->Read<uint16_t>(); |
640 #endif | |
629 } | 641 } |
630 } | 642 } |
631 } | 643 } |
632 | 644 |
633 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { | 645 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { |
634 NOT_IN_PRODUCT(TimelineDurationScope tds(Thread::Current(), | 646 NOT_IN_PRODUCT(TimelineDurationScope tds(Thread::Current(), |
635 Timeline::GetIsolateStream(), "PostLoadFunction")); | 647 Timeline::GetIsolateStream(), "PostLoadFunction")); |
636 | 648 |
637 if (kind == Snapshot::kAppNoJIT) { | 649 if (kind == Snapshot::kAppNoJIT) { |
638 Function& func = Function::Handle(zone); | 650 Function& func = Function::Handle(zone); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
672 | 684 |
673 class ClosureDataSerializationCluster : public SerializationCluster { | 685 class ClosureDataSerializationCluster : public SerializationCluster { |
674 public: | 686 public: |
675 ClosureDataSerializationCluster() { } | 687 ClosureDataSerializationCluster() { } |
676 virtual ~ClosureDataSerializationCluster() { } | 688 virtual ~ClosureDataSerializationCluster() { } |
677 | 689 |
678 void Trace(Serializer* s, RawObject* object) { | 690 void Trace(Serializer* s, RawObject* object) { |
679 RawClosureData* data = ClosureData::RawCast(object); | 691 RawClosureData* data = ClosureData::RawCast(object); |
680 objects_.Add(data); | 692 objects_.Add(data); |
681 | 693 |
682 RawObject** from = data->from(); | 694 if (s->kind() != Snapshot::kAppNoJIT) { |
683 RawObject** to = data->to(); | 695 s->Push(data->ptr()->context_scope_); |
684 for (RawObject** p = from; p <= to; p++) { | |
685 s->Push(*p); | |
686 } | 696 } |
697 s->Push(data->ptr()->parent_function_); | |
698 s->Push(data->ptr()->signature_type_); | |
699 s->Push(data->ptr()->closure_); | |
687 } | 700 } |
688 | 701 |
689 void WriteAlloc(Serializer* s) { | 702 void WriteAlloc(Serializer* s) { |
690 s->WriteCid(kClosureDataCid); | 703 s->WriteCid(kClosureDataCid); |
691 intptr_t count = objects_.length(); | 704 intptr_t count = objects_.length(); |
692 s->Write<int32_t>(count); | 705 s->Write<int32_t>(count); |
693 for (intptr_t i = 0; i < count; i++) { | 706 for (intptr_t i = 0; i < count; i++) { |
694 RawClosureData* data = objects_[i]; | 707 RawClosureData* data = objects_[i]; |
695 s->AssignRef(data); | 708 s->AssignRef(data); |
696 } | 709 } |
697 } | 710 } |
698 | 711 |
699 void WriteFill(Serializer* s) { | 712 void WriteFill(Serializer* s) { |
700 intptr_t count = objects_.length(); | 713 intptr_t count = objects_.length(); |
701 for (intptr_t i = 0; i < count; i++) { | 714 if (s->kind() == Snapshot::kAppNoJIT) { |
702 RawClosureData* data = objects_[i]; | 715 for (intptr_t i = 0; i < count; i++) { |
703 RawObject** from = data->from(); | 716 RawClosureData* data = objects_[i]; |
704 RawObject** to = data->to(); | 717 s->WriteRef(data->ptr()->parent_function_); |
705 for (RawObject** p = from; p <= to; p++) { | 718 s->WriteRef(data->ptr()->signature_type_); |
706 s->WriteRef(*p); | 719 s->WriteRef(data->ptr()->closure_); |
720 } | |
721 } else { | |
722 for (intptr_t i = 0; i < count; i++) { | |
723 RawClosureData* data = objects_[i]; | |
724 s->WriteRef(data->ptr()->context_scope_); | |
725 s->WriteRef(data->ptr()->parent_function_); | |
726 s->WriteRef(data->ptr()->signature_type_); | |
727 s->WriteRef(data->ptr()->closure_); | |
707 } | 728 } |
708 } | 729 } |
709 } | 730 } |
710 | 731 |
711 private: | 732 private: |
712 GrowableArray<RawClosureData*> objects_; | 733 GrowableArray<RawClosureData*> objects_; |
713 }; | 734 }; |
714 | 735 |
715 | 736 |
716 class ClosureDataDeserializationCluster : public DeserializationCluster { | 737 class ClosureDataDeserializationCluster : public DeserializationCluster { |
717 public: | 738 public: |
718 ClosureDataDeserializationCluster() { } | 739 ClosureDataDeserializationCluster() { } |
719 virtual ~ClosureDataDeserializationCluster() { } | 740 virtual ~ClosureDataDeserializationCluster() { } |
720 | 741 |
721 void ReadAlloc(Deserializer* d) { | 742 void ReadAlloc(Deserializer* d) { |
722 start_index_ = d->next_index(); | 743 start_index_ = d->next_index(); |
723 PageSpace* old_space = d->heap()->old_space(); | 744 PageSpace* old_space = d->heap()->old_space(); |
724 intptr_t count = d->Read<int32_t>(); | 745 intptr_t count = d->Read<int32_t>(); |
725 for (intptr_t i = 0; i < count; i++) { | 746 for (intptr_t i = 0; i < count; i++) { |
726 d->AssignRef(AllocateUninitialized(old_space, | 747 d->AssignRef(AllocateUninitialized(old_space, |
727 ClosureData::InstanceSize())); | 748 ClosureData::InstanceSize())); |
728 } | 749 } |
729 stop_index_ = d->next_index(); | 750 stop_index_ = d->next_index(); |
730 } | 751 } |
731 | 752 |
732 void ReadFill(Deserializer* d) { | 753 void ReadFill(Deserializer* d) { |
733 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 754 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
734 | 755 |
735 for (intptr_t id = start_index_; id < stop_index_; id++) { | 756 if (d->kind() == Snapshot::kAppNoJIT) { |
736 RawClosureData* data = reinterpret_cast<RawClosureData*>(d->Ref(id)); | 757 for (intptr_t id = start_index_; id < stop_index_; id++) { |
737 Deserializer::InitializeHeader(data, kClosureDataCid, | 758 RawClosureData* data = reinterpret_cast<RawClosureData*>(d->Ref(id)); |
738 ClosureData::InstanceSize(), is_vm_object); | 759 Deserializer::InitializeHeader(data, kClosureDataCid, |
739 RawObject** from = data->from(); | 760 ClosureData::InstanceSize(), |
740 RawObject** to = data->to(); | 761 is_vm_object); |
741 for (RawObject** p = from; p <= to; p++) { | 762 data->ptr()->context_scope_ = ContextScope::null(); |
Florian Schneider
2016/09/14 21:32:52
Maybe only put handling of context_scope_ with the
rmacnak
2016/09/15 17:01:22
Done.
| |
742 *p = d->ReadRef(); | 763 data->ptr()->parent_function_ = static_cast<RawFunction*>(d->ReadRef()); |
764 data->ptr()->signature_type_ = static_cast<RawType*>(d->ReadRef()); | |
765 data->ptr()->closure_ = static_cast<RawInstance*>(d->ReadRef()); | |
766 } | |
767 } else { | |
768 for (intptr_t id = start_index_; id < stop_index_; id++) { | |
769 RawClosureData* data = reinterpret_cast<RawClosureData*>(d->Ref(id)); | |
770 Deserializer::InitializeHeader(data, kClosureDataCid, | |
771 ClosureData::InstanceSize(), | |
772 is_vm_object); | |
773 data->ptr()->context_scope_ = | |
774 static_cast<RawContextScope*>(d->ReadRef()); | |
775 data->ptr()->parent_function_ = static_cast<RawFunction*>(d->ReadRef()); | |
776 data->ptr()->signature_type_ = static_cast<RawType*>(d->ReadRef()); | |
777 data->ptr()->closure_ = static_cast<RawInstance*>(d->ReadRef()); | |
743 } | 778 } |
744 } | 779 } |
745 } | 780 } |
746 }; | 781 }; |
747 | 782 |
748 | 783 |
749 class RedirectionDataSerializationCluster : public SerializationCluster { | 784 class RedirectionDataSerializationCluster : public SerializationCluster { |
750 public: | 785 public: |
751 RedirectionDataSerializationCluster() { } | 786 RedirectionDataSerializationCluster() { } |
752 virtual ~RedirectionDataSerializationCluster() { } | 787 virtual ~RedirectionDataSerializationCluster() { } |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1454 for (intptr_t i = 0; i < count; i++) { | 1489 for (intptr_t i = 0; i < count; i++) { |
1455 RawCode* code = objects_[i]; | 1490 RawCode* code = objects_[i]; |
1456 | 1491 |
1457 intptr_t pointer_offsets_length = | 1492 intptr_t pointer_offsets_length = |
1458 Code::PtrOffBits::decode(code->ptr()->state_bits_); | 1493 Code::PtrOffBits::decode(code->ptr()->state_bits_); |
1459 if (pointer_offsets_length != 0) { | 1494 if (pointer_offsets_length != 0) { |
1460 FATAL("Cannot serialize code with embedded pointers"); | 1495 FATAL("Cannot serialize code with embedded pointers"); |
1461 } | 1496 } |
1462 if (kind == Snapshot::kAppNoJIT) { | 1497 if (kind == Snapshot::kAppNoJIT) { |
1463 // No disabled code in precompilation. | 1498 // No disabled code in precompilation. |
1464 ASSERT(code->ptr()->instructions_ == code->ptr()->active_instructions_); | 1499 NOT_IN_PRECOMPILED(ASSERT( |
1500 code->ptr()->instructions_ == code->ptr()->active_instructions_)); | |
1465 } else { | 1501 } else { |
1466 ASSERT(kind == Snapshot::kAppWithJIT); | 1502 ASSERT(kind == Snapshot::kAppWithJIT); |
1467 // We never include optimized code in JIT precompilation. Deoptimization | 1503 // We never include optimized code in JIT precompilation. Deoptimization |
1468 // requires code patching and we cannot patch code that is shared | 1504 // requires code patching and we cannot patch code that is shared |
1469 // between isolates and should not mutate memory allocated by the | 1505 // between isolates and should not mutate memory allocated by the |
1470 // embedder. | 1506 // embedder. |
1471 bool is_optimized = Code::PtrOffBits::decode(code->ptr()->state_bits_); | 1507 bool is_optimized = Code::PtrOffBits::decode(code->ptr()->state_bits_); |
1472 if (is_optimized) { | 1508 if (is_optimized) { |
1473 FATAL("Cannot include optimized code in a JIT snapshot"); | 1509 FATAL("Cannot include optimized code in a JIT snapshot"); |
1474 } | 1510 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1516 Deserializer::InitializeHeader(code, kCodeCid, | 1552 Deserializer::InitializeHeader(code, kCodeCid, |
1517 Code::InstanceSize(0), is_vm_object); | 1553 Code::InstanceSize(0), is_vm_object); |
1518 | 1554 |
1519 int32_t text_offset = d->Read<int32_t>(); | 1555 int32_t text_offset = d->Read<int32_t>(); |
1520 RawInstructions* instr = reinterpret_cast<RawInstructions*>( | 1556 RawInstructions* instr = reinterpret_cast<RawInstructions*>( |
1521 d->GetInstructionsAt(text_offset) + kHeapObjectTag); | 1557 d->GetInstructionsAt(text_offset) + kHeapObjectTag); |
1522 | 1558 |
1523 code->ptr()->entry_point_ = Instructions::UncheckedEntryPoint(instr); | 1559 code->ptr()->entry_point_ = Instructions::UncheckedEntryPoint(instr); |
1524 code->ptr()->checked_entry_point_ = | 1560 code->ptr()->checked_entry_point_ = |
1525 Instructions::CheckedEntryPoint(instr); | 1561 Instructions::CheckedEntryPoint(instr); |
1526 code->ptr()->active_instructions_ = instr; | 1562 NOT_IN_PRECOMPILED(code->ptr()->active_instructions_ = instr); |
1527 code->ptr()->instructions_ = instr; | 1563 code->ptr()->instructions_ = instr; |
1528 code->ptr()->object_pool_ = | 1564 code->ptr()->object_pool_ = |
1529 reinterpret_cast<RawObjectPool*>(d->ReadRef()); | 1565 reinterpret_cast<RawObjectPool*>(d->ReadRef()); |
1530 code->ptr()->owner_ = d->ReadRef(); | 1566 code->ptr()->owner_ = d->ReadRef(); |
1531 code->ptr()->exception_handlers_ = | 1567 code->ptr()->exception_handlers_ = |
1532 reinterpret_cast<RawExceptionHandlers*>(d->ReadRef()); | 1568 reinterpret_cast<RawExceptionHandlers*>(d->ReadRef()); |
1533 code->ptr()->pc_descriptors_ = | 1569 code->ptr()->pc_descriptors_ = |
1534 reinterpret_cast<RawPcDescriptors*>(d->ReadRef()); | 1570 reinterpret_cast<RawPcDescriptors*>(d->ReadRef()); |
1535 code->ptr()->stackmaps_ = | 1571 code->ptr()->stackmaps_ = |
1536 reinterpret_cast<RawArray*>(d->ReadRef()); | 1572 reinterpret_cast<RawArray*>(d->ReadRef()); |
1537 | 1573 |
1574 #if !defined(DART_PRECOMPILED_RUNTIME) | |
1538 code->ptr()->deopt_info_array_ = Array::null(); | 1575 code->ptr()->deopt_info_array_ = Array::null(); |
1539 code->ptr()->static_calls_target_table_ = Array::null(); | 1576 code->ptr()->static_calls_target_table_ = Array::null(); |
1540 code->ptr()->var_descriptors_ = LocalVarDescriptors::null(); | 1577 code->ptr()->var_descriptors_ = LocalVarDescriptors::null(); |
1541 code->ptr()->inlined_metadata_ = Array::null(); | 1578 code->ptr()->inlined_metadata_ = Array::null(); |
1542 code->ptr()->code_source_map_ = CodeSourceMap::null(); | 1579 code->ptr()->code_source_map_ = CodeSourceMap::null(); |
1543 code->ptr()->comments_ = Array::null(); | 1580 code->ptr()->comments_ = Array::null(); |
1544 code->ptr()->return_address_metadata_ = Object::null(); | 1581 code->ptr()->return_address_metadata_ = Object::null(); |
1545 | 1582 |
1546 code->ptr()->compile_timestamp_ = 0; | 1583 code->ptr()->compile_timestamp_ = 0; |
1584 #endif | |
1547 code->ptr()->state_bits_ = d->Read<int32_t>(); | 1585 code->ptr()->state_bits_ = d->Read<int32_t>(); |
1586 #if !defined(DART_PRECOMPILED_RUNTIME) | |
1548 code->ptr()->lazy_deopt_pc_offset_ = -1; | 1587 code->ptr()->lazy_deopt_pc_offset_ = -1; |
1588 #endif | |
1549 } | 1589 } |
1550 } | 1590 } |
1551 }; | 1591 }; |
1552 | 1592 |
1553 | 1593 |
1554 class ObjectPoolSerializationCluster : public SerializationCluster { | 1594 class ObjectPoolSerializationCluster : public SerializationCluster { |
1555 public: | 1595 public: |
1556 ObjectPoolSerializationCluster() { } | 1596 ObjectPoolSerializationCluster() { } |
1557 virtual ~ObjectPoolSerializationCluster() { } | 1597 virtual ~ObjectPoolSerializationCluster() { } |
1558 | 1598 |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2067 void WriteFill(Serializer* s) { | 2107 void WriteFill(Serializer* s) { |
2068 Snapshot::Kind kind = s->kind(); | 2108 Snapshot::Kind kind = s->kind(); |
2069 intptr_t count = objects_.length(); | 2109 intptr_t count = objects_.length(); |
2070 for (intptr_t i = 0; i < count; i++) { | 2110 for (intptr_t i = 0; i < count; i++) { |
2071 RawICData* ic = objects_[i]; | 2111 RawICData* ic = objects_[i]; |
2072 RawObject** from = ic->from(); | 2112 RawObject** from = ic->from(); |
2073 RawObject** to = ic->to_snapshot(kind); | 2113 RawObject** to = ic->to_snapshot(kind); |
2074 for (RawObject** p = from; p <= to; p++) { | 2114 for (RawObject** p = from; p <= to; p++) { |
2075 s->WriteRef(*p); | 2115 s->WriteRef(*p); |
2076 } | 2116 } |
2077 s->Write<int32_t>(ic->ptr()->deopt_id_); | 2117 if (kind != Snapshot::kAppNoJIT) { |
2118 NOT_IN_PRECOMPILED(s->Write<int32_t>(ic->ptr()->deopt_id_)); | |
2119 } | |
2078 s->Write<uint32_t>(ic->ptr()->state_bits_); | 2120 s->Write<uint32_t>(ic->ptr()->state_bits_); |
2079 #if defined(TAG_IC_DATA) | 2121 #if defined(TAG_IC_DATA) |
2080 s->Write<int32_t>(ic->ptr()->tag_); | 2122 s->Write<int32_t>(ic->ptr()->tag_); |
2081 #endif | 2123 #endif |
2082 } | 2124 } |
2083 } | 2125 } |
2084 | 2126 |
2085 private: | 2127 private: |
2086 GrowableArray<RawICData*> objects_; | 2128 GrowableArray<RawICData*> objects_; |
2087 }; | 2129 }; |
(...skipping 24 matching lines...) Expand all Loading... | |
2112 ICData::InstanceSize(), is_vm_object); | 2154 ICData::InstanceSize(), is_vm_object); |
2113 RawObject** from = ic->from(); | 2155 RawObject** from = ic->from(); |
2114 RawObject** to_snapshot = ic->to_snapshot(kind); | 2156 RawObject** to_snapshot = ic->to_snapshot(kind); |
2115 RawObject** to = ic->to(); | 2157 RawObject** to = ic->to(); |
2116 for (RawObject** p = from; p <= to_snapshot; p++) { | 2158 for (RawObject** p = from; p <= to_snapshot; p++) { |
2117 *p = d->ReadRef(); | 2159 *p = d->ReadRef(); |
2118 } | 2160 } |
2119 for (RawObject** p = to_snapshot + 1; p <= to; p++) { | 2161 for (RawObject** p = to_snapshot + 1; p <= to; p++) { |
2120 *p = Object::null(); | 2162 *p = Object::null(); |
2121 } | 2163 } |
2122 ic->ptr()->deopt_id_ = d->Read<int32_t>(); | 2164 NOT_IN_PRECOMPILED(ic->ptr()->deopt_id_ = d->Read<int32_t>()); |
2123 ic->ptr()->state_bits_ = d->Read<int32_t>(); | 2165 ic->ptr()->state_bits_ = d->Read<int32_t>(); |
2124 #if defined(TAG_IC_DATA) | 2166 #if defined(TAG_IC_DATA) |
2125 ic->ptr()->tag_ = d->Read<int32_t>(); | 2167 ic->ptr()->tag_ = d->Read<int32_t>(); |
2126 #endif | 2168 #endif |
2127 } | 2169 } |
2128 } | 2170 } |
2129 }; | 2171 }; |
2130 | 2172 |
2131 | 2173 |
2132 class MegamorphicCacheSerializationCluster : public SerializationCluster { | 2174 class MegamorphicCacheSerializationCluster : public SerializationCluster { |
(...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5015 | 5057 |
5016 deserializer.ReadVMSnapshot(); | 5058 deserializer.ReadVMSnapshot(); |
5017 | 5059 |
5018 Dart::set_instructions_snapshot_buffer(instructions_buffer_); | 5060 Dart::set_instructions_snapshot_buffer(instructions_buffer_); |
5019 Dart::set_data_snapshot_buffer(data_buffer_); | 5061 Dart::set_data_snapshot_buffer(data_buffer_); |
5020 | 5062 |
5021 return ApiError::null(); | 5063 return ApiError::null(); |
5022 } | 5064 } |
5023 | 5065 |
5024 } // namespace dart | 5066 } // namespace dart |
OLD | NEW |