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/native_entry.h" | 5 #include "vm/native_entry.h" |
6 #include "vm/object.h" | 6 #include "vm/object.h" |
7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
8 #include "vm/snapshot.h" | 8 #include "vm/snapshot.h" |
9 #include "vm/stub_code.h" | 9 #include "vm/stub_code.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
757 | 757 |
758 // Write out the boolean is_in_fullsnapshot first as this will | 758 // Write out the boolean is_in_fullsnapshot first as this will |
759 // help the reader decide how the rest of the information needs | 759 // help the reader decide how the rest of the information needs |
760 // to be interpreted. | 760 // to be interpreted. |
761 writer->Write<bool>(is_in_fullsnapshot); | 761 writer->Write<bool>(is_in_fullsnapshot); |
762 | 762 |
763 if (!is_in_fullsnapshot) { | 763 if (!is_in_fullsnapshot) { |
764 bool is_optimized = Code::IsOptimized(ptr()->code_); | 764 bool is_optimized = Code::IsOptimized(ptr()->code_); |
765 | 765 |
766 // Write out all the non object fields. | 766 // Write out all the non object fields. |
767 #if !defined(DART_PRECOMPILED_RUNTIME) | |
Florian Schneider
2016/09/15 17:17:37
In a separate CL, it may be worth excluding the wr
rmacnak
2016/09/16 21:59:02
Acknowledged.
| |
767 writer->Write<int32_t>(ptr()->token_pos_.SnapshotEncode()); | 768 writer->Write<int32_t>(ptr()->token_pos_.SnapshotEncode()); |
768 writer->Write<int32_t>(ptr()->end_token_pos_.SnapshotEncode()); | 769 writer->Write<int32_t>(ptr()->end_token_pos_.SnapshotEncode()); |
770 #endif | |
769 writer->Write<int16_t>(ptr()->num_fixed_parameters_); | 771 writer->Write<int16_t>(ptr()->num_fixed_parameters_); |
770 writer->Write<int16_t>(ptr()->num_optional_parameters_); | 772 writer->Write<int16_t>(ptr()->num_optional_parameters_); |
771 writer->Write<uint32_t>(ptr()->kind_tag_); | 773 writer->Write<uint32_t>(ptr()->kind_tag_); |
774 #if !defined(DART_PRECOMPILED_RUNTIME) | |
772 if (is_optimized) { | 775 if (is_optimized) { |
773 writer->Write<int32_t>(FLAG_optimization_counter_threshold); | 776 writer->Write<int32_t>(FLAG_optimization_counter_threshold); |
774 } else { | 777 } else { |
775 writer->Write<int32_t>(0); | 778 writer->Write<int32_t>(0); |
776 } | 779 } |
777 writer->Write<int8_t>(ptr()->deoptimization_counter_); | 780 writer->Write<int8_t>(ptr()->deoptimization_counter_); |
778 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); | 781 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); |
779 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); | 782 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); |
783 #endif | |
780 | 784 |
781 // Write out all the object pointer fields. | 785 // Write out all the object pointer fields. |
782 SnapshotWriterVisitor visitor(writer, kAsReference); | 786 SnapshotWriterVisitor visitor(writer, kAsReference); |
783 visitor.VisitPointers(from(), to_snapshot()); | 787 visitor.VisitPointers(from(), to_snapshot()); |
784 if (is_optimized) { | 788 if (is_optimized) { |
785 // Write out the ic data array as the function is optimized. | 789 // Write out the ic data array as the function is optimized. |
786 writer->WriteObjectImpl(ptr()->ic_data_array_, kAsReference); | 790 writer->WriteObjectImpl(ptr()->ic_data_array_, kAsReference); |
787 } | 791 } |
788 } else { | 792 } else { |
789 writer->WriteFunctionId(this, owner_is_class); | 793 writer->WriteFunctionId(this, owner_is_class); |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1535 RawICData* ICData::ReadFrom(SnapshotReader* reader, | 1539 RawICData* ICData::ReadFrom(SnapshotReader* reader, |
1536 intptr_t object_id, | 1540 intptr_t object_id, |
1537 intptr_t tags, | 1541 intptr_t tags, |
1538 Snapshot::Kind kind, | 1542 Snapshot::Kind kind, |
1539 bool as_reference) { | 1543 bool as_reference) { |
1540 ASSERT(kind == Snapshot::kScript); | 1544 ASSERT(kind == Snapshot::kScript); |
1541 | 1545 |
1542 ICData& result = ICData::ZoneHandle(reader->zone(), ICData::New()); | 1546 ICData& result = ICData::ZoneHandle(reader->zone(), ICData::New()); |
1543 reader->AddBackRef(object_id, &result, kIsDeserialized); | 1547 reader->AddBackRef(object_id, &result, kIsDeserialized); |
1544 | 1548 |
1545 result.set_deopt_id(reader->Read<int32_t>()); | 1549 NOT_IN_PRECOMPILED(result.set_deopt_id(reader->Read<int32_t>())); |
1546 result.set_state_bits(reader->Read<uint32_t>()); | 1550 result.set_state_bits(reader->Read<uint32_t>()); |
1547 #if defined(TAG_IC_DATA) | 1551 #if defined(TAG_IC_DATA) |
1548 result.set_tag(reader->Read<int16_t>()); | 1552 result.set_tag(reader->Read<int16_t>()); |
1549 #endif | 1553 #endif |
1550 | 1554 |
1551 // Set all the object fields. | 1555 // Set all the object fields. |
1552 READ_OBJECT_FIELDS(result, | 1556 READ_OBJECT_FIELDS(result, |
1553 result.raw()->from(), | 1557 result.raw()->from(), |
1554 result.raw()->to_snapshot(kind), | 1558 result.raw()->to_snapshot(kind), |
1555 kAsReference); | 1559 kAsReference); |
1556 | 1560 |
1557 return result.raw(); | 1561 return result.raw(); |
1558 } | 1562 } |
1559 | 1563 |
1560 | 1564 |
1561 void RawICData::WriteTo(SnapshotWriter* writer, | 1565 void RawICData::WriteTo(SnapshotWriter* writer, |
1562 intptr_t object_id, | 1566 intptr_t object_id, |
1563 Snapshot::Kind kind, | 1567 Snapshot::Kind kind, |
1564 bool as_reference) { | 1568 bool as_reference) { |
1565 ASSERT(kind == Snapshot::kScript); | 1569 ASSERT(kind == Snapshot::kScript); |
1566 | 1570 |
1567 // Write out the serialization header value for this object. | 1571 // Write out the serialization header value for this object. |
1568 writer->WriteInlinedObjectHeader(object_id); | 1572 writer->WriteInlinedObjectHeader(object_id); |
1569 | 1573 |
1570 // Write out the class and tags information. | 1574 // Write out the class and tags information. |
1571 writer->WriteVMIsolateObject(kICDataCid); | 1575 writer->WriteVMIsolateObject(kICDataCid); |
1572 writer->WriteTags(writer->GetObjectTags(this)); | 1576 writer->WriteTags(writer->GetObjectTags(this)); |
1573 | 1577 |
1574 // Write out all the non object fields. | 1578 // Write out all the non object fields. |
1575 writer->Write<int32_t>(ptr()->deopt_id_); | 1579 NOT_IN_PRECOMPILED(writer->Write<int32_t>(ptr()->deopt_id_)); |
1576 writer->Write<uint32_t>(ptr()->state_bits_); | 1580 writer->Write<uint32_t>(ptr()->state_bits_); |
1577 #if defined(TAG_IC_DATA) | 1581 #if defined(TAG_IC_DATA) |
1578 writer->Write<int16_t>(ptr()->tag_); | 1582 writer->Write<int16_t>(ptr()->tag_); |
1579 #endif | 1583 #endif |
1580 | 1584 |
1581 // Write out all the object pointer fields. | 1585 // Write out all the object pointer fields. |
1582 // In precompiled snapshots, omit the owner field. The owner field may | 1586 // In precompiled snapshots, omit the owner field. The owner field may |
1583 // refer to a function which was always inlined and no longer needed. | 1587 // refer to a function which was always inlined and no longer needed. |
1584 SnapshotWriterVisitor visitor(writer, kAsReference); | 1588 SnapshotWriterVisitor visitor(writer, kAsReference); |
1585 visitor.VisitPointers(from(), to_snapshot(kind)); | 1589 visitor.VisitPointers(from(), to_snapshot(kind)); |
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3042 // We do not allow objects with native fields in an isolate message. | 3046 // We do not allow objects with native fields in an isolate message. |
3043 writer->SetWriteException(Exceptions::kArgument, | 3047 writer->SetWriteException(Exceptions::kArgument, |
3044 "Illegal argument in isolate message" | 3048 "Illegal argument in isolate message" |
3045 " : (object is a UserTag)"); | 3049 " : (object is a UserTag)"); |
3046 } else { | 3050 } else { |
3047 UNREACHABLE(); | 3051 UNREACHABLE(); |
3048 } | 3052 } |
3049 } | 3053 } |
3050 | 3054 |
3051 } // namespace dart | 3055 } // namespace dart |
OLD | NEW |