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 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 case ObjectPool::kTaggedObject: { | 1311 case ObjectPool::kTaggedObject: { |
1312 (*reader->PassiveObjectHandle()) = reader->ReadObjectImpl(kAsReference); | 1312 (*reader->PassiveObjectHandle()) = reader->ReadObjectImpl(kAsReference); |
1313 result.SetObjectAt(i, *(reader->PassiveObjectHandle())); | 1313 result.SetObjectAt(i, *(reader->PassiveObjectHandle())); |
1314 break; | 1314 break; |
1315 } | 1315 } |
1316 case ObjectPool::kImmediate: { | 1316 case ObjectPool::kImmediate: { |
1317 intptr_t raw_value = reader->Read<intptr_t>(); | 1317 intptr_t raw_value = reader->Read<intptr_t>(); |
1318 result.SetRawValueAt(i, raw_value); | 1318 result.SetRawValueAt(i, raw_value); |
1319 break; | 1319 break; |
1320 } | 1320 } |
1321 case ObjectPool::kExternalLabel: { | |
1322 // TODO(rmacnak): Relocate. | |
1323 intptr_t raw_value = reader->Read<intptr_t>(); | |
1324 result.SetRawValueAt(i, raw_value); | |
1325 break; | |
1326 } | |
1327 case ObjectPool::kNativeEntry: { | 1321 case ObjectPool::kNativeEntry: { |
1328 // Read nothing. Initialize with the lazy link entry. | 1322 // Read nothing. Initialize with the lazy link entry. |
1329 uword entry = reinterpret_cast<uword>(&NativeEntry::LinkNativeCall); | 1323 uword new_entry = NativeEntry::LinkNativeCallEntry(); |
1330 #if defined(USING_SIMULATOR) | 1324 result.SetRawValueAt(i, static_cast<intptr_t>(new_entry)); |
1331 entry = Simulator::RedirectExternalReference( | |
1332 entry, Simulator::kBootstrapNativeCall, NativeEntry::kNumArguments); | |
1333 #endif | |
1334 result.SetRawValueAt(i, entry); | |
1335 break; | 1325 break; |
1336 } | 1326 } |
1337 default: | 1327 default: |
1338 UNREACHABLE(); | 1328 UNREACHABLE(); |
1339 } | 1329 } |
1340 } | 1330 } |
1341 | 1331 |
1342 return result.raw(); | 1332 return result.raw(); |
1343 } | 1333 } |
1344 | 1334 |
(...skipping 15 matching lines...) Expand all Loading... |
1360 RawTypedData* info_array = ptr()->info_array_->ptr(); | 1350 RawTypedData* info_array = ptr()->info_array_->ptr(); |
1361 ASSERT(info_array != TypedData::null()); | 1351 ASSERT(info_array != TypedData::null()); |
1362 | 1352 |
1363 writer->Write<intptr_t>(length); | 1353 writer->Write<intptr_t>(length); |
1364 for (intptr_t i = 0; i < length; i++) { | 1354 for (intptr_t i = 0; i < length; i++) { |
1365 ObjectPool::EntryType entry_type = | 1355 ObjectPool::EntryType entry_type = |
1366 static_cast<ObjectPool::EntryType>(info_array->data()[i]); | 1356 static_cast<ObjectPool::EntryType>(info_array->data()[i]); |
1367 writer->Write<int8_t>(entry_type); | 1357 writer->Write<int8_t>(entry_type); |
1368 Entry& entry = ptr()->data()[i]; | 1358 Entry& entry = ptr()->data()[i]; |
1369 switch (entry_type) { | 1359 switch (entry_type) { |
1370 case ObjectPool::kTaggedObject: | 1360 case ObjectPool::kTaggedObject: { |
1371 writer->WriteObjectImpl(entry.raw_obj_, kAsReference); | 1361 writer->WriteObjectImpl(entry.raw_obj_, kAsReference); |
1372 break; | 1362 break; |
1373 case ObjectPool::kImmediate: | 1363 } |
| 1364 case ObjectPool::kImmediate: { |
1374 writer->Write<intptr_t>(entry.raw_value_); | 1365 writer->Write<intptr_t>(entry.raw_value_); |
1375 break; | 1366 break; |
1376 case ObjectPool::kExternalLabel: | 1367 } |
1377 // TODO(rmacnak): Write symbolically. | 1368 case ObjectPool::kNativeEntry: { |
1378 writer->Write<intptr_t>(entry.raw_value_); | |
1379 break; | |
1380 case ObjectPool::kNativeEntry: | |
1381 // Write nothing. Will initialize with the lazy link entry. | 1369 // Write nothing. Will initialize with the lazy link entry. |
1382 break; | 1370 break; |
| 1371 } |
1383 default: | 1372 default: |
1384 UNREACHABLE(); | 1373 UNREACHABLE(); |
1385 } | 1374 } |
1386 } | 1375 } |
1387 } | 1376 } |
1388 | 1377 |
1389 | 1378 |
1390 RawPcDescriptors* PcDescriptors::ReadFrom(SnapshotReader* reader, | 1379 RawPcDescriptors* PcDescriptors::ReadFrom(SnapshotReader* reader, |
1391 intptr_t object_id, | 1380 intptr_t object_id, |
1392 intptr_t tags, | 1381 intptr_t tags, |
(...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3289 // We do not allow objects with native fields in an isolate message. | 3278 // We do not allow objects with native fields in an isolate message. |
3290 writer->SetWriteException(Exceptions::kArgument, | 3279 writer->SetWriteException(Exceptions::kArgument, |
3291 "Illegal argument in isolate message" | 3280 "Illegal argument in isolate message" |
3292 " : (object is a UserTag)"); | 3281 " : (object is a UserTag)"); |
3293 } else { | 3282 } else { |
3294 UNREACHABLE(); | 3283 UNREACHABLE(); |
3295 } | 3284 } |
3296 } | 3285 } |
3297 | 3286 |
3298 } // namespace dart | 3287 } // namespace dart |
OLD | NEW |