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

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

Issue 1337083004: - Turn on writing of ic_data_array so that we have that information for script snapshots that would… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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/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
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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 uword tags = 0; 1337 uword tags = 0;
1301 ASSERT(class_id != kIllegalCid); 1338 ASSERT(class_id != kIllegalCid);
1302 tags = RawObject::ClassIdTag::update(class_id, tags); 1339 tags = RawObject::ClassIdTag::update(class_id, tags);
1303 tags = RawObject::SizeTag::update(size, tags); 1340 tags = RawObject::SizeTag::update(size, tags);
1304 tags = RawObject::VMHeapObjectTag::update(is_vm_isolate(), tags); 1341 tags = RawObject::VMHeapObjectTag::update(is_vm_isolate(), tags);
1305 raw_obj->ptr()->tags_ = tags; 1342 raw_obj->ptr()->tags_ = tags;
1306 return raw_obj; 1343 return raw_obj;
1307 } 1344 }
1308 1345
1309 1346
1347 #define READ_VM_SINGLETON_OBJ(id, obj) \
1348 if (object_id == id) { \
1349 return obj; \
1350 } \
1351
1310 RawObject* SnapshotReader::ReadVMIsolateObject(intptr_t header_value) { 1352 RawObject* SnapshotReader::ReadVMIsolateObject(intptr_t header_value) {
1311 intptr_t object_id = GetVMIsolateObjectId(header_value); 1353 intptr_t object_id = GetVMIsolateObjectId(header_value);
1312 if (object_id == kNullObject) { 1354
1313 // This is a singleton null object, return it. 1355 // First check if it is one of the singleton objects.
1314 return Object::null(); 1356 READ_VM_SINGLETON_OBJ(kNullObject, Object::null());
1315 } 1357 READ_VM_SINGLETON_OBJ(kSentinelObject, Object::sentinel().raw());
1316 if (object_id == kSentinelObject) { 1358 READ_VM_SINGLETON_OBJ(kTransitionSentinelObject,
1317 return Object::sentinel().raw(); 1359 Object::transition_sentinel().raw());
1318 } 1360 READ_VM_SINGLETON_OBJ(kEmptyArrayObject, Object::empty_array().raw());
1319 if (object_id == kTransitionSentinelObject) { 1361 READ_VM_SINGLETON_OBJ(kZeroArrayObject, Object::zero_array().raw());
1320 return Object::transition_sentinel().raw(); 1362 READ_VM_SINGLETON_OBJ(kDynamicType, Object::dynamic_type());
1321 } 1363 READ_VM_SINGLETON_OBJ(kVoidType, Object::void_type());
1322 if (object_id == kEmptyArrayObject) { 1364 READ_VM_SINGLETON_OBJ(kTrueValue, Bool::True().raw());
1323 return Object::empty_array().raw(); 1365 READ_VM_SINGLETON_OBJ(kFalseValue, Bool::False().raw());
1324 } 1366 READ_VM_SINGLETON_OBJ(kExtractorParameterTypes,
1325 if (object_id == kZeroArrayObject) { 1367 Object::extractor_parameter_types().raw());
1326 return Object::zero_array().raw(); 1368 READ_VM_SINGLETON_OBJ(kExtractorParameterNames,
1327 } 1369 Object::extractor_parameter_names().raw());
1328 if (object_id == kDynamicType) { 1370 READ_VM_SINGLETON_OBJ(kEmptyContextScopeObject,
1329 return Object::dynamic_type(); 1371 Object::empty_context_scope().raw());
1330 } 1372 READ_VM_SINGLETON_OBJ(kEmptyObjectPool, Object::empty_object_pool().raw());
1331 if (object_id == kVoidType) { 1373 READ_VM_SINGLETON_OBJ(kEmptyDescriptors, Object::empty_descriptors().raw());
1332 return Object::void_type(); 1374 READ_VM_SINGLETON_OBJ(kEmptyVarDescriptors,
1333 } 1375 Object::empty_var_descriptors().raw());
1334 if (object_id == kTrueValue) { 1376 READ_VM_SINGLETON_OBJ(kEmptyExceptionHandlers,
1335 return Bool::True().raw(); 1377 Object::empty_exception_handlers().raw());
1336 } 1378
1337 if (object_id == kFalseValue) { 1379 // Check it it is a double.
1338 return Bool::False().raw();
1339 }
1340 if (object_id == kExtractorParameterTypes) {
1341 return Object::extractor_parameter_types().raw();
1342 }
1343 if (object_id == kExtractorParameterNames) {
1344 return Object::extractor_parameter_names().raw();
1345 }
1346 if (object_id == kEmptyContextScopeObject) {
1347 return Object::empty_context_scope().raw();
1348 }
1349 if (object_id == kDoubleObject) { 1380 if (object_id == kDoubleObject) {
1350 ASSERT(kind_ == Snapshot::kMessage); 1381 ASSERT(kind_ == Snapshot::kMessage);
1351 return Double::New(ReadDouble()); 1382 return Double::New(ReadDouble());
1352 } 1383 }
1384
1385 // Check it is a singleton class object.
1353 intptr_t class_id = ClassIdFromObjectId(object_id); 1386 intptr_t class_id = ClassIdFromObjectId(object_id);
1354 if (IsSingletonClassId(class_id)) { 1387 if (IsSingletonClassId(class_id)) {
1355 return isolate()->class_table()->At(class_id); // get singleton class. 1388 return isolate()->class_table()->At(class_id); // get singleton class.
1356 } else {
1357 ASSERT(Symbols::IsVMSymbolId(object_id));
1358 return Symbols::GetVMSymbol(object_id); // return VM symbol.
1359 } 1389 }
1360 UNREACHABLE(); 1390
1361 return Object::null(); 1391 // Check if it is a singleton Argument descriptor object.
1392 for (intptr_t i = 0; i < ArgumentsDescriptor::kCachedDescriptorCount; i++) {
1393 if (object_id == (kCachedArgumentsDescriptor0 + i)) {
1394 return ArgumentsDescriptor::cached_args_descriptors_[i];
1395 }
1396 }
1397
1398 ASSERT(Symbols::IsVMSymbolId(object_id));
1399 return Symbols::GetVMSymbol(object_id); // return VM symbol.
1362 } 1400 }
1363 1401
1364 1402
1365 RawObject* SnapshotReader::ReadIndexedObject(intptr_t object_id, 1403 RawObject* SnapshotReader::ReadIndexedObject(intptr_t object_id,
1366 intptr_t patch_object_id, 1404 intptr_t patch_object_id,
1367 intptr_t patch_offset) { 1405 intptr_t patch_offset) {
1368 intptr_t class_id = ClassIdFromObjectId(object_id); 1406 intptr_t class_id = ClassIdFromObjectId(object_id);
1369 if (IsObjectStoreClassId(class_id)) { 1407 if (IsObjectStoreClassId(class_id)) {
1370 return isolate()->class_table()->At(class_id); // get singleton class. 1408 return isolate()->class_table()->At(class_id); // get singleton class.
1371 } 1409 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 // Read in the symbol table. 1556 // Read in the symbol table.
1519 object_store->symbol_table_ = reinterpret_cast<RawArray*>(ReadObject()); 1557 object_store->symbol_table_ = reinterpret_cast<RawArray*>(ReadObject());
1520 1558
1521 Symbols::InitOnceFromSnapshot(isolate); 1559 Symbols::InitOnceFromSnapshot(isolate);
1522 1560
1523 // Read in all the script objects and the accompanying token streams 1561 // Read in all the script objects and the accompanying token streams
1524 // for bootstrap libraries so that they are in the VM isolate's read 1562 // for bootstrap libraries so that they are in the VM isolate's read
1525 // only memory. 1563 // only memory.
1526 *(ArrayHandle()) ^= ReadObject(); 1564 *(ArrayHandle()) ^= ReadObject();
1527 1565
1528
1529 if (snapshot_code()) { 1566 if (snapshot_code()) {
1530 for (intptr_t i = 0;
1531 i < ArgumentsDescriptor::kCachedDescriptorCount;
1532 i++) {
1533 *(ArrayHandle()) ^= ReadObject();
1534 // TODO(rmacnak):
1535 // ArgumentsDescriptor::InitOnceFromSnapshot(i, *(ArrayHandle()));
1536 }
1537
1538 ObjectPool::CheckedHandle(ReadObject()); // empty pool
1539 PcDescriptors::CheckedHandle(ReadObject()); // empty pc desc
1540 LocalVarDescriptors::CheckedHandle(ReadObject()); // empty var desc
1541 ExceptionHandlers::CheckedHandle(ReadObject()); // empty exc handlers
1542
1543 #define READ_STUB(name) \ 1567 #define READ_STUB(name) \
1544 *(CodeHandle()) ^= ReadObject(); 1568 *(CodeHandle()) ^= ReadObject();
1545 // TODO(rmacnak): 1569 // TODO(rmacnak):
1546 // StubCode::name##_entry()->InitOnceFromSnapshot(CodeHandle()) 1570 // StubCode::name##_entry()->InitOnceFromSnapshot(CodeHandle())
1547 VM_STUB_CODE_LIST(READ_STUB); 1571 VM_STUB_CODE_LIST(READ_STUB);
1548 #undef READ_STUB 1572 #undef READ_STUB
1549 } 1573 }
1550 1574
1551 // Validate the class table. 1575 // Validate the class table.
1552 #if defined(DEBUG) 1576 #if defined(DEBUG)
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 V(ImmutableArray) \ 1674 V(ImmutableArray) \
1651 1675
1652 #define VM_OBJECT_WRITE(clazz) \ 1676 #define VM_OBJECT_WRITE(clazz) \
1653 case clazz::kClassId: { \ 1677 case clazz::kClassId: { \
1654 object_id = forward_list_->AddObject(rawobj, kIsSerialized); \ 1678 object_id = forward_list_->AddObject(rawobj, kIsSerialized); \
1655 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(rawobj); \ 1679 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(rawobj); \
1656 raw_obj->WriteTo(this, object_id, kind()); \ 1680 raw_obj->WriteTo(this, object_id, kind()); \
1657 return true; \ 1681 return true; \
1658 } \ 1682 } \
1659 1683
1684 #define WRITE_VM_SINGLETON_OBJ(obj, id) \
1685 if (rawobj == obj) { \
1686 WriteVMIsolateObject(id); \
1687 return true; \
1688 } \
1689
1660 bool SnapshotWriter::HandleVMIsolateObject(RawObject* rawobj) { 1690 bool SnapshotWriter::HandleVMIsolateObject(RawObject* rawobj) {
1661 // Check if it is a singleton null object. 1691 // Check if it is one of the singleton VM objects.
1662 if (rawobj == Object::null()) { 1692 WRITE_VM_SINGLETON_OBJ(Object::null(), kNullObject);
1663 WriteVMIsolateObject(kNullObject); 1693 WRITE_VM_SINGLETON_OBJ(Object::sentinel().raw(), kSentinelObject);
1664 return true; 1694 WRITE_VM_SINGLETON_OBJ(Object::transition_sentinel().raw(),
1665 } 1695 kTransitionSentinelObject);
1666 1696 WRITE_VM_SINGLETON_OBJ(Object::empty_array().raw(), kEmptyArrayObject);
1667 // Check if it is a singleton sentinel object. 1697 WRITE_VM_SINGLETON_OBJ(Object::zero_array().raw(), kZeroArrayObject);
1668 if (rawobj == Object::sentinel().raw()) { 1698 WRITE_VM_SINGLETON_OBJ(Object::dynamic_type(), kDynamicType);
1669 WriteVMIsolateObject(kSentinelObject); 1699 WRITE_VM_SINGLETON_OBJ(Object::void_type(), kVoidType);
1670 return true; 1700 WRITE_VM_SINGLETON_OBJ(Bool::True().raw(), kTrueValue);
1671 } 1701 WRITE_VM_SINGLETON_OBJ(Bool::False().raw(), kFalseValue);
1672 1702 WRITE_VM_SINGLETON_OBJ(Object::extractor_parameter_types().raw(),
1673 // Check if it is a singleton sentinel object. 1703 kExtractorParameterTypes);
1674 if (rawobj == Object::transition_sentinel().raw()) { 1704 WRITE_VM_SINGLETON_OBJ(Object::extractor_parameter_names().raw(),
1675 WriteVMIsolateObject(kTransitionSentinelObject); 1705 kExtractorParameterNames);
1676 return true; 1706 WRITE_VM_SINGLETON_OBJ(Object::empty_context_scope().raw(),
1677 } 1707 kEmptyContextScopeObject);
1678 1708 WRITE_VM_SINGLETON_OBJ(Object::empty_object_pool().raw(), kEmptyObjectPool);
1679 // Check if it is a singleton empty array object. 1709 WRITE_VM_SINGLETON_OBJ(Object::empty_descriptors().raw(), kEmptyDescriptors);
1680 if (rawobj == Object::empty_array().raw()) { 1710 WRITE_VM_SINGLETON_OBJ(Object::empty_var_descriptors().raw(),
1681 WriteVMIsolateObject(kEmptyArrayObject); 1711 kEmptyVarDescriptors);
1682 return true; 1712 WRITE_VM_SINGLETON_OBJ(Object::empty_exception_handlers().raw(),
1683 } 1713 kEmptyExceptionHandlers);
1684
1685 // Check if it is a singleton zero array object.
1686 if (rawobj == Object::zero_array().raw()) {
1687 WriteVMIsolateObject(kZeroArrayObject);
1688 return true;
1689 }
1690
1691 // Check if it is a singleton dyanmic Type object.
1692 if (rawobj == Object::dynamic_type()) {
1693 WriteVMIsolateObject(kDynamicType);
1694 return true;
1695 }
1696
1697 // Check if it is a singleton void Type object.
1698 if (rawobj == Object::void_type()) {
1699 WriteVMIsolateObject(kVoidType);
1700 return true;
1701 }
1702
1703 // Check if it is a singleton boolean true object.
1704 if (rawobj == Bool::True().raw()) {
1705 WriteVMIsolateObject(kTrueValue);
1706 return true;
1707 }
1708
1709 // Check if it is a singleton boolean false object.
1710 if (rawobj == Bool::False().raw()) {
1711 WriteVMIsolateObject(kFalseValue);
1712 return true;
1713 }
1714
1715 // Check if it is a singleton extractor parameter types array.
1716 if (rawobj == Object::extractor_parameter_types().raw()) {
1717 WriteVMIsolateObject(kExtractorParameterTypes);
1718 return true;
1719 }
1720
1721 // Check if it is a singleton extractor parameter names array.
1722 if (rawobj == Object::extractor_parameter_names().raw()) {
1723 WriteVMIsolateObject(kExtractorParameterNames);
1724 return true;
1725 }
1726
1727 // Check if it is a singleton empty context scope object.
1728 if (rawobj == Object::empty_context_scope().raw()) {
1729 WriteVMIsolateObject(kEmptyContextScopeObject);
1730 return true;
1731 }
1732 1714
1733 // Check if it is a singleton class object which is shared by 1715 // Check if it is a singleton class object which is shared by
1734 // all isolates. 1716 // all isolates.
1735 intptr_t id = rawobj->GetClassId(); 1717 intptr_t id = rawobj->GetClassId();
1736 if (id == kClassCid) { 1718 if (id == kClassCid) {
1737 RawClass* raw_class = reinterpret_cast<RawClass*>(rawobj); 1719 RawClass* raw_class = reinterpret_cast<RawClass*>(rawobj);
1738 intptr_t class_id = raw_class->ptr()->id_; 1720 intptr_t class_id = raw_class->ptr()->id_;
1739 if (IsSingletonClassId(class_id)) { 1721 if (IsSingletonClassId(class_id)) {
1740 intptr_t object_id = ObjectIdFromClassId(class_id); 1722 intptr_t object_id = ObjectIdFromClassId(class_id);
1741 WriteVMIsolateObject(object_id); 1723 WriteVMIsolateObject(object_id);
1742 return true; 1724 return true;
1743 } 1725 }
1744 } 1726 }
1745 1727
1728 // Check if it is a singleton Argument descriptor object.
1729 for (intptr_t i = 0; i < ArgumentsDescriptor::kCachedDescriptorCount; i++) {
1730 if (rawobj == ArgumentsDescriptor::cached_args_descriptors_[i]) {
1731 WriteVMIsolateObject(kCachedArgumentsDescriptor0 + i);
1732 return true;
1733 }
1734 }
1735
1746 if (kind() == Snapshot::kFull) { 1736 if (kind() == Snapshot::kFull) {
1747 // Check it is a predefined symbol in the VM isolate. 1737 // Check it is a predefined symbol in the VM isolate.
1748 id = Symbols::LookupVMSymbol(rawobj); 1738 id = Symbols::LookupVMSymbol(rawobj);
1749 if (id != kInvalidIndex) { 1739 if (id != kInvalidIndex) {
1750 WriteVMIsolateObject(id); 1740 WriteVMIsolateObject(id);
1751 return true; 1741 return true;
1752 } 1742 }
1753 1743
1754 // Check if it is an object from the vm isolate snapshot object table. 1744 // Check if it is an object from the vm isolate snapshot object table.
1755 id = FindVmSnapshotObject(rawobj); 1745 id = FindVmSnapshotObject(rawobj);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1930 // Write out the symbol table. 1920 // Write out the symbol table.
1931 writer.WriteObject(symbol_table_.raw()); 1921 writer.WriteObject(symbol_table_.raw());
1932 1922
1933 // Write out all the script objects and the accompanying token streams 1923 // Write out all the script objects and the accompanying token streams
1934 // for the bootstrap libraries so that they are in the VM isolate 1924 // for the bootstrap libraries so that they are in the VM isolate
1935 // read only memory. 1925 // read only memory.
1936 writer.WriteObject(scripts_.raw()); 1926 writer.WriteObject(scripts_.raw());
1937 1927
1938 if (snapshot_code_) { 1928 if (snapshot_code_) {
1939 ASSERT(!vm_isolate_is_symbolic_); 1929 ASSERT(!vm_isolate_is_symbolic_);
1940
1941 for (intptr_t i = 0;
1942 i < ArgumentsDescriptor::kCachedDescriptorCount;
1943 i++) {
1944 writer.WriteObject(ArgumentsDescriptor::cached_args_descriptors_[i]);
1945 }
1946
1947 writer.WriteObject(Object::empty_object_pool().raw());
1948 writer.WriteObject(Object::empty_descriptors().raw());
1949 writer.WriteObject(Object::empty_var_descriptors().raw());
1950 writer.WriteObject(Object::empty_exception_handlers().raw());
1951
1952 #define WRITE_STUB(name) \ 1930 #define WRITE_STUB(name) \
1953 writer.WriteObject(StubCode::name##_entry()->code()); 1931 writer.WriteObject(StubCode::name##_entry()->code());
1954 VM_STUB_CODE_LIST(WRITE_STUB); 1932 VM_STUB_CODE_LIST(WRITE_STUB);
1955 #undef WRITE_STUB 1933 #undef WRITE_STUB
1956 } 1934 }
1957 1935
1958 1936
1959 writer.FillHeader(writer.kind()); 1937 writer.FillHeader(writer.kind());
1960 1938
1961 vm_isolate_snapshot_size_ = writer.BytesWritten(); 1939 vm_isolate_snapshot_size_ = writer.BytesWritten();
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 ASSERT(!IsSingletonClassId(class_id) && !IsObjectStoreClassId(class_id)); 2412 ASSERT(!IsSingletonClassId(class_id) && !IsObjectStoreClassId(class_id));
2435 2413
2436 // Write out the library url and class name. 2414 // Write out the library url and class name.
2437 RawLibrary* library = cls->ptr()->library_; 2415 RawLibrary* library = cls->ptr()->library_;
2438 ASSERT(library != Library::null()); 2416 ASSERT(library != Library::null());
2439 WriteObjectImpl(library->ptr()->url_, kAsInlinedObject); 2417 WriteObjectImpl(library->ptr()->url_, kAsInlinedObject);
2440 WriteObjectImpl(cls->ptr()->name_, kAsInlinedObject); 2418 WriteObjectImpl(cls->ptr()->name_, kAsInlinedObject);
2441 } 2419 }
2442 2420
2443 2421
2422 void SnapshotWriter::WriteFunctionId(RawFunction* func, bool owner_is_class) {
2423 ASSERT(kind_ == Snapshot::kScript);
2424 RawClass* cls = (owner_is_class) ?
2425 reinterpret_cast<RawClass*>(func->ptr()->owner_) :
2426 reinterpret_cast<RawPatchClass*>(
2427 func->ptr()->owner_)->ptr()->patched_class_;
2428 // int class_id = cls->ptr()->id_;
2429 // ASSERT(!IsSingletonClassId(class_id) && !IsObjectStoreClassId(class_id));
2430
2431 // Write out the library url and class name.
2432 RawLibrary* library = cls->ptr()->library_;
2433 ASSERT(library != Library::null());
2434 WriteObjectImpl(library->ptr()->url_, kAsInlinedObject);
2435 WriteObjectImpl(cls->ptr()->name_, kAsInlinedObject);
2436 WriteObjectImpl(func->ptr()->name_, kAsInlinedObject);
2437 }
2438
2439
2444 void SnapshotWriter::WriteStaticImplicitClosure(intptr_t object_id, 2440 void SnapshotWriter::WriteStaticImplicitClosure(intptr_t object_id,
2445 RawFunction* func, 2441 RawFunction* func,
2446 intptr_t tags) { 2442 intptr_t tags) {
2447 // Write out the serialization header value for this object. 2443 // Write out the serialization header value for this object.
2448 WriteInlinedObjectHeader(object_id); 2444 WriteInlinedObjectHeader(object_id);
2449 2445
2450 // Indicate this is a static implicit closure object. 2446 // Indicate this is a static implicit closure object.
2451 Write<int32_t>(SerializedHeaderData::encode(kStaticImplicitClosureObjectId)); 2447 Write<int32_t>(SerializedHeaderData::encode(kStaticImplicitClosureObjectId));
2452 2448
2453 // Write out the tags. 2449 // Write out the tags.
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698