Remove some more xray code.

This commit is contained in:
Ms2ger 2014-04-06 23:08:54 +02:00
parent 9a4bec304f
commit 2e2a39b8d5

View file

@ -1250,23 +1250,13 @@ class PropertyDefiner:
if self.hasNonChromeOnly(): if self.hasNonChromeOnly():
return "s" + self.name return "s" + self.name
return "ptr::null()" return "ptr::null()"
def usedForXrays(self, chrome):
# We only need Xrays for methods, attributes and constants. And we only
# need them for the non-chrome ones if we have no chromeonly things.
# Otherwise (we have chromeonly attributes) we need Xrays for the chrome
# methods/attributes/constants.
return ((self.name is "Methods" or self.name is "Attributes" or
self.name is "Constants") and
chrome == self.hasChromeOnly())
def __str__(self): def __str__(self):
# We only need to generate id arrays for things that will end # We only need to generate id arrays for things that will end
# up used via ResolveProperty or EnumerateProperties. # up used via ResolveProperty or EnumerateProperties.
str = self.generateArray(self.regular, self.variableName(False), str = self.generateArray(self.regular, self.variableName(False))
self.usedForXrays(False))
if self.hasChromeOnly(): if self.hasChromeOnly():
str += self.generateArray(self.chrome, self.variableName(True), str += self.generateArray(self.chrome, self.variableName(True))
self.usedForXrays(True))
return str return str
@staticmethod @staticmethod
@ -1280,7 +1270,7 @@ class PropertyDefiner:
return prefName[0] return prefName[0]
def generatePrefableArray(self, array, name, specTemplate, specTerminator, def generatePrefableArray(self, array, name, specTemplate, specTerminator,
specType, getPref, getDataTuple, doIdArrays): specType, getPref, getDataTuple):
""" """
This method generates our various arrays. This method generates our various arrays.
@ -1313,8 +1303,6 @@ class PropertyDefiner:
# at the very front of the list. # at the very front of the list.
specs = [] specs = []
prefableSpecs = [] prefableSpecs = []
if doIdArrays:
prefableIds = []
prefableTemplate = ' { true, &%s[%d] }' prefableTemplate = ' { true, &%s[%d] }'
prefCacheTemplate = '&%s[%d].enabled' prefCacheTemplate = '&%s[%d].enabled'
@ -1345,16 +1333,9 @@ class PropertyDefiner:
specs.append(specTerminator) specs.append(specTerminator)
prefableSpecs.append(" { false, NULL }"); prefableSpecs.append(" { false, NULL }");
arrays = (("static %s: [%s, ..%i] = [\n" + return (("static %s: [%s, ..%i] = [\n" +
',\n'.join(specs) + "\n" + ",\n".join(specs) + "\n" +
"];\n\n") % (name, specType, len(specs))) "];\n\n") % (name, specType, len(specs)))
#+
#"static Prefable<%s> %s[] = [\n" +
#',\n'.join(prefableSpecs) + "\n" +
#"];\n\n")
if doIdArrays:
arrays += ("static %s_ids: [jsid, ..%i] = [" % (name, len(specs))) + ", ".join(["JSID_VOID"] * len(specs)) + "];\n\n"
return arrays
# The length of a method is the maximum of the lengths of the # The length of a method is the maximum of the lengths of the
# argument lists of all its overloads. # argument lists of all its overloads.
@ -1417,7 +1398,7 @@ class MethodDefiner(PropertyDefiner):
# non-static methods go on the interface prototype object # non-static methods go on the interface prototype object
assert not self.hasChromeOnly() and not self.hasNonChromeOnly() assert not self.hasChromeOnly() and not self.hasNonChromeOnly()
def generateArray(self, array, name, doIdArrays): def generateArray(self, array, name):
if len(array) == 0: if len(array) == 0:
return "" return ""
@ -1443,7 +1424,7 @@ class MethodDefiner(PropertyDefiner):
' JSFunctionSpec {name: &%s_name as *u8 as *libc::c_char, call: JSNativeWrapper {op: Some(%s), info: %s}, nargs: %s, flags: %s as u16, selfHostedName: 0 as *libc::c_char }', ' JSFunctionSpec {name: &%s_name as *u8 as *libc::c_char, call: JSNativeWrapper {op: Some(%s), info: %s}, nargs: %s, flags: %s as u16, selfHostedName: 0 as *libc::c_char }',
' JSFunctionSpec {name: 0 as *libc::c_char, call: JSNativeWrapper {op: None, info: 0 as *JSJitInfo}, nargs: 0, flags: 0, selfHostedName: 0 as *libc::c_char }', ' JSFunctionSpec {name: 0 as *libc::c_char, call: JSNativeWrapper {op: None, info: 0 as *JSJitInfo}, nargs: 0, flags: 0, selfHostedName: 0 as *libc::c_char }',
'JSFunctionSpec', 'JSFunctionSpec',
pref, specData, doIdArrays) pref, specData)
class AttrDefiner(PropertyDefiner): class AttrDefiner(PropertyDefiner):
def __init__(self, descriptor, name): def __init__(self, descriptor, name):
@ -1452,7 +1433,7 @@ class AttrDefiner(PropertyDefiner):
self.chrome = [m for m in descriptor.interface.members if m.isAttr()] self.chrome = [m for m in descriptor.interface.members if m.isAttr()]
self.regular = [m for m in self.chrome if not isChromeOnly(m)] self.regular = [m for m in self.chrome if not isChromeOnly(m)]
def generateArray(self, array, name, doIdArrays): def generateArray(self, array, name):
if len(array) == 0: if len(array) == 0:
return "" return ""
@ -1491,7 +1472,7 @@ class AttrDefiner(PropertyDefiner):
' JSPropertySpec { name: &%s_name as *u8 as *libc::c_char, tinyid: 0, flags: ((%s) & 0xFF) as u8, getter: %s, setter: %s }', ' JSPropertySpec { name: &%s_name as *u8 as *libc::c_char, tinyid: 0, flags: ((%s) & 0xFF) as u8, getter: %s, setter: %s }',
' JSPropertySpec { name: 0 as *libc::c_char, tinyid: 0, flags: 0, getter: JSPropertyOpWrapper {op: None, info: 0 as *JSJitInfo}, setter: JSStrictPropertyOpWrapper {op: None, info: 0 as *JSJitInfo} }', ' JSPropertySpec { name: 0 as *libc::c_char, tinyid: 0, flags: 0, getter: JSPropertyOpWrapper {op: None, info: 0 as *JSJitInfo}, setter: JSStrictPropertyOpWrapper {op: None, info: 0 as *JSJitInfo} }',
'JSPropertySpec', 'JSPropertySpec',
PropertyDefiner.getControllingPref, specData, doIdArrays) PropertyDefiner.getControllingPref, specData)
class ConstDefiner(PropertyDefiner): class ConstDefiner(PropertyDefiner):
""" """
@ -1503,7 +1484,7 @@ class ConstDefiner(PropertyDefiner):
self.chrome = [m for m in descriptor.interface.members if m.isConst()] self.chrome = [m for m in descriptor.interface.members if m.isConst()]
self.regular = [m for m in self.chrome if not isChromeOnly(m)] self.regular = [m for m in self.chrome if not isChromeOnly(m)]
def generateArray(self, array, name, doIdArrays): def generateArray(self, array, name):
if len(array) == 0: if len(array) == 0:
return "" return ""
@ -1523,7 +1504,7 @@ class ConstDefiner(PropertyDefiner):
' ConstantSpec { name: &%s_name as *u8 as *libc::c_char, value: %s }', ' ConstantSpec { name: &%s_name as *u8 as *libc::c_char, value: %s }',
' ConstantSpec { name: 0 as *libc::c_char, value: VoidVal }', ' ConstantSpec { name: 0 as *libc::c_char, value: VoidVal }',
'ConstantSpec', 'ConstantSpec',
PropertyDefiner.getControllingPref, specData, doIdArrays) PropertyDefiner.getControllingPref, specData)
# We'll want to insert the indent at the beginnings of lines, but we # We'll want to insert the indent at the beginnings of lines, but we
# don't want to indent empty lines. So only indent lines that have a # don't want to indent empty lines. So only indent lines that have a