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/snapshot.h" | 5 #include "vm/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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 str_ ^= ReadObjectImpl(kAsInlinedObject); | 255 str_ ^= ReadObjectImpl(kAsInlinedObject); |
256 cls = library_.LookupClass(str_); | 256 cls = library_.LookupClass(str_); |
257 if (cls.IsNull()) { | 257 if (cls.IsNull()) { |
258 SetReadException("Invalid object found in message."); | 258 SetReadException("Invalid object found in message."); |
259 } | 259 } |
260 cls.EnsureIsFinalized(isolate()); | 260 cls.EnsureIsFinalized(isolate()); |
261 return cls.raw(); | 261 return cls.raw(); |
262 } | 262 } |
263 | 263 |
264 | 264 |
265 RawFunction* SnapshotReader::ReadFunctionId(intptr_t object_id) { | |
266 ASSERT(kind_ == Snapshot::kScript); | |
267 // Read the function header information and lookup the function. | |
268 intptr_t func_header = Read<int32_t>(); | |
269 ASSERT((func_header & kSmiTagMask) != kSmiTag); | |
270 ASSERT(!IsVMIsolateObject(func_header) || | |
271 !IsSingletonClassId(GetVMIsolateObjectId(func_header))); | |
272 ASSERT((SerializedHeaderTag::decode(func_header) != kObjectId) || | |
273 !IsObjectStoreClassId(SerializedHeaderData::decode(func_header))); | |
274 Function& func = Function::ZoneHandle(zone(), Function::null()); | |
275 AddBackRef(object_id, &func, kIsDeserialized); | |
276 // Read the library/class/function information and lookup the function. | |
277 str_ ^= ReadObjectImpl(func_header, kAsInlinedObject, kInvalidPatchIndex, 0); | |
278 library_ = Library::LookupLibrary(str_); | |
279 if (library_.IsNull() || !library_.Loaded()) { | |
280 SetReadException("Expected a library name, but found an invalid name."); | |
281 } | |
282 str_ ^= ReadObjectImpl(kAsInlinedObject); | |
283 if (str_.Equals(Symbols::TopLevel(), 0, Symbols::TopLevel().Length())) { | |
284 str_ ^= ReadObjectImpl(kAsInlinedObject); | |
285 func ^= library_.LookupLocalFunction(str_); | |
286 } else { | |
287 cls_ = library_.LookupClass(str_); | |
288 if (cls_.IsNull()) { | |
289 SetReadException("Expected a class name, but found an invalid name."); | |
290 } | |
291 cls_.EnsureIsFinalized(isolate()); | |
292 str_ ^= ReadObjectImpl(kAsInlinedObject); | |
293 func ^= cls_.LookupFunctionAllowPrivate(str_); | |
294 } | |
295 if (func.IsNull()) { | |
296 SetReadException("Expected a function name, but found an invalid name."); | |
297 } | |
298 return func.raw(); | |
299 } | |
300 | |
301 | |
265 RawObject* SnapshotReader::ReadStaticImplicitClosure(intptr_t object_id, | 302 RawObject* SnapshotReader::ReadStaticImplicitClosure(intptr_t object_id, |
266 intptr_t class_header) { | 303 intptr_t class_header) { |
267 ASSERT(kind_ != Snapshot::kFull); | 304 ASSERT(kind_ != Snapshot::kFull); |
268 | 305 |
269 // First create a function object and associate it with the specified | 306 // First create a function object and associate it with the specified |
270 // 'object_id'. | 307 // 'object_id'. |
271 Function& func = Function::Handle(isolate(), Function::null()); | 308 Function& func = Function::Handle(isolate(), Function::null()); |
272 Instance& obj = Instance::ZoneHandle(zone(), Instance::null()); | 309 Instance& obj = Instance::ZoneHandle(zone(), Instance::null()); |
273 AddBackRef(object_id, &obj, kIsDeserialized); | 310 AddBackRef(object_id, &obj, kIsDeserialized); |
274 | 311 |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1302 uword tags = 0; | 1339 uword tags = 0; |
1303 ASSERT(class_id != kIllegalCid); | 1340 ASSERT(class_id != kIllegalCid); |
1304 tags = RawObject::ClassIdTag::update(class_id, tags); | 1341 tags = RawObject::ClassIdTag::update(class_id, tags); |
1305 tags = RawObject::SizeTag::update(size, tags); | 1342 tags = RawObject::SizeTag::update(size, tags); |
1306 tags = RawObject::VMHeapObjectTag::update(is_vm_isolate(), tags); | 1343 tags = RawObject::VMHeapObjectTag::update(is_vm_isolate(), tags); |
1307 raw_obj->ptr()->tags_ = tags; | 1344 raw_obj->ptr()->tags_ = tags; |
1308 return raw_obj; | 1345 return raw_obj; |
1309 } | 1346 } |
1310 | 1347 |
1311 | 1348 |
1349 #define READ_VM_SINGLETON_OBJ(id, obj) \ | |
1350 if (object_id == id) { \ | |
1351 return obj; \ | |
1352 } \ | |
1353 | |
1312 RawObject* SnapshotReader::ReadVMIsolateObject(intptr_t header_value) { | 1354 RawObject* SnapshotReader::ReadVMIsolateObject(intptr_t header_value) { |
1313 intptr_t object_id = GetVMIsolateObjectId(header_value); | 1355 intptr_t object_id = GetVMIsolateObjectId(header_value); |
1314 if (object_id == kNullObject) { | 1356 |
1315 // This is a singleton null object, return it. | 1357 // First check if it is one of the singleton objects. |
1316 return Object::null(); | 1358 READ_VM_SINGLETON_OBJ(kNullObject, Object::null()); |
1317 } | 1359 READ_VM_SINGLETON_OBJ(kSentinelObject, Object::sentinel().raw()); |
1318 if (object_id == kSentinelObject) { | 1360 READ_VM_SINGLETON_OBJ(kTransitionSentinelObject, |
1319 return Object::sentinel().raw(); | 1361 Object::transition_sentinel().raw()); |
1320 } | 1362 READ_VM_SINGLETON_OBJ(kEmptyArrayObject, Object::empty_array().raw()); |
1321 if (object_id == kTransitionSentinelObject) { | 1363 READ_VM_SINGLETON_OBJ(kZeroArrayObject, Object::zero_array().raw()); |
1322 return Object::transition_sentinel().raw(); | 1364 READ_VM_SINGLETON_OBJ(kDynamicType, Object::dynamic_type()); |
1323 } | 1365 READ_VM_SINGLETON_OBJ(kVoidType, Object::void_type()); |
1324 if (object_id == kEmptyArrayObject) { | 1366 READ_VM_SINGLETON_OBJ(kTrueValue, Bool::True().raw()); |
1325 return Object::empty_array().raw(); | 1367 READ_VM_SINGLETON_OBJ(kFalseValue, Bool::False().raw()); |
1326 } | 1368 READ_VM_SINGLETON_OBJ(kExtractorParameterTypes, |
1327 if (object_id == kZeroArrayObject) { | 1369 Object::extractor_parameter_types().raw()); |
1328 return Object::zero_array().raw(); | 1370 READ_VM_SINGLETON_OBJ(kExtractorParameterNames, |
1329 } | 1371 Object::extractor_parameter_names().raw()); |
1330 if (object_id == kDynamicType) { | 1372 READ_VM_SINGLETON_OBJ(kEmptyContextScopeObject, |
1331 return Object::dynamic_type(); | 1373 Object::empty_context_scope().raw()); |
1332 } | 1374 READ_VM_SINGLETON_OBJ(kEmptyObjectPool, Object::empty_object_pool().raw()); |
1333 if (object_id == kVoidType) { | 1375 READ_VM_SINGLETON_OBJ(kEmptyDescriptors, Object::empty_descriptors().raw()); |
1334 return Object::void_type(); | 1376 READ_VM_SINGLETON_OBJ(kEmptyVarDescriptors, |
1335 } | 1377 Object::empty_var_descriptors().raw()); |
1336 if (object_id == kTrueValue) { | 1378 READ_VM_SINGLETON_OBJ(kEmptyExceptionHandlers, |
1337 return Bool::True().raw(); | 1379 Object::empty_exception_handlers().raw()); |
1338 } | 1380 |
1339 if (object_id == kFalseValue) { | 1381 // Check it it is a double. |
rmacnak
2015/09/15 23:17:29
if it
siva
2015/10/13 21:39:26
Done.
| |
1340 return Bool::False().raw(); | |
1341 } | |
1342 if (object_id == kExtractorParameterTypes) { | |
1343 return Object::extractor_parameter_types().raw(); | |
1344 } | |
1345 if (object_id == kExtractorParameterNames) { | |
1346 return Object::extractor_parameter_names().raw(); | |
1347 } | |
1348 if (object_id == kEmptyContextScopeObject) { | |
1349 return Object::empty_context_scope().raw(); | |
1350 } | |
1351 if (object_id == kDoubleObject) { | 1382 if (object_id == kDoubleObject) { |
1352 ASSERT(kind_ == Snapshot::kMessage); | 1383 ASSERT(kind_ == Snapshot::kMessage); |
1353 return Double::New(ReadDouble()); | 1384 return Double::New(ReadDouble()); |
1354 } | 1385 } |
1386 | |
1387 // Check it is a singleton class object. | |
1355 intptr_t class_id = ClassIdFromObjectId(object_id); | 1388 intptr_t class_id = ClassIdFromObjectId(object_id); |
1356 if (IsSingletonClassId(class_id)) { | 1389 if (IsSingletonClassId(class_id)) { |
1357 return isolate()->class_table()->At(class_id); // get singleton class. | 1390 return isolate()->class_table()->At(class_id); // get singleton class. |
1358 } else { | |
1359 ASSERT(Symbols::IsVMSymbolId(object_id)); | |
1360 return Symbols::GetVMSymbol(object_id); // return VM symbol. | |
1361 } | 1391 } |
1362 UNREACHABLE(); | 1392 |
1363 return Object::null(); | 1393 // Check if it is a singleton Argument descriptor object. |
1394 for (intptr_t i = 0; i < ArgumentsDescriptor::kCachedDescriptorCount; i++) { | |
1395 if (object_id == (kCachedArgumentsDescriptor0 + i)) { | |
1396 return ArgumentsDescriptor::cached_args_descriptors_[i]; | |
1397 } | |
1398 } | |
1399 | |
1400 ASSERT(Symbols::IsVMSymbolId(object_id)); | |
1401 return Symbols::GetVMSymbol(object_id); // return VM symbol. | |
1364 } | 1402 } |
1365 | 1403 |
1366 | 1404 |
1367 RawObject* SnapshotReader::ReadIndexedObject(intptr_t object_id, | 1405 RawObject* SnapshotReader::ReadIndexedObject(intptr_t object_id, |
1368 intptr_t patch_object_id, | 1406 intptr_t patch_object_id, |
1369 intptr_t patch_offset) { | 1407 intptr_t patch_offset) { |
1370 intptr_t class_id = ClassIdFromObjectId(object_id); | 1408 intptr_t class_id = ClassIdFromObjectId(object_id); |
1371 if (IsObjectStoreClassId(class_id)) { | 1409 if (IsObjectStoreClassId(class_id)) { |
1372 return isolate()->class_table()->At(class_id); // get singleton class. | 1410 return isolate()->class_table()->At(class_id); // get singleton class. |
1373 } | 1411 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1520 // Read in the symbol table. | 1558 // Read in the symbol table. |
1521 object_store->symbol_table_ = reinterpret_cast<RawArray*>(ReadObject()); | 1559 object_store->symbol_table_ = reinterpret_cast<RawArray*>(ReadObject()); |
1522 | 1560 |
1523 Symbols::InitOnceFromSnapshot(isolate); | 1561 Symbols::InitOnceFromSnapshot(isolate); |
1524 | 1562 |
1525 // Read in all the script objects and the accompanying token streams | 1563 // Read in all the script objects and the accompanying token streams |
1526 // for bootstrap libraries so that they are in the VM isolate's read | 1564 // for bootstrap libraries so that they are in the VM isolate's read |
1527 // only memory. | 1565 // only memory. |
1528 *(ArrayHandle()) ^= ReadObject(); | 1566 *(ArrayHandle()) ^= ReadObject(); |
1529 | 1567 |
1530 | |
1531 if (snapshot_code()) { | 1568 if (snapshot_code()) { |
1532 for (intptr_t i = 0; | |
1533 i < ArgumentsDescriptor::kCachedDescriptorCount; | |
1534 i++) { | |
1535 *(ArrayHandle()) ^= ReadObject(); | |
1536 // TODO(rmacnak): | |
1537 // ArgumentsDescriptor::InitOnceFromSnapshot(i, *(ArrayHandle())); | |
1538 } | |
1539 | |
1540 ObjectPool::CheckedHandle(ReadObject()); // empty pool | |
1541 PcDescriptors::CheckedHandle(ReadObject()); // empty pc desc | |
1542 LocalVarDescriptors::CheckedHandle(ReadObject()); // empty var desc | |
1543 ExceptionHandlers::CheckedHandle(ReadObject()); // empty exc handlers | |
1544 | |
1545 #define READ_STUB(name) \ | 1569 #define READ_STUB(name) \ |
1546 *(CodeHandle()) ^= ReadObject(); | 1570 *(CodeHandle()) ^= ReadObject(); |
1547 // TODO(rmacnak): | 1571 // TODO(rmacnak): |
1548 // StubCode::name##_entry()->InitOnceFromSnapshot(CodeHandle()) | 1572 // StubCode::name##_entry()->InitOnceFromSnapshot(CodeHandle()) |
1549 VM_STUB_CODE_LIST(READ_STUB); | 1573 VM_STUB_CODE_LIST(READ_STUB); |
1550 #undef READ_STUB | 1574 #undef READ_STUB |
1551 } | 1575 } |
1552 | 1576 |
1553 // Validate the class table. | 1577 // Validate the class table. |
1554 #if defined(DEBUG) | 1578 #if defined(DEBUG) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1652 V(ImmutableArray) \ | 1676 V(ImmutableArray) \ |
1653 | 1677 |
1654 #define VM_OBJECT_WRITE(clazz) \ | 1678 #define VM_OBJECT_WRITE(clazz) \ |
1655 case clazz::kClassId: { \ | 1679 case clazz::kClassId: { \ |
1656 object_id = forward_list_->AddObject(rawobj, kIsSerialized); \ | 1680 object_id = forward_list_->AddObject(rawobj, kIsSerialized); \ |
1657 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(rawobj); \ | 1681 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(rawobj); \ |
1658 raw_obj->WriteTo(this, object_id, kind()); \ | 1682 raw_obj->WriteTo(this, object_id, kind()); \ |
1659 return true; \ | 1683 return true; \ |
1660 } \ | 1684 } \ |
1661 | 1685 |
1686 #define WRITE_VM_SINGLETON_OBJ(obj, id) \ | |
1687 if (rawobj == obj) { \ | |
1688 WriteVMIsolateObject(id); \ | |
1689 return true; \ | |
1690 } \ | |
1691 | |
1662 bool SnapshotWriter::HandleVMIsolateObject(RawObject* rawobj) { | 1692 bool SnapshotWriter::HandleVMIsolateObject(RawObject* rawobj) { |
1663 // Check if it is a singleton null object. | 1693 // Check if it is one of the singleton VM objects. |
1664 if (rawobj == Object::null()) { | 1694 WRITE_VM_SINGLETON_OBJ(Object::null(), kNullObject); |
1665 WriteVMIsolateObject(kNullObject); | 1695 WRITE_VM_SINGLETON_OBJ(Object::sentinel().raw(), kSentinelObject); |
1666 return true; | 1696 WRITE_VM_SINGLETON_OBJ(Object::transition_sentinel().raw(), |
1667 } | 1697 kTransitionSentinelObject); |
1668 | 1698 WRITE_VM_SINGLETON_OBJ(Object::empty_array().raw(), kEmptyArrayObject); |
1669 // Check if it is a singleton sentinel object. | 1699 WRITE_VM_SINGLETON_OBJ(Object::zero_array().raw(), kZeroArrayObject); |
1670 if (rawobj == Object::sentinel().raw()) { | 1700 WRITE_VM_SINGLETON_OBJ(Object::dynamic_type(), kDynamicType); |
1671 WriteVMIsolateObject(kSentinelObject); | 1701 WRITE_VM_SINGLETON_OBJ(Object::void_type(), kVoidType); |
1672 return true; | 1702 WRITE_VM_SINGLETON_OBJ(Bool::True().raw(), kTrueValue); |
1673 } | 1703 WRITE_VM_SINGLETON_OBJ(Bool::False().raw(), kFalseValue); |
1674 | 1704 WRITE_VM_SINGLETON_OBJ(Object::extractor_parameter_types().raw(), |
1675 // Check if it is a singleton sentinel object. | 1705 kExtractorParameterTypes); |
1676 if (rawobj == Object::transition_sentinel().raw()) { | 1706 WRITE_VM_SINGLETON_OBJ(Object::extractor_parameter_names().raw(), |
1677 WriteVMIsolateObject(kTransitionSentinelObject); | 1707 kExtractorParameterNames); |
1678 return true; | 1708 WRITE_VM_SINGLETON_OBJ(Object::empty_context_scope().raw(), |
1679 } | 1709 kEmptyContextScopeObject); |
1680 | 1710 WRITE_VM_SINGLETON_OBJ(Object::empty_object_pool().raw(), kEmptyObjectPool); |
1681 // Check if it is a singleton empty array object. | 1711 WRITE_VM_SINGLETON_OBJ(Object::empty_descriptors().raw(), kEmptyDescriptors); |
1682 if (rawobj == Object::empty_array().raw()) { | 1712 WRITE_VM_SINGLETON_OBJ(Object::empty_var_descriptors().raw(), |
1683 WriteVMIsolateObject(kEmptyArrayObject); | 1713 kEmptyVarDescriptors); |
1684 return true; | 1714 WRITE_VM_SINGLETON_OBJ(Object::empty_exception_handlers().raw(), |
1685 } | 1715 kEmptyExceptionHandlers); |
1686 | |
1687 // Check if it is a singleton zero array object. | |
1688 if (rawobj == Object::zero_array().raw()) { | |
1689 WriteVMIsolateObject(kZeroArrayObject); | |
1690 return true; | |
1691 } | |
1692 | |
1693 // Check if it is a singleton dyanmic Type object. | |
1694 if (rawobj == Object::dynamic_type()) { | |
1695 WriteVMIsolateObject(kDynamicType); | |
1696 return true; | |
1697 } | |
1698 | |
1699 // Check if it is a singleton void Type object. | |
1700 if (rawobj == Object::void_type()) { | |
1701 WriteVMIsolateObject(kVoidType); | |
1702 return true; | |
1703 } | |
1704 | |
1705 // Check if it is a singleton boolean true object. | |
1706 if (rawobj == Bool::True().raw()) { | |
1707 WriteVMIsolateObject(kTrueValue); | |
1708 return true; | |
1709 } | |
1710 | |
1711 // Check if it is a singleton boolean false object. | |
1712 if (rawobj == Bool::False().raw()) { | |
1713 WriteVMIsolateObject(kFalseValue); | |
1714 return true; | |
1715 } | |
1716 | |
1717 // Check if it is a singleton extractor parameter types array. | |
1718 if (rawobj == Object::extractor_parameter_types().raw()) { | |
1719 WriteVMIsolateObject(kExtractorParameterTypes); | |
1720 return true; | |
1721 } | |
1722 | |
1723 // Check if it is a singleton extractor parameter names array. | |
1724 if (rawobj == Object::extractor_parameter_names().raw()) { | |
1725 WriteVMIsolateObject(kExtractorParameterNames); | |
1726 return true; | |
1727 } | |
1728 | |
1729 // Check if it is a singleton empty context scope object. | |
1730 if (rawobj == Object::empty_context_scope().raw()) { | |
1731 WriteVMIsolateObject(kEmptyContextScopeObject); | |
1732 return true; | |
1733 } | |
1734 | 1716 |
1735 // Check if it is a singleton class object which is shared by | 1717 // Check if it is a singleton class object which is shared by |
1736 // all isolates. | 1718 // all isolates. |
1737 intptr_t id = rawobj->GetClassId(); | 1719 intptr_t id = rawobj->GetClassId(); |
1738 if (id == kClassCid) { | 1720 if (id == kClassCid) { |
1739 RawClass* raw_class = reinterpret_cast<RawClass*>(rawobj); | 1721 RawClass* raw_class = reinterpret_cast<RawClass*>(rawobj); |
1740 intptr_t class_id = raw_class->ptr()->id_; | 1722 intptr_t class_id = raw_class->ptr()->id_; |
1741 if (IsSingletonClassId(class_id)) { | 1723 if (IsSingletonClassId(class_id)) { |
1742 intptr_t object_id = ObjectIdFromClassId(class_id); | 1724 intptr_t object_id = ObjectIdFromClassId(class_id); |
1743 WriteVMIsolateObject(object_id); | 1725 WriteVMIsolateObject(object_id); |
1744 return true; | 1726 return true; |
1745 } | 1727 } |
1746 } | 1728 } |
1747 | 1729 |
1730 // Check if it is a singleton Argument descriptor object. | |
1731 for (intptr_t i = 0; i < ArgumentsDescriptor::kCachedDescriptorCount; i++) { | |
1732 if (rawobj == ArgumentsDescriptor::cached_args_descriptors_[i]) { | |
1733 WriteVMIsolateObject(kCachedArgumentsDescriptor0 + i); | |
1734 return true; | |
1735 } | |
1736 } | |
1737 | |
1748 if (kind() == Snapshot::kFull) { | 1738 if (kind() == Snapshot::kFull) { |
1749 // Check it is a predefined symbol in the VM isolate. | 1739 // Check it is a predefined symbol in the VM isolate. |
1750 id = Symbols::LookupVMSymbol(rawobj); | 1740 id = Symbols::LookupVMSymbol(rawobj); |
1751 if (id != kInvalidIndex) { | 1741 if (id != kInvalidIndex) { |
1752 WriteVMIsolateObject(id); | 1742 WriteVMIsolateObject(id); |
1753 return true; | 1743 return true; |
1754 } | 1744 } |
1755 | 1745 |
1756 // Check if it is an object from the vm isolate snapshot object table. | 1746 // Check if it is an object from the vm isolate snapshot object table. |
1757 id = FindVmSnapshotObject(rawobj); | 1747 id = FindVmSnapshotObject(rawobj); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1932 // Write out the symbol table. | 1922 // Write out the symbol table. |
1933 writer.WriteObject(symbol_table_.raw()); | 1923 writer.WriteObject(symbol_table_.raw()); |
1934 | 1924 |
1935 // Write out all the script objects and the accompanying token streams | 1925 // Write out all the script objects and the accompanying token streams |
1936 // for the bootstrap libraries so that they are in the VM isolate | 1926 // for the bootstrap libraries so that they are in the VM isolate |
1937 // read only memory. | 1927 // read only memory. |
1938 writer.WriteObject(scripts_.raw()); | 1928 writer.WriteObject(scripts_.raw()); |
1939 | 1929 |
1940 if (snapshot_code_) { | 1930 if (snapshot_code_) { |
1941 ASSERT(!vm_isolate_is_symbolic_); | 1931 ASSERT(!vm_isolate_is_symbolic_); |
1942 | |
1943 for (intptr_t i = 0; | |
1944 i < ArgumentsDescriptor::kCachedDescriptorCount; | |
1945 i++) { | |
1946 writer.WriteObject(ArgumentsDescriptor::cached_args_descriptors_[i]); | |
1947 } | |
1948 | |
1949 writer.WriteObject(Object::empty_object_pool().raw()); | |
1950 writer.WriteObject(Object::empty_descriptors().raw()); | |
1951 writer.WriteObject(Object::empty_var_descriptors().raw()); | |
1952 writer.WriteObject(Object::empty_exception_handlers().raw()); | |
1953 | |
1954 #define WRITE_STUB(name) \ | 1932 #define WRITE_STUB(name) \ |
1955 writer.WriteObject(StubCode::name##_entry()->code()); | 1933 writer.WriteObject(StubCode::name##_entry()->code()); |
1956 VM_STUB_CODE_LIST(WRITE_STUB); | 1934 VM_STUB_CODE_LIST(WRITE_STUB); |
1957 #undef WRITE_STUB | 1935 #undef WRITE_STUB |
1958 } | 1936 } |
1959 | 1937 |
1960 | 1938 |
1961 writer.FillHeader(writer.kind()); | 1939 writer.FillHeader(writer.kind()); |
1962 | 1940 |
1963 vm_isolate_snapshot_size_ = writer.BytesWritten(); | 1941 vm_isolate_snapshot_size_ = writer.BytesWritten(); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2438 ASSERT(!IsSingletonClassId(class_id) && !IsObjectStoreClassId(class_id)); | 2416 ASSERT(!IsSingletonClassId(class_id) && !IsObjectStoreClassId(class_id)); |
2439 | 2417 |
2440 // Write out the library url and class name. | 2418 // Write out the library url and class name. |
2441 RawLibrary* library = cls->ptr()->library_; | 2419 RawLibrary* library = cls->ptr()->library_; |
2442 ASSERT(library != Library::null()); | 2420 ASSERT(library != Library::null()); |
2443 WriteObjectImpl(library->ptr()->url_, kAsInlinedObject); | 2421 WriteObjectImpl(library->ptr()->url_, kAsInlinedObject); |
2444 WriteObjectImpl(cls->ptr()->name_, kAsInlinedObject); | 2422 WriteObjectImpl(cls->ptr()->name_, kAsInlinedObject); |
2445 } | 2423 } |
2446 | 2424 |
2447 | 2425 |
2426 void SnapshotWriter::WriteFunctionId(RawFunction* func, bool owner_is_class) { | |
2427 ASSERT(kind_ == Snapshot::kScript); | |
2428 RawClass* cls = (owner_is_class) ? | |
2429 reinterpret_cast<RawClass*>(func->ptr()->owner_) : | |
2430 reinterpret_cast<RawPatchClass*>( | |
2431 func->ptr()->owner_)->ptr()->patched_class_; | |
2432 // int class_id = cls->ptr()->id_; | |
2433 // ASSERT(!IsSingletonClassId(class_id) && !IsObjectStoreClassId(class_id)); | |
rmacnak
2015/09/15 23:17:29
Remove.
siva
2015/10/13 21:39:26
Done.
| |
2434 | |
2435 // Write out the library url and class name. | |
2436 RawLibrary* library = cls->ptr()->library_; | |
2437 ASSERT(library != Library::null()); | |
2438 WriteObjectImpl(library->ptr()->url_, kAsInlinedObject); | |
2439 WriteObjectImpl(cls->ptr()->name_, kAsInlinedObject); | |
2440 WriteObjectImpl(func->ptr()->name_, kAsInlinedObject); | |
2441 } | |
2442 | |
2443 | |
2448 void SnapshotWriter::WriteStaticImplicitClosure(intptr_t object_id, | 2444 void SnapshotWriter::WriteStaticImplicitClosure(intptr_t object_id, |
2449 RawFunction* func, | 2445 RawFunction* func, |
2450 intptr_t tags) { | 2446 intptr_t tags) { |
2451 // Write out the serialization header value for this object. | 2447 // Write out the serialization header value for this object. |
2452 WriteInlinedObjectHeader(object_id); | 2448 WriteInlinedObjectHeader(object_id); |
2453 | 2449 |
2454 // Indicate this is a static implicit closure object. | 2450 // Indicate this is a static implicit closure object. |
2455 Write<int32_t>(SerializedHeaderData::encode(kStaticImplicitClosureObjectId)); | 2451 Write<int32_t>(SerializedHeaderData::encode(kStaticImplicitClosureObjectId)); |
2456 | 2452 |
2457 // Write out the tags. | 2453 // Write out the tags. |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2788 NoSafepointScope no_safepoint; | 2784 NoSafepointScope no_safepoint; |
2789 WriteObject(obj.raw()); | 2785 WriteObject(obj.raw()); |
2790 UnmarkAll(); | 2786 UnmarkAll(); |
2791 } else { | 2787 } else { |
2792 ThrowException(exception_type(), exception_msg()); | 2788 ThrowException(exception_type(), exception_msg()); |
2793 } | 2789 } |
2794 } | 2790 } |
2795 | 2791 |
2796 | 2792 |
2797 } // namespace dart | 2793 } // namespace dart |
OLD | NEW |