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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 // Write out the serialization header value for this object. | 675 // Write out the serialization header value for this object. |
676 writer->WriteInlinedObjectHeader(object_id); | 676 writer->WriteInlinedObjectHeader(object_id); |
677 | 677 |
678 // Write out the class and tags information. | 678 // Write out the class and tags information. |
679 writer->WriteVMIsolateObject(kFunctionCid); | 679 writer->WriteVMIsolateObject(kFunctionCid); |
680 writer->WriteTags(writer->GetObjectTags(this)); | 680 writer->WriteTags(writer->GetObjectTags(this)); |
681 | 681 |
682 // Write out all the non object fields. | 682 // Write out all the non object fields. |
683 writer->Write<int32_t>(ptr()->token_pos_); | 683 writer->Write<int32_t>(ptr()->token_pos_); |
684 writer->Write<int32_t>(ptr()->end_token_pos_); | 684 writer->Write<int32_t>(ptr()->end_token_pos_); |
685 if (Code::IsOptimized(ptr()->instructions_->ptr()->code_)) { | 685 if (Code::IsOptimized(ptr()->code_)) { |
686 writer->Write<int32_t>(FLAG_optimization_counter_threshold); | 686 writer->Write<int32_t>(FLAG_optimization_counter_threshold); |
687 } else { | 687 } else { |
688 writer->Write<int32_t>(0); | 688 writer->Write<int32_t>(0); |
689 } | 689 } |
690 writer->Write<int16_t>(ptr()->num_fixed_parameters_); | 690 writer->Write<int16_t>(ptr()->num_fixed_parameters_); |
691 writer->Write<int16_t>(ptr()->num_optional_parameters_); | 691 writer->Write<int16_t>(ptr()->num_optional_parameters_); |
692 writer->Write<int16_t>(ptr()->deoptimization_counter_); | 692 writer->Write<int16_t>(ptr()->deoptimization_counter_); |
693 writer->Write<uint32_t>(ptr()->kind_tag_); | 693 writer->Write<uint32_t>(ptr()->kind_tag_); |
694 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); | 694 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); |
695 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); | 695 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 intptr_t tags, | 1145 intptr_t tags, |
1146 Snapshot::Kind kind) { | 1146 Snapshot::Kind kind) { |
1147 ASSERT(reader->snapshot_code()); | 1147 ASSERT(reader->snapshot_code()); |
1148 ASSERT(kind == Snapshot::kFull); | 1148 ASSERT(kind == Snapshot::kFull); |
1149 | 1149 |
1150 Code& result = Code::ZoneHandle(reader->zone(), NEW_OBJECT_WITH_LEN(Code, 0)); | 1150 Code& result = Code::ZoneHandle(reader->zone(), NEW_OBJECT_WITH_LEN(Code, 0)); |
1151 reader->AddBackRef(object_id, &result, kIsDeserialized); | 1151 reader->AddBackRef(object_id, &result, kIsDeserialized); |
1152 | 1152 |
1153 result.set_compile_timestamp(reader->Read<int64_t>()); | 1153 result.set_compile_timestamp(reader->Read<int64_t>()); |
1154 result.set_state_bits(reader->Read<int32_t>()); | 1154 result.set_state_bits(reader->Read<int32_t>()); |
1155 result.set_entry_patch_pc_offset(reader->Read<int32_t>()); | |
1156 result.set_patch_code_pc_offset(reader->Read<int32_t>()); | |
1157 result.set_lazy_deopt_pc_offset(reader->Read<int32_t>()); | 1155 result.set_lazy_deopt_pc_offset(reader->Read<int32_t>()); |
1158 | 1156 |
1159 // Set all the object fields. | 1157 // Set all the object fields. |
1160 READ_OBJECT_FIELDS(result, | 1158 READ_OBJECT_FIELDS(result, |
1161 result.raw()->from(), result.raw()->to(), | 1159 result.raw()->from(), result.raw()->to(), |
1162 kAsReference); | 1160 kAsReference); |
1163 | 1161 |
1164 // TODO(rmacnak): Fix entry_point_. | 1162 // TODO(rmacnak): Fix entry_point_. |
1165 | 1163 |
1166 return result.raw(); | 1164 return result.raw(); |
(...skipping 16 matching lines...) Expand all Loading... |
1183 // Write out the serialization header value for this object. | 1181 // Write out the serialization header value for this object. |
1184 writer->WriteInlinedObjectHeader(object_id); | 1182 writer->WriteInlinedObjectHeader(object_id); |
1185 | 1183 |
1186 // Write out the class and tags information. | 1184 // Write out the class and tags information. |
1187 writer->WriteVMIsolateObject(kCodeCid); | 1185 writer->WriteVMIsolateObject(kCodeCid); |
1188 writer->WriteTags(writer->GetObjectTags(this)); | 1186 writer->WriteTags(writer->GetObjectTags(this)); |
1189 | 1187 |
1190 // Write out all the non object fields. | 1188 // Write out all the non object fields. |
1191 writer->Write<int64_t>(ptr()->compile_timestamp_); | 1189 writer->Write<int64_t>(ptr()->compile_timestamp_); |
1192 writer->Write<int32_t>(ptr()->state_bits_); | 1190 writer->Write<int32_t>(ptr()->state_bits_); |
1193 writer->Write<int32_t>(ptr()->entry_patch_pc_offset_); | |
1194 writer->Write<int32_t>(ptr()->patch_code_pc_offset_); | |
1195 writer->Write<int32_t>(ptr()->lazy_deopt_pc_offset_); | 1191 writer->Write<int32_t>(ptr()->lazy_deopt_pc_offset_); |
1196 | 1192 |
1197 // Write out all the object pointer fields. | 1193 // Write out all the object pointer fields. |
1198 SnapshotWriterVisitor visitor(writer); | 1194 SnapshotWriterVisitor visitor(writer); |
1199 visitor.VisitPointers(from(), to()); | 1195 visitor.VisitPointers(from(), to()); |
1200 | 1196 |
1201 writer->SetInstructionsCode(ptr()->instructions_, this); | 1197 writer->SetInstructionsCode(ptr()->instructions_, this); |
1202 } | 1198 } |
1203 | 1199 |
1204 | 1200 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 | 1237 |
1242 writer->Write<intptr_t>(writer->GetObjectTags(this)); // For sanity check. | 1238 writer->Write<intptr_t>(writer->GetObjectTags(this)); // For sanity check. |
1243 | 1239 |
1244 // Temporarily restore the object header for writing to the text section. | 1240 // Temporarily restore the object header for writing to the text section. |
1245 // TODO(asiva): Don't mutate object headers during serialization. | 1241 // TODO(asiva): Don't mutate object headers during serialization. |
1246 uword object_tags = writer->GetObjectTags(this); | 1242 uword object_tags = writer->GetObjectTags(this); |
1247 uword snapshot_tags = ptr()->tags_; | 1243 uword snapshot_tags = ptr()->tags_; |
1248 ptr()->tags_ = object_tags; | 1244 ptr()->tags_ = object_tags; |
1249 writer->Write<int32_t>(writer->GetInstructionsId(this)); | 1245 writer->Write<int32_t>(writer->GetInstructionsId(this)); |
1250 ptr()->tags_ = snapshot_tags; | 1246 ptr()->tags_ = snapshot_tags; |
1251 | |
1252 { | |
1253 // TODO(rmacnak): Drop after calling convention change. | |
1254 writer->WriteObjectImpl(ptr()->code_, kAsReference); | |
1255 writer->WriteObjectImpl(ptr()->object_pool_, kAsReference); | |
1256 } | |
1257 } | 1247 } |
1258 | 1248 |
1259 | 1249 |
1260 RawObjectPool* ObjectPool::ReadFrom(SnapshotReader* reader, | 1250 RawObjectPool* ObjectPool::ReadFrom(SnapshotReader* reader, |
1261 intptr_t object_id, | 1251 intptr_t object_id, |
1262 intptr_t tags, | 1252 intptr_t tags, |
1263 Snapshot::Kind kind) { | 1253 Snapshot::Kind kind) { |
1264 ASSERT(reader->snapshot_code()); | 1254 ASSERT(reader->snapshot_code()); |
1265 ASSERT(kind == Snapshot::kFull); | 1255 ASSERT(kind == Snapshot::kFull); |
1266 | 1256 |
(...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3264 // We do not allow objects with native fields in an isolate message. | 3254 // We do not allow objects with native fields in an isolate message. |
3265 writer->SetWriteException(Exceptions::kArgument, | 3255 writer->SetWriteException(Exceptions::kArgument, |
3266 "Illegal argument in isolate message" | 3256 "Illegal argument in isolate message" |
3267 " : (object is a UserTag)"); | 3257 " : (object is a UserTag)"); |
3268 } else { | 3258 } else { |
3269 UNREACHABLE(); | 3259 UNREACHABLE(); |
3270 } | 3260 } |
3271 } | 3261 } |
3272 | 3262 |
3273 } // namespace dart | 3263 } // namespace dart |
OLD | NEW |