@@ -1110,8 +1110,9 @@ enum ExtraCids {
11101110 kImagePageExtraCid = 2 ,
11111111 kRootSliceExtraCid = 3 ,
11121112 kIsolateExtraCid = 4 ,
1113+ kObjectStoreExtraCid = 5 ,
11131114
1114- kNumExtraCids = 4 ,
1115+ kNumExtraCids = 5 ,
11151116};
11161117
11171118class Pass2Visitor : public ObjectVisitor ,
@@ -1581,6 +1582,42 @@ void HeapSnapshotWriter::Write() {
15811582 WriteUtf8 (" " ); // Reserved
15821583 }
15831584 }
1585+ {
1586+ ASSERT (kObjectStoreExtraCid == 5 );
1587+ WriteUnsigned (0 ); // Flags
1588+ WriteUtf8 (" ObjectStore" ); // Name
1589+ WriteUtf8 (" " ); // Library name
1590+ WriteUtf8 (" " ); // Library uri
1591+ WriteUtf8 (" " ); // Reserved
1592+
1593+ enum {
1594+ #define V (type, name ) kObjectStore_ ##name,
1595+ OBJECT_STORE_FIELD_LIST (V, V, V, V, V, V, V, V, V)
1596+ #undef EMIT_FIELD_NAME
1597+ kNumObjectStoreFields
1598+ };
1599+ WriteUnsigned (kNumObjectStoreFields );
1600+
1601+ // A strtab is smaller than an array of strings.
1602+ static const char * const names = " "
1603+ #define EMIT_FIELD_NAME (type, name ) #name " _\0 "
1604+ OBJECT_STORE_FIELD_LIST (EMIT_FIELD_NAME, EMIT_FIELD_NAME,
1605+ EMIT_FIELD_NAME, EMIT_FIELD_NAME,
1606+ EMIT_FIELD_NAME, EMIT_FIELD_NAME,
1607+ EMIT_FIELD_NAME, EMIT_FIELD_NAME,
1608+ EMIT_FIELD_NAME)
1609+ #undef EMIT_FIELD_NAME
1610+ ; // NOLINT
1611+ const char * name = names;
1612+ for (intptr_t i = 0 ; i < kNumObjectStoreFields ; i++) {
1613+ intptr_t flags = 1 ; // Strong.
1614+ WriteUnsigned (flags);
1615+ WriteUnsigned (i); // Index.
1616+ WriteUtf8 (name);
1617+ WriteUtf8 (" " ); // Reserved
1618+ name += strlen (name) + 1 ;
1619+ }
1620+ }
15841621
15851622 for (intptr_t cid = 1 ; cid <= class_count_; cid++) {
15861623 if (!class_table->HasValidClassAt (cid)) {
@@ -1708,7 +1745,11 @@ void HeapSnapshotWriter::Write() {
17081745 DEBUG_ASSERT (visitor.count () == num_image_objects);
17091746 }
17101747 for (intptr_t i = 0 ; i < kNumRootSlices ; i++) {
1711- WriteUnsigned (kRootSliceExtraCid );
1748+ if (i == kObjectStore ) {
1749+ WriteUnsigned (kObjectStoreExtraCid );
1750+ } else {
1751+ WriteUnsigned (kRootSliceExtraCid );
1752+ }
17121753 WriteUnsigned (0 ); // shallowSize
17131754 WriteUnsigned (kNameData );
17141755 WriteUtf8 (RootSliceToCString (i));
0 commit comments