Bug 1249174 (part 1) - Don't store the unused XPTTypeDescriptorTags::argnum2 field in memory. r=khuey.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 17 Feb 2016 15:23:42 +1100
changeset 324228 639ee2cb781c339fe86fd1fed4122b809d2a1fc1
parent 324227 1b82b05fc9373c163d0e0786d267b695303f735f
child 324229 d8db031fc4a77c85088755f1919d9c4e11b82fed
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1249174
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1249174 (part 1) - Don't store the unused XPTTypeDescriptorTags::argnum2 field in memory. r=khuey. XPTTypeDescriptor::argnum2 is unused. Removing it reduces sizeof(XPTTypeDescriptor) from 6 bytes to 4 bytes, which reduces the "xpti-working-set" measurement by 80 KiB (measured on 64-bit).
xpcom/typelib/xpt/xpt_struct.cpp
xpcom/typelib/xpt/xpt_struct.h
--- a/xpcom/typelib/xpt/xpt_struct.cpp
+++ b/xpcom/typelib/xpt/xpt_struct.cpp
@@ -364,37 +364,42 @@ DoTypeDescriptor(XPTArena *arena, XPTCur
       case TD_INTERFACE_TYPE:
         if (!XPT_Do16(cursor, &td->type.iface))
             return PR_FALSE;
         break;
       case TD_INTERFACE_IS_TYPE:
         if (!XPT_Do8(cursor, &td->argnum))
             return PR_FALSE;
         break;
-      case TD_ARRAY:
+      case TD_ARRAY: {
+        // argnum2 appears in the on-disk format but it isn't used.
+        uint8_t argnum2 = 0;
         if (!XPT_Do8(cursor, &td->argnum) ||
-            !XPT_Do8(cursor, &td->argnum2))
+            !XPT_Do8(cursor, &argnum2))
             return PR_FALSE;
 
         if (!XPT_InterfaceDescriptorAddTypes(arena, id, 1))
             return PR_FALSE;
         td->type.additional_type = id->num_additional_types - 1;
 
         if (!DoTypeDescriptor(arena, cursor, 
                               &id->additional_types[td->type.additional_type], 
                               id))
             return PR_FALSE;
         break;
+      }
       case TD_PSTRING_SIZE_IS:
-      case TD_PWSTRING_SIZE_IS:
+      case TD_PWSTRING_SIZE_IS: {
+        // argnum2 appears in the on-disk format but it isn't used.
+        uint8_t argnum2 = 0;
         if (!XPT_Do8(cursor, &td->argnum) ||
-            !XPT_Do8(cursor, &td->argnum2))
+            !XPT_Do8(cursor, &argnum2))
             return PR_FALSE;
         break;
-
+      }
       default:
         /* nothing special */
         break;
     }
     return PR_TRUE;
 }
 
 PRBool
--- a/xpcom/typelib/xpt/xpt_struct.h
+++ b/xpcom/typelib/xpt/xpt_struct.h
@@ -205,21 +205,26 @@ enum XPTTypeDescriptorTags {
     TD_UTF8STRING        = 23,
     TD_CSTRING           = 24,
     TD_ASTRING           = 25,
     TD_JSVAL             = 26
 };
 
 struct XPTTypeDescriptor {
     XPTTypeDescriptorPrefix prefix;
-    uint8_t argnum;                 /* used for iid_is and size_is */
-    uint8_t argnum2;                /* used for length_is */
-    union {                         
-        uint16_t iface;             /* used for TD_INTERFACE_TYPE */
-        uint16_t additional_type;   /* used for TD_ARRAY */
+    uint8_t argnum;               // used for TD_ARRAY, TD_PSTRING_SIZE_IS,
+                                  // TD_PWSTRING_SIZE_IS, TD_INTERFACE_IS_TYPE
+
+    // This field exists (for the appropriate types) in the on-disk format. But
+    // it isn't used so we don't allocated space for it in memory.
+    //uint8_t argnum2;
+
+    union {
+        uint16_t iface;           // used for TD_INTERFACE_TYPE
+        uint16_t additional_type; // used for TD_ARRAY
     } type;
 };
 
 /*
  * A ConstDescriptor is a variable-size record that records the name and 
  * value of a scoped interface constant. 
  *
  * The types of the method parameter are restricted to the following subset