Bug 958540 part 1. Factor out the uninit behavior of union structs into a separate method. r=dzbarsky
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 01 Apr 2014 01:58:27 -0400
changeset 194969 5d14c9ea9a49ba5ce84b2a26695593228ea17dd2
parent 194968 f5c5742ad0041f32448da8ebcf658051f7d29a1b
child 194970 67819547c820df6a5989ddddc9f88b6059d61be0
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdzbarsky
bugs958540
milestone31.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 958540 part 1. Factor out the uninit behavior of union structs into a separate method. r=dzbarsky
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -7230,16 +7230,21 @@ class CGUnionStruct(CGThing):
                     assert t.isSpiderMonkeyInterface()
                     traceCases.append(
                         CGCase("e" + vars["name"],
                                CGGeneric("mValue.m%s.Value().TraceSelf(trc);" %
                                          vars["name"])))
 
         dtor = CGSwitch("mType", destructorCases).define()
 
+        methods.append(ClassMethod("Uninit", "void", [],
+                                   visibility="private", body=dtor,
+                                   bodyInHeader=not self.ownsMembers,
+                                   inline=not self.ownsMembers))
+
         methods.append(ClassMethod("ToJSVal", "bool", [
                                    Argument("JSContext*", "cx"),
                                    Argument("JS::Handle<JSObject*>", "scopeObj"),
                                    Argument("JS::MutableHandle<JS::Value>", "rval")
         ], body=CGSwitch("mType", toJSValCases,
                          default=CGGeneric("return false;")).define(), const=True))
 
         constructors = [ctor]
@@ -7276,18 +7281,18 @@ class CGUnionStruct(CGThing):
         return CGClass(selfName,
                        bases=bases,
                        members=members,
                        constructors=constructors,
                        methods=methods,
                        disallowCopyConstruction=disallowCopyConstruction,
                        extradeclarations=friend,
                        destructor=ClassDestructor(visibility="public",
-                                                  body=dtor,
-                                                  bodyInHeader=not self.ownsMembers),
+                                                  body="Uninit();",
+                                                  bodyInHeader=True),
                        enums=[ClassEnum("Type", enumValues, visibility="private")],
                        unions=[ClassUnion("Value", unionValues, visibility="private")])
 
     def getConversionToJS(self, templateVars, type):
         assert not type.nullable() # flatMemberTypes never has nullable types
         val = "mValue.m%(name)s.Value()" % templateVars
         wrapCode = wrapForType(
             type, self.descriptorProvider,