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

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

Issue 1192103004: VM: New calling convention for generated code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: ARM64 port Created 5 years, 3 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
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/object.h" 5 #include "vm/object.h"
6 #include "vm/object_store.h" 6 #include "vm/object_store.h"
7 #include "vm/snapshot.h" 7 #include "vm/snapshot.h"
8 #include "vm/stub_code.h" 8 #include "vm/stub_code.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 // Write out the serialization header value for this object. 674 // Write out the serialization header value for this object.
675 writer->WriteInlinedObjectHeader(object_id); 675 writer->WriteInlinedObjectHeader(object_id);
676 676
677 // Write out the class and tags information. 677 // Write out the class and tags information.
678 writer->WriteVMIsolateObject(kFunctionCid); 678 writer->WriteVMIsolateObject(kFunctionCid);
679 writer->WriteTags(writer->GetObjectTags(this)); 679 writer->WriteTags(writer->GetObjectTags(this));
680 680
681 // Write out all the non object fields. 681 // Write out all the non object fields.
682 writer->Write<int32_t>(ptr()->token_pos_); 682 writer->Write<int32_t>(ptr()->token_pos_);
683 writer->Write<int32_t>(ptr()->end_token_pos_); 683 writer->Write<int32_t>(ptr()->end_token_pos_);
684 if (Code::IsOptimized(ptr()->instructions_->ptr()->code_)) { 684 if (Code::IsOptimized(ptr()->code_)) {
685 writer->Write<int32_t>(FLAG_optimization_counter_threshold); 685 writer->Write<int32_t>(FLAG_optimization_counter_threshold);
686 } else { 686 } else {
687 writer->Write<int32_t>(0); 687 writer->Write<int32_t>(0);
688 } 688 }
689 writer->Write<int16_t>(ptr()->num_fixed_parameters_); 689 writer->Write<int16_t>(ptr()->num_fixed_parameters_);
690 writer->Write<int16_t>(ptr()->num_optional_parameters_); 690 writer->Write<int16_t>(ptr()->num_optional_parameters_);
691 writer->Write<int16_t>(ptr()->deoptimization_counter_); 691 writer->Write<int16_t>(ptr()->deoptimization_counter_);
692 writer->Write<uint32_t>(ptr()->kind_tag_); 692 writer->Write<uint32_t>(ptr()->kind_tag_);
693 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); 693 writer->Write<uint16_t>(ptr()->optimized_instruction_count_);
694 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); 694 writer->Write<uint16_t>(ptr()->optimized_call_site_count_);
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 intptr_t tags, 1144 intptr_t tags,
1145 Snapshot::Kind kind) { 1145 Snapshot::Kind kind) {
1146 ASSERT(reader->snapshot_code()); 1146 ASSERT(reader->snapshot_code());
1147 ASSERT(kind == Snapshot::kFull); 1147 ASSERT(kind == Snapshot::kFull);
1148 1148
1149 Code& result = Code::ZoneHandle(reader->zone(), NEW_OBJECT_WITH_LEN(Code, 0)); 1149 Code& result = Code::ZoneHandle(reader->zone(), NEW_OBJECT_WITH_LEN(Code, 0));
1150 reader->AddBackRef(object_id, &result, kIsDeserialized); 1150 reader->AddBackRef(object_id, &result, kIsDeserialized);
1151 1151
1152 result.set_compile_timestamp(reader->Read<int64_t>()); 1152 result.set_compile_timestamp(reader->Read<int64_t>());
1153 result.set_state_bits(reader->Read<int32_t>()); 1153 result.set_state_bits(reader->Read<int32_t>());
1154 result.set_entry_patch_pc_offset(reader->Read<int32_t>());
1155 result.set_patch_code_pc_offset(reader->Read<int32_t>());
1156 result.set_lazy_deopt_pc_offset(reader->Read<int32_t>()); 1154 result.set_lazy_deopt_pc_offset(reader->Read<int32_t>());
1157 1155
1158 // Set all the object fields. 1156 // Set all the object fields.
1159 READ_OBJECT_FIELDS(result, 1157 READ_OBJECT_FIELDS(result,
1160 result.raw()->from(), result.raw()->to(), 1158 result.raw()->from(), result.raw()->to(),
1161 kAsReference); 1159 kAsReference);
1162 1160
1163 // TODO(rmacnak): Fix entry_point_. 1161 // TODO(rmacnak): Fix entry_point_.
1164 1162
1165 return result.raw(); 1163 return result.raw();
(...skipping 16 matching lines...) Expand all
1182 // Write out the serialization header value for this object. 1180 // Write out the serialization header value for this object.
1183 writer->WriteInlinedObjectHeader(object_id); 1181 writer->WriteInlinedObjectHeader(object_id);
1184 1182
1185 // Write out the class and tags information. 1183 // Write out the class and tags information.
1186 writer->WriteVMIsolateObject(kCodeCid); 1184 writer->WriteVMIsolateObject(kCodeCid);
1187 writer->WriteTags(writer->GetObjectTags(this)); 1185 writer->WriteTags(writer->GetObjectTags(this));
1188 1186
1189 // Write out all the non object fields. 1187 // Write out all the non object fields.
1190 writer->Write<int64_t>(ptr()->compile_timestamp_); 1188 writer->Write<int64_t>(ptr()->compile_timestamp_);
1191 writer->Write<int32_t>(ptr()->state_bits_); 1189 writer->Write<int32_t>(ptr()->state_bits_);
1192 writer->Write<int32_t>(ptr()->entry_patch_pc_offset_);
1193 writer->Write<int32_t>(ptr()->patch_code_pc_offset_);
1194 writer->Write<int32_t>(ptr()->lazy_deopt_pc_offset_); 1190 writer->Write<int32_t>(ptr()->lazy_deopt_pc_offset_);
1195 1191
1196 // Write out all the object pointer fields. 1192 // Write out all the object pointer fields.
1197 SnapshotWriterVisitor visitor(writer); 1193 SnapshotWriterVisitor visitor(writer);
1198 visitor.VisitPointers(from(), to()); 1194 visitor.VisitPointers(from(), to());
1199 1195
1200 writer->SetInstructionsCode(ptr()->instructions_, this); 1196 writer->SetInstructionsCode(ptr()->instructions_, this);
1201 } 1197 }
1202 1198
1203 1199
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 1236
1241 writer->Write<intptr_t>(writer->GetObjectTags(this)); // For sanity check. 1237 writer->Write<intptr_t>(writer->GetObjectTags(this)); // For sanity check.
1242 1238
1243 // Temporarily restore the object header for writing to the text section. 1239 // Temporarily restore the object header for writing to the text section.
1244 // TODO(asiva): Don't mutate object headers during serialization. 1240 // TODO(asiva): Don't mutate object headers during serialization.
1245 uword object_tags = writer->GetObjectTags(this); 1241 uword object_tags = writer->GetObjectTags(this);
1246 uword snapshot_tags = ptr()->tags_; 1242 uword snapshot_tags = ptr()->tags_;
1247 ptr()->tags_ = object_tags; 1243 ptr()->tags_ = object_tags;
1248 writer->Write<int32_t>(writer->GetInstructionsId(this)); 1244 writer->Write<int32_t>(writer->GetInstructionsId(this));
1249 ptr()->tags_ = snapshot_tags; 1245 ptr()->tags_ = snapshot_tags;
1250
1251 {
1252 // TODO(rmacnak): Drop after calling convention change.
1253 writer->WriteObjectImpl(ptr()->code_, kAsReference);
1254 writer->WriteObjectImpl(ptr()->object_pool_, kAsReference);
1255 }
1256 } 1246 }
1257 1247
1258 1248
1259 RawObjectPool* ObjectPool::ReadFrom(SnapshotReader* reader, 1249 RawObjectPool* ObjectPool::ReadFrom(SnapshotReader* reader,
1260 intptr_t object_id, 1250 intptr_t object_id,
1261 intptr_t tags, 1251 intptr_t tags,
1262 Snapshot::Kind kind) { 1252 Snapshot::Kind kind) {
1263 ASSERT(reader->snapshot_code()); 1253 ASSERT(reader->snapshot_code());
1264 ASSERT(kind == Snapshot::kFull); 1254 ASSERT(kind == Snapshot::kFull);
1265 1255
(...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after
3250 // We do not allow objects with native fields in an isolate message. 3240 // We do not allow objects with native fields in an isolate message.
3251 writer->SetWriteException(Exceptions::kArgument, 3241 writer->SetWriteException(Exceptions::kArgument,
3252 "Illegal argument in isolate message" 3242 "Illegal argument in isolate message"
3253 " : (object is a UserTag)"); 3243 " : (object is a UserTag)");
3254 } else { 3244 } else {
3255 UNREACHABLE(); 3245 UNREACHABLE();
3256 } 3246 }
3257 } 3247 }
3258 3248
3259 } // namespace dart 3249 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698