rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
"&helper, cache, &NS_GET_IID(%s), &interfaces[k_%s], %s);\n"
"helper, &NS_GET_IID(%s), &interfaces[k_%s], %s);\n"
def writeResultConv(f, type, jsvalPtr, jsvalRef): """ Emit code to convert the C++ variable `result` to a jsval. The emitted code contains a return statement; it returns JS_TRUE on success, JS_FALSE on error. """ # From NativeData2JS. typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = resu...
" qsObjectHelper helper(ToSupports(result));\n" " helper.SetNode(result);\n" " helper.SetCanonical(ToCanonicalSupports(result));\n"
def writeTraceableResultConv(f, type): typeName = getBuiltinOrNativeTypeName(type) assert typeName is not '[jsval]' if typeName is not None: template = traceableResultConvTemplates.get(typeName) if template is not None: values = { 'errorStr': getFailureString( getTraceInfoDefaultReturn(type), 2) } f.write(substitute(te...
"&helper, cache, &NS_GET_IID(%s), &interfaces[k_%s], "
"helper, &NS_GET_IID(%s), &interfaces[k_%s], "
def writeTraceableResultConv(f, type): typeName = getBuiltinOrNativeTypeName(type) assert typeName is not '[jsval]' if typeName is not None: template = traceableResultConvTemplates.get(typeName) if template is not None: values = { 'errorStr': getFailureString( getTraceInfoDefaultReturn(type), 2) } f.write(substitute(te...
if os.path.basename(dir) == 'src': path = None break
def create(cls, jsdir): """Create a XULInfo based on the current platform's characteristics."""
"cx, js::Jsvalify(js::ValueArgToConstRef(%s)), &%s, &%sref.ptr, &vp.array[%d]);\n" % (type.name, argVal, name, name, 2 + i))
"cx, js::Jsvalify(js::ValueArgToConstRef(%s)), &%s, &%sref.ptr, &%sanchor.get());\n" % (type.name, argVal, name, name, name))
def writeTraceableArgumentConversion(f, member, i, name, type, haveCcx, rvdeclared): argVal = "_arg%d" % i params = { 'name': name, 'argVal': argVal } typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = traceableArgumentConversionTemplates.get(typeName) if template is not None: f.write(sub...
f.write(" JSBool ok = xpc_qsVariantToJsval(lccx, result, " "&vp.array[0]);\n")
f.write(" jsval returnVal;\n" " JSBool ok = xpc_qsVariantToJsval(lccx, result, " "&returnVal);\n")
def writeTraceableResultConv(f, type): typeName = getBuiltinOrNativeTypeName(type) assert typeName is not '[jsval]' if typeName is not None: template = traceableResultConvTemplates.get(typeName) if template is not None: values = { 'errorStr': getFailureString( getTraceInfoDefaultReturn(type), 2) } f.write(substitute(te...
" xpc_GetCachedSlimWrapper(cache, obj, &vp.array[0]);\n"
" xpc_GetCachedSlimWrapper(cache, obj);\n"
def writeTraceableResultConv(f, type): typeName = getBuiltinOrNativeTypeName(type) assert typeName is not '[jsval]' if typeName is not None: template = traceableResultConvTemplates.get(typeName) if template is not None: values = { 'errorStr': getFailureString( getTraceInfoDefaultReturn(type), 2) } f.write(substitute(te...
"&vp.array[0]);\n"
"&returnVal);\n"
def writeTraceableResultConv(f, type): typeName = getBuiltinOrNativeTypeName(type) assert typeName is not '[jsval]' if typeName is not None: template = traceableResultConvTemplates.get(typeName) if template is not None: values = { 'errorStr': getFailureString( getTraceInfoDefaultReturn(type), 2) } f.write(substitute(te...
f.write(" return JSVAL_TO_OBJECT(vp.array[0]);\n")
f.write(" return JSVAL_TO_OBJECT(returnVal);\n")
def writeTraceableResultConv(f, type): typeName = getBuiltinOrNativeTypeName(type) assert typeName is not '[jsval]' if typeName is not None: template = traceableResultConvTemplates.get(typeName) if template is not None: values = { 'errorStr': getFailureString( getTraceInfoDefaultReturn(type), 2) } f.write(substitute(te...
f.write(" xpc_qsArgValArray<%d> vp(cx);\n" % (2 + len(member.params)))
f.write(" js::Anchor<jsval> selfanchor;\n")
def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is None:...
"&vp.array[1])) {\n")
"&selfanchor.get())) {\n")
def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is None:...
"&vp.array[1], &lccx)) {\n")
"&selfanchor.get(), &lccx)) {\n")
def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is None:...
"&vp.array[1], nsnull)) {\n")
"&selfanchor.get(), nsnull)) {\n")
def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is None:...
if getBuiltinOrNativeTypeName(member.realtype) == '[jsval]': argNames.append("&vp.array[0]") elif not isVoidType(member.realtype):
if not isVoidType(member.realtype):
def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is None:...
def _shmemHandleType(): return Type('Shmem::SharedMemoryHandle')
def _shmemTypeType(): return Type('Shmem::SharedMemory::SharedMemoryType')
def _shmemHandleType(): return Type('Shmem::SharedMemoryHandle')
def _shmemAlloc(size):
def _shmemAlloc(size, type):
def _shmemAlloc(size): # starts out UNprotected return ExprCall(ExprVar('Shmem::Alloc'), args=[ _shmemBackstagePass(), size ])
args=[ _shmemBackstagePass(), size ]) def _shmemOpenExisting(size, handle):
args=[ _shmemBackstagePass(), size, type ]) def _shmemShareTo(shmemvar, processvar, route): return ExprCall(ExprSelect(shmemvar, '.', 'ShareTo'), args=[ _shmemBackstagePass(), processvar, route ]) def _shmemOpenExisting(descriptor, outid):
def _shmemAlloc(size): # starts out UNprotected return ExprCall(ExprVar('Shmem::Alloc'), args=[ _shmemBackstagePass(), size ])
handle, size, ExprLiteral.TRUE ])
descriptor, outid, ExprLiteral.TRUE ])
def _shmemOpenExisting(size, handle): # starts out protected return ExprCall(ExprVar('Shmem::OpenExisting'), args=[ _shmemBackstagePass(), # true => protect handle, size, ExprLiteral.TRUE ])
def _shmemCreatedMsgVar(): return ExprVar('mozilla::ipc::__internal__ipdl__ShmemCreated')
def _shmemRevokeRights(shmemexpr): return ExprCall(ExprSelect(shmemexpr, '.', 'RevokeRights'), args=[ _shmemBackstagePass() ])
Typedef(Type('base::ProcessHandle'), 'ProcessHandle')
Typedef(Type('base::ProcessHandle'), 'ProcessHandle'), Typedef(Type('mozilla::ipc::SharedMemory'), 'SharedMemory')
def standardTypedefs(self): return [ Typedef(Type('IPC::Message'), 'Message'), Typedef(Type(self.protocol.channelName()), 'Channel'), Typedef(Type(self.protocol.fqListenerName()), 'ChannelListener'), Typedef(Type('base::ProcessHandle'), 'ProcessHandle') ]
rawvar = ExprVar('rawshmem') handlevar = ExprVar('handle')
rawvar = ExprVar('segment')
def implementManagerIface(self): p = self.protocol routedvar = ExprVar('aRouted') idvar = ExprVar('aId') sizevar = ExprVar('aSize') listenertype = Type('ChannelListener', ptr=1)
initargs=[ _shmemAlloc(sizevar) ]))
initargs=[ _shmemAlloc(sizevar, typevar) ]))
def implementManagerIface(self): p = self.protocol routedvar = ExprVar('aRouted') idvar = ExprVar('aId') sizevar = ExprVar('aSize') listenertype = Type('ChannelListener', ptr=1)
createshmem.addstmt(StmtDecl( Decl(_shmemHandleType(), handlevar.name))) failif = StmtIf(ExprNot(ExprCall( ExprSelect(rawvar, '->', 'ShareToProcess'), args=[ ExprCall(p.otherProcessMethod()), ExprAddrOf(handlevar) ])))
shmemvar = ExprVar('shmem') descriptorvar = ExprVar('descriptor') createshmem.addstmts([ StmtDecl( Decl(_shmemType(), shmemvar.name), initargs=[ _shmemBackstagePass(), _autoptrGet(rawvar), p.nextShmemIdExpr(self.side) ]), StmtDecl(Decl(Type('Message', ptr=1), descriptorvar.name), init=_shmemShareTo(shmemvar, ExprCall(p...
def implementManagerIface(self): p = self.protocol routedvar = ExprVar('aRouted') idvar = ExprVar('aId') sizevar = ExprVar('aSize') listenertype = Type('ChannelListener', ptr=1)
StmtExpr(ExprAssn( ExprDeref(idvar), p.nextShmemIdExpr(self.side))), StmtDecl(ExprCall(
StmtExpr(ExprAssn(ExprDeref(idvar), _shmemId(shmemvar))), StmtExpr(ExprCall(
def implementManagerIface(self): p = self.protocol routedvar = ExprVar('aRouted') idvar = ExprVar('aId') sizevar = ExprVar('aSize') listenertype = Type('ChannelListener', ptr=1)
args=[ rawvar, ExprDeref(idvar) ])) ]) msgvar = ExprVar('msg') createshmem.addstmts([ StmtDecl( Decl(Type('Message', ptr=1), msgvar.name), ExprNew(Type(_shmemCreatedMsgVar().name), args=[ p.routingId(), handlevar, ExprDeref(idvar), sizevar ])), StmtExpr(ExprCall( ExprSelect(p.channelVar(), p.channelSel(), 'Send'), ar...
args=[ rawvar, ExprDeref(idvar) ])),
def implementManagerIface(self): p = self.protocol routedvar = ExprVar('aRouted') idvar = ExprVar('aId') sizevar = ExprVar('aSize') listenertype = Type('ChannelListener', ptr=1)
[ sizevar, idvar ])))
[ sizevar, typevar, idvar ])))
def implementManagerIface(self): p = self.protocol routedvar = ExprVar('aRouted') idvar = ExprVar('aId') sizevar = ExprVar('aSize') listenertype = Type('ChannelListener', ptr=1)
handlevar = ExprVar('handle')
rawvar = ExprVar('rawmem')
def genShmemCreatedHandler(self): p = self.protocol assert p.decl.type.isToplevel() case = StmtBlock()
sizevar = ExprVar('size') rawvar = ExprVar('rawmem') failif = StmtIf(ExprNot(ExprCall( ExprVar(_shmemCreatedMsgVar().name +'::Read'), args=[ ExprAddrOf(self.msgvar), ExprAddrOf(handlevar), ExprAddrOf(idvar), ExprAddrOf(sizevar) ])))
case.addstmts([ StmtDecl(Decl(_shmemIdType(), idvar.name)), StmtDecl(Decl(_autoptr(_rawShmemType()), rawvar.name), initargs=[ _shmemOpenExisting(self.msgvar, ExprAddrOf(idvar)) ]) ]) failif = StmtIf(ExprNot(rawvar))
def genShmemCreatedHandler(self): p = self.protocol assert p.decl.type.isToplevel() case = StmtBlock()
case.addstmts([ StmtDecl(Decl(_shmemHandleType(), handlevar.name)), StmtDecl(Decl(_shmemIdType(), idvar.name)), StmtDecl(Decl(Type.SIZE, sizevar.name)), Whitespace.NL, failif, Whitespace.NL, StmtDecl(Decl(_autoptr(_rawShmemType()), rawvar.name), initargs=[ _shmemOpenExisting(sizevar, handlevar) ]) ]) failif = StmtIf(E...
def genShmemCreatedHandler(self): p = self.protocol assert p.decl.type.isToplevel() case = StmtBlock()
prefixArgCount = 3 if haveCallee else 2
prefixArgCount = 2 + int(haveCallee);
def addStubMember(memberId, member, traceable): mayTrace = False if member.kind == 'method': # This code MUST match writeTraceableQuickStub haveCallee = memberNeedsCallee(member) # Traceable natives support up to MAX_TRACEABLE_NATIVE_ARGS # total arguments. We always have two prefix arguments # (CONTEXT and THIS) and ...
xul_info = manifest.XULInfo.create(JS)
if OPTIONS.xul_info_src is None: xul_info = manifest.XULInfo.create(JS) else: xul_abi, xul_os, xul_debug = OPTIONS.xul_info_src.split(r':') xul_debug = xul_debug.lower() is 'true' xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug)
def run_tests(tests, results): """Run the given tests, sending raw results to the given results accumulator.""" pb = None if not OPTIONS.hide_progress: try: from progressbar import ProgressBar pb = ProgressBar('', len(tests), 16) except ImportError: pass results.pb = pb test_list = [ TestTask(test) for test in tests ]...
f.write(" JSAutoTempValueRooter tvr(cx);\n")
f.write(" js::AutoValueRooter tvr(cx);\n")
def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False): """ Write a single quick stub (a custom SpiderMonkey getter/setter/method) for the specified XPCOM interface-member. """ isAttr = (member.kind == 'attribute') isMethod = (member.kind == 'method') assert isAttr or isMethod isGetter = isAttr and ...
rev = os.popen('hg identify -i "%s"' % srcdir, "r").readlines()[0].rstrip() if rev.endswith('+'): rev = rev[:-1] path = os.popen('hg -R "%s" showconfig paths.default' % srcdir, "r").readlines()[0].rstrip()
rev = read_output('hg', '-R', srcdir, 'parent', '--template={node|short}') path = read_output('hg', '-R', srcdir, 'showconfig', 'paths.default')
def __init__(self, file, srcdir): VCSFileInfo.__init__(self, file) # we should only have to collect this info once per-repo if not srcdir in HGRepoInfo.repos: rev = os.popen('hg identify -i "%s"' % srcdir, "r").readlines()[0].rstrip() # could have a + if there are uncommitted local changes if rev.endswith('+'): rev = r...
os.system("objcopy --only-keep-debug %s %s" % (file, file_dbg)) os.system("objcopy --add-gnu-debuglink=%s %s" % (file_dbg, file)) rel_path = os.path.join(debug_file, guid, debug_file + ".dbg") full_path = os.path.normpath(os.path.join(self.symbol_path, rel_path)) shutil.move(file_dbg, full_path) os.system("gzip %s" %...
if call(['objcopy', '--only-keep-debug', file, file_dbg]) == 0 and \ call(['objcopy', '--add-gnu-debuglink=%s' % file_dbg, file]) == 0: rel_path = os.path.join(debug_file, guid, debug_file + ".dbg") full_path = os.path.normpath(os.path.join(self.symbol_path, rel_path)) shutil.move(file_dbg, full_path) os.system("gzip ...
def CopyDebug(self, file, debug_file, guid): # We want to strip out the debug info, and add a # .gnu_debuglink section to the object, so the debugger can # actually load our debug info later. file_dbg = file + ".dbg" os.system("objcopy --only-keep-debug %s %s" % (file, file_dbg)) os.system("objcopy --add-gnu-debuglink=...
StmtReturn(ExprDeref(c.callGetConstPtr()))
StmtReturn(c.getConstValue())
def maybeReconstruct(memb, newTypeVar): ifdied = StmtIf(callMaybeDestroy(newTypeVar)) ifdied.addifstmt(StmtExpr(memb.callCtor())) return ifdied
StmtExpr(ExprAssn(ExprDeref(var), c.defaultValue())),
StmtDecl(Decl(ct, tmpvar.name), init=c.defaultValue()), StmtExpr(ExprAssn(ExprDeref(var), tmpvar)),
uniontdef = Typedef(_cxxBareType(uniontype, typename), typename)
filenames = ('jstests.list', os.path.join(os.path.dirname(__file__), 'jstests.list')) for filename in filenames: if os.path.isfile(filename): OPTIONS.manifest = filename break if OPTIONS.manifest is None:
filename = os.path.join(os.path.dirname(__file__), 'jstests.list') if os.path.isfile(filename): OPTIONS.manifest = filename else:
def run_tests(tests, results): """Run the given tests, sending raw results to the given results accumulator.""" pb = None if not OPTIONS.hide_progress: try: from progressbar import ProgressBar pb = ProgressBar('', len(tests), 16) except ImportError: pass results.pb = pb test_list = [ TestTask(test) for test in tests ]...
os.chdir(os.path.dirname(OPTIONS.manifest))
manifest_dir = os.path.dirname(OPTIONS.manifest) if manifest_dir not in ('', '.'): os.chdir(os.path.dirname(OPTIONS.manifest))
def p(path): for arg in args: if path.find(arg) != -1: return True return False
+ self.makeReply(md, errfnRecv)
+ self.makeReply(md, errfnRecv, idvar)
def genCtorRecvCase(self, md): lbl = CaseLabel(md.pqMsgId()) case = StmtBlock() actorvar = md.actorDecl().var()
idvar = ExprVar('__id')
idvar, saveIdStmts = self.saveActorId(md)
def genDtorRecvCase(self, md): lbl = CaseLabel(md.pqMsgId()) case = StmtBlock()
+ [ StmtDecl(Decl(_actorIdType(), idvar.name), self.protocol.routingId()) ]
+ saveIdStmts
def genDtorRecvCase(self, md): lbl = CaseLabel(md.pqMsgId()) case = StmtBlock()
+ self.makeReply(md, errfnRecv)
+ self.makeReply(md, errfnRecv, routingId=idvar)
def genRecvCase(self, md): lbl = CaseLabel(md.pqMsgId()) case = StmtBlock()
def makeReply(self, md, errfn, routingId=None):
def makeReply(self, md, errfn, routingId):
def makeReply(self, md, errfn, routingId=None): # TODO special cases for async ctor/dtor replies if md.decl.type.isAsync(): return [ ]
if md.decl.type.isAsync():
if not md.decl.type.hasReply():
def makeReply(self, md, errfn, routingId=None): # TODO special cases for async ctor/dtor replies if md.decl.type.isAsync(): return [ ]
jit_flags = [ '-m', '-j' ]
jit_flags = [ '-m' ]
def get_test_cmd(path, lib_dir): libdir_var = lib_dir if not libdir_var.endswith('/'): libdir_var += '/' expr = "const platform=%r; const libdir=%r;"%(sys.platform, libdir_var) if OPTIONS.methodjit_only: jit_flags = [ '-m' ] else: jit_flags = [ '-m', '-j' ] return [ JS ] + jit_flags + [ '-e', expr, '-f', os.path.join(l...
% (type.name, type.name, jsvalPtr))
% (jsvalPtr, type.name, type.name, jsvalPtr))
def writeResultConv(f, type, jsvalPtr, jsvalRef): """ Emit code to convert the C++ variable `result` to a jsval. The emitted code contains a return statement; it returns JS_TRUE on success, JS_FALSE on error. """ # From NativeData2JS. typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = resu...
if os.path.exists(newpath):
if os.path.isfile(newpath):
def searchPath(directory, path): "Go one step beyond getFullPath and try the various folders in PATH" # Try looking in the current working directory first. newpath = getFullPath(directory, path) if os.path.exists(newpath): return newpath # At this point we have to fail if a directory was given (to prevent cases # like...
line_re = re.compile("^([ \|0-9-]*)(.*) ?\[([^ ]*) \+(0x[0-9A-F]{1,8})\](.*)$")
line_re = re.compile("^(.*) ?\[([^ ]*) \+(0x[0-9A-F]{1,8})\](.*)$") balance_tree_re = re.compile("^([ \|0-9-]*)")
def cxxfilt(sym): if cxxfilt_proc is None: globals()["cxxfilt_proc"] = subprocess.Popen(['c++filt', '--no-strip-underscores', '--format', 'gnu-v3'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) # strip underscores ourselves (works better than c++filt's # --strip-underscores) cxxfilt_proc.stdin.write(sym[1:] + "\n") r...
(before, badsymbol, file, address, after) = result.groups()
(before, file, address, after) = result.groups()
def fixSymbols(line): result = line_re.match(line) if result is not None: # before allows preservation of balance trees # after allows preservation of counts (before, badsymbol, file, address, after) = result.groups() address = int(address, 16) if os.path.exists(file) and os.path.isfile(file): address += address_adjus...
if e.errno != 2:
if e.errno != errno.ENOENT:
def getOutput(self, name): out = self.ensureDirFor(name) # remove previous link or file try: os.remove(out) except OSError, e: if e.errno != 2: raise return open(out, 'wb')
if e.errno != 2:
if e.errno != errno.ENOENT:
def symlink(self, src, dest): out = self.ensureDirFor(dest) # remove previous link or file try: os.remove(out) except OSError, e: if e.errno != 2: raise os.symlink(src, out)
profileDir = mkdtemp()
if self.interactive or self.singleFile: profileDir = os.path.join(gettempdir(), self.profileName, "xpcshellprofile") try: self.removeDir(profileDir) except: pass os.makedirs(profileDir) else: profileDir = mkdtemp()
def setupProfileDir(self): """ Create a temporary folder for the profile and set appropriate environment variables.
debuggerArgs=None, debuggerInteractive=False):
debuggerArgs=None, debuggerInteractive=False, profileName=None):
def runTests(self, xpcshell, xrePath=None, symbolsPath=None, manifest=None, testdirs=[], testPath=None, interactive=False, logfiles=True, thisChunk=1, totalChunks=1, debugger=None, debuggerArgs=None, debuggerInteractive=False): """Run xpcshell tests.
if self.profileDir:
if self.profileDir and not self.interactive and not self.singleFile:
def runTests(self, xpcshell, xrePath=None, symbolsPath=None, manifest=None, testdirs=[], testPath=None, interactive=False, logfiles=True, thisChunk=1, totalChunks=1, debugger=None, debuggerArgs=None, debuggerInteractive=False): """Run xpcshell tests.
def __init__(self, path, slow, allow_oom, tmflags, valgrind):
def __init__(self, path, slow, allow_oom, tmflags, error, valgrind):
def __init__(self, path, slow, allow_oom, tmflags, valgrind): """ path path to test file slow True means the test is slow-running allow_oom True means OOM should not be considered a failure valgrind True means test should run under valgrind """ self.path = path self.slow = slow self.allow_oom = allo...
tmflags = ''
error = tmflags = ''
def from_file(cls, path, options): slow = allow_oom = valgrind = False tmflags = ''
return cls(path, slow, allow_oom, tmflags, valgrind or options.valgrind_all)
return cls(path, slow, allow_oom, tmflags, error, valgrind or options.valgrind_all)
def from_file(cls, path, options): slow = allow_oom = valgrind = False tmflags = ''
return (check_output(out, err, p.returncode, test.allow_oom), out, err) def check_output(out, err, rc, allow_oom):
return (check_output(out, err, p.returncode, test.allow_oom, test.error), out, err) def check_output(out, err, rc, allow_oom, expectedError): if expectedError: return expectedError in err
def run_test(test, lib_dir): if test.tmflags: env = os.environ.copy() env['TMFLAGS'] = test.tmflags else: env = None cmd = get_test_cmd(test.path, lib_dir) if (test.valgrind and any([os.path.exists(os.path.join(d, 'valgrind')) for d in os.environ['PATH'].split(os.pathsep)])): valgrind_prefix = [ 'valgrind', '-q', '--s...
'GetMinidump',
'TakeMinidump',
def makeHandlerMethod(name, switch, hasReply, dispatches=0): params = [ Decl(Type('Message', const=1, ref=1), msgvar.name) ] if hasReply: params.append(Decl(Type('Message', ref=1, ptr=1), replyvar.name)) method = MethodDefn(MethodDecl(name, virtual=True, params=params, ret=_Result.Type())) if dispatches: routevar = Ex...
ExprVar('XRE_GetMinidumpForChild'),
ExprVar('XRE_TakeMinidumpForChild'),
def makeHandlerMethod(name, switch, hasReply, dispatches=0): params = [ Decl(Type('Message', const=1, ref=1), msgvar.name) ] if hasReply: params.append(Decl(Type('Message', ref=1, ptr=1), replyvar.name)) method = MethodDefn(MethodDecl(name, virtual=True, params=params, ret=_Result.Type())) if dispatches: routevar = Ex...
" char *${name};\n" " if (!xpc_qsJsvalToCharStr(cx, ${argVal}, ${argPtr}, &${name}))\n" " return JS_FALSE;\n",
" JSAutoByteString ${name}_bytes;\n" " if (!xpc_qsJsvalToCharStr(cx, ${argVal}, &${name}_bytes))\n" " return JS_FALSE;\n" " char *${name} = ${name}_bytes.ptr();\n",
def replacement(match): return vals[match.group(1)]
if len(member.params) <= 3: mayTrace = True
haveCallee = memberNeedsCallee(member) mayTrace = ((haveCallee and len(member.params) <= MAX_TRACEABLE_NATIVE_ARGS - 3) or len(member.params) <= MAX_TRACEABLE_NATIVE_ARGS - 2)
def addStubMember(memberId, member, traceable): mayTrace = False if member.kind == 'method': if len(member.params) <= 3: mayTrace = True for param in member.params: for attrname, value in vars(param).items(): if value is True: # Let the tracer call the regular fastnative method if there # are optional arguments. if at...
print >>sys.stderr, fmt % args
print fmt % args
def log(minv, fmt, *args): if _verbosity >= minv: print >>sys.stderr, fmt % args
log(1, 'Generated C++ headers will be generated relative to "%s"', headersdir) log(1, 'Generated C++ sources will be generated in "%s"', cppdir)
log(2, 'Generated C++ headers will be generated relative to "%s"', headersdir) log(2, 'Generated C++ sources will be generated in "%s"', cppdir)
def log(minv, fmt, *args): if _verbosity >= minv: print >>sys.stderr, fmt % args
log(1, 'Parsing specification %s', f)
log(1, os.path.basename(f))
def log(minv, fmt, *args): if _verbosity >= minv: print >>sys.stderr, fmt % args
cxxfilt_proc.stdin.write(sym + "\n")
cxxfilt_proc.stdin.write(sym[1:] + "\n")
def cxxfilt(sym): if cxxfilt_proc is None: globals()["cxxfilt_proc"] = subprocess.Popen(['c++filt', '--no-strip-underscores', '--format', 'gnu-v3'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) cxxfilt_proc.stdin.write(sym + "\n") return cxxfilt_proc.stdout.readline().rstrip("\n")
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=close_fds)
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=close_fds, preexec_fn=set_limits)
def th_run_cmd(cmd, l): t0 = datetime.datetime.now() # close_fds is not supported on Windows and will cause a ValueError. close_fds = sys.platform != 'win32' p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=close_fds) l[0] = p out, err = p.communicate() t1 = datetime.datetime.now() dd = t1-t0 dt = dd.seco...
except: print "Encountered error while uploading" raise
def UploadFiles(user, host, path, files, verbose=False, port=None, ssh_key=None, base_path=None, upload_to_temp_dir=False, post_upload_command=None): """Upload each file in the list files to user@host:path. Optionally pass port and ssh_key to the ssh commands. If base_path is not None, upload files including their path...
(stdout and re.search("^((parent|child): )?TEST-UNEXPECTED-FAIL", stdout, re.MULTILINE)):
(stdout and re.search("^((parent|child): )?TEST-UNEXPECTED-FAIL", stdout, re.MULTILINE)) or \ (stdout and re.search(": SyntaxError:", stdout, re.MULTILINE)):
def runTests(self, xpcshell, xrePath=None, symbolsPath=None, manifest=None, testdirs=[], testPath=None, interactive=False, logfiles=True, debuggerInfo=None): """Run xpcshell tests.
f.write(" (%d, (static, %s, %s, %s, 0, nanojit::ACC_STORE_ANY)))\n\n"
f.write(" (%d, (static, %s, %s, %s, 0, nanojit::ACCSET_STORE_ANY)))\n\n"
def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is None:...
return not self.groups.get((False, True, False))
return 'REGRESSIONS' not in self.groups
def all_passed(self): return not self.groups.get((False, True, False))
args=[ _shmemBackstagePass(), size, type ])
args=[ _shmemBackstagePass(), size, type, ExprLiteral.FALSE ])
def _shmemAlloc(size, type): # starts out UNprotected return ExprCall(ExprVar('Shmem::Alloc'), args=[ _shmemBackstagePass(), size, type ])
" if (!${name}.IsValid())\n" " return JS_FALSE;\n", '[utf8string]': " xpc_qsAUTF8String ${name}(cx, ${argVal}, ${argPtr});\n"
def replacement(match): return vals[match.group(1)]
warn("Unable to unbox argument of type %s (native type %s)" % (type.name, typeName))
warn("Unable to unbox argument of type %s" % type.name)
def writeArgumentUnboxing(f, i, name, type, haveCcx, optional, rvdeclared, nullBehavior, undefinedBehavior): # f - file to write to # i - int or None - Indicates the source jsval. If i is an int, the source # jsval is argv[i]; otherwise it is *vp. But if Python i >= C++ argc, # which can only happen if option...
'[utf8string]':
'[cstring]':
def writeFailure(f, retval, indent): f.write(getFailureString(retval, indent))
op.add_option('--jitflags', dest='jitflags', default='j,m,mj',
op.add_option('--jitflags', dest='jitflags', default='j',
def parse_jitflags(): jitflags = [ [ '-' + flag for flag in flags ] for flags in OPTIONS.jitflags.split(',') ] for flags in jitflags: for flag in flags: if flag not in ('-j', '-m'): print('Invalid jit flag: "%s"'%flag) sys.exit(1) return jitflags
For example: |Actor[]| would turn into |nsTArray<ActorParent*>|, so this
For example: |Actor[]| would turn into |Array<ActorParent*>|, so this
def _hasVisibleActor(ipdltype): """Return true iff a C++ decl of |ipdltype| would have an Actor* type.
return Type('nsTArray', T=basetype, const=const, ref=ref)
return Type('InfallibleTArray', T=basetype, const=const, ref=ref)
def _cxxArrayType(basetype, const=0, ref=0): return Type('nsTArray', T=basetype, const=const, ref=ref)
code = customMethodCall['code']
code = customMethodCall.get('code', None)
def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False): """ Write a single quick stub (a custom SpiderMonkey getter/setter/method) for the specified XPCOM interface-member. """ isAttr = (member.kind == 'attribute') isMethod = (member.kind == 'method') assert isAttr or isMethod isGetter = isAttr and ...
canFail = customMethodCall is None or customMethodCall.get('canFail', False)
canFail = customMethodCall is None or customMethodCall.get('canFail', True)
def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False): """ Write a single quick stub (a custom SpiderMonkey getter/setter/method) for the specified XPCOM interface-member. """ isAttr = (member.kind == 'attribute') isMethod = (member.kind == 'method') assert isAttr or isMethod isGetter = isAttr and ...
if customMethodCall is not None:
if code is not None:
def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False): """ Write a single quick stub (a custom SpiderMonkey getter/setter/method) for the specified XPCOM interface-member. """ isAttr = (member.kind == 'attribute') isMethod = (member.kind == 'method') assert isAttr or isMethod isGetter = isAttr and ...
if customMethodCall is None or (isGetter and callTemplate is ""): if customMethodCall is not None:
if code is None or (isGetter and callTemplate is ""): debugGetter = code is not None if debugGetter:
def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False): """ Write a single quick stub (a custom SpiderMonkey getter/setter/method) for the specified XPCOM interface-member. """ isAttr = (member.kind == 'attribute') isMethod = (member.kind == 'method') assert isAttr or isMethod isGetter = isAttr and ...
f.write(" %s = %s->%s(%s);\n" % (nsresultname, selfname, comName, args)) if customMethodCall is not None:
f.write(" ") if canFail or debugGetter: f.write("%s = " % nsresultname) f.write("%s->%s(%s);\n" % (selfname, comName, args)) if debugGetter:
f.write("#ifdef DEBUG\n")
if customMethodCall is not None:
canFail = customMethodCall is None or customMethodCall.get('canFail', True) if canFail and not rvdeclared: f.write(" nsresult rv;\n") rvdeclared = True if customMethodCall is not None and 'code' in customMethodCall:
def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is not N...
if not rvdeclared: f.write(" nsresult rv;\n") rvdeclared = True
def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is not N...
f.write(" %s = %s->%s(%s);\n" % (nsresultname, selfname, comName, args))
f.write(" ") if canFail: f.write("%s = " % nsresultname) f.write("%s->%s(%s);\n" % (selfname, comName, args)) if canFail:
def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is not N...
self.xpcsCmd = [self.xpcshell, '-g', self.xrePath, '-j', '-s'] + \
self.xpcsCmd = [self.xpcshell, '-g', self.xrePath, '-r', self.httpdManifest, '-j', '-s'] + \
def buildXpcsCmd(self, testdir): """ Load the root head.js file as the first file in our test path, before other head, test, and tail files. On a remote system, we overload this to add additional command line arguments, so this gets overloaded. """ # - NOTE: if you rename/add any of the constants set here, update # d...
if flag not in ('-j', '-m', '-d'):
if flag not in ('-j', '-m', '-p', '-d'):
def parse_jitflags(): jitflags = [ [ '-' + flag for flag in flags ] for flags in OPTIONS.jitflags.split(',') ] for flags in jitflags: for flag in flags: if flag not in ('-j', '-m', '-d'): print('Invalid jit flag: "%s"'%flag) sys.exit(1) return jitflags
" if (xpc_GetCachedSlimWrapper(cache, obj, %s)) {\n" " return JS_TRUE;\n"
" if (cache) {\n" " JSObject* wrapper = cache->GetWrapper();\n" " if (wrapper &&\n" " IS_SLIM_WRAPPER_OBJECT(wrapper) &&\n" " xpc_GetGlobalForObject(wrapper) ==\n" " xpc_GetGlobalForObject(obj)) {\n" " *%s = OBJECT_TO_JSVAL(wrapper);\n" " return JS_TRUE;\n" " ...
def writeResultConv(f, type, jsvalPtr, jsvalRef): """ Emit code to convert the C++ variable `result` to a jsval. The emitted code contains a return statement; it returns JS_TRUE on success, JS_FALSE on error. """ # From NativeData2JS. typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = resu...
" JSObject* wrapper =\n" " xpc_GetCachedSlimWrapper(cache, obj, &vp.array[0]);\n" " if (wrapper) {\n" " return wrapper;\n"
" if (cache) {\n" " JSObject* wrapper = cache->GetWrapper();\n" " if (wrapper &&\n" " IS_SLIM_WRAPPER_OBJECT(wrapper) &&\n" " xpc_GetGlobalForObject(wrapper) ==\n" " xpc_GetGlobalForObject(obj)) {\n" " vp.array[0] = OBJECT_TO_JSVAL(wrapper);\n" " return wrapper;...
def writeTraceableResultConv(f, type): typeName = getBuiltinOrNativeTypeName(type) assert typeName is not '[jsval]' if typeName is not None: template = traceableResultConvTemplates.get(typeName) if template is not None: values = { 'errorStr': getFailureString( getTraceInfoDefaultReturn(type), 2) } f.write(substitute(te...
op.add_option('--jitflags', dest='jitflags', default='j', help='Example: --jitflags=j,mj to run each test with -j and -m -j')
op.add_option('--jitflags', dest='jitflags', default='mjp', help='Example: --jitflags=j,mj,mjp to run each test with -j, -m -j, -m -j -p [default=%default]')
def main(argv): global JS, OPTIONS script_path = os.path.abspath(__file__) script_dir = os.path.dirname(script_path) test_dir = os.path.join(script_dir, 'tests') lib_dir = os.path.join(script_dir, 'lib') # The [TESTS] optional arguments are paths of test files relative # to the jit-test/tests directory. from optpars...
def optimizejar(log, jar, outjar): entries = open(log).read().rstrip().split("\n")
def optimizejar(jar, outjar, inlog = None): if inlog is not None: inlog = open(inlog).read().rstrip() if len(inlog) == 0: inlog = [] else: inlog = inlog.split("\n") outlog = []
def optimizejar(log, jar, outjar): entries = open(log).read().rstrip().split("\n") jarblob = BinaryBlob(jar) dirend = jarblob.read_struct(cdir_end, jarblob.length - size_of(cdir_end)) assert_true(dirend.signature == ENDSIG, "no signature in the end"); cdir_offset = dirend.cdir_offset jarblob.offset = cdir_offset cent...
readahead = 0 if inlog is None and cdir_offset == 4: readahead = struct.unpack("<I", jarblob.readAt(0, 4))[0] print("%s: startup data ends at byte %d" % (outjar, readahead));
def optimizejar(log, jar, outjar): entries = open(log).read().rstrip().split("\n") jarblob = BinaryBlob(jar) dirend = jarblob.read_struct(cdir_end, jarblob.length - size_of(cdir_end)) assert_true(dirend.signature == ENDSIG, "no signature in the end"); cdir_offset = dirend.cdir_offset jarblob.offset = cdir_offset cent...
dup_guard = set() for ordered_name in entries: if ordered_name in dup_guard: continue else: dup_guard.add(ordered_name) found = False for i in range(reordered_count, len(central_directory)): if central_directory[i].filename == ordered_name: tmp = central_directory[i] central_directory[i] = central_directory[reordered_...
if inlog is not None: dup_guard = set() for ordered_name in inlog: if ordered_name in dup_guard: continue else: dup_guard.add(ordered_name) found = False for i in range(reordered_count, len(central_directory)): if central_directory[i].filename == ordered_name: tmp = central_directory[i] central_directory[i] = central_...
def optimizejar(log, jar, outjar): entries = open(log).read().rstrip().split("\n") jarblob = BinaryBlob(jar) dirend = jarblob.read_struct(cdir_end, jarblob.length - size_of(cdir_end)) assert_true(dirend.signature == ENDSIG, "no signature in the end"); cdir_offset = dirend.cdir_offset jarblob.offset = cdir_offset cent...
out_offset = dirend.cdir_offset + dirend.cdir_size + len(dirend_data) outfd.seek(out_offset)
out_offset = 0 if inlog is not None: dirend.cdir_offset = 4 out_offset = dirend.cdir_offset + dirend.cdir_size + size_of(cdir_end) outfd.seek(out_offset)
def optimizejar(log, jar, outjar): entries = open(log).read().rstrip().split("\n") jarblob = BinaryBlob(jar) dirend = jarblob.read_struct(cdir_end, jarblob.length - size_of(cdir_end)) assert_true(dirend.signature == ENDSIG, "no signature in the end"); cdir_offset = dirend.cdir_offset jarblob.offset = cdir_offset cent...
if written_count == reordered_count: print("%s: startup data ends at byte %d"%( outjar, out_offset)); elif written_count < reordered_count: print("%s @ %d" % (entry.filename, entry.offset))
if inlog is not None: if written_count == reordered_count: readahead = out_offset print("%s: startup data ends at byte %d"%( outjar, readahead)); elif written_count < reordered_count: pass elif readahead >= old_entry_offset + len(data): outlog.append(entry.filename) reordered_count += 1 if inlog is None: dirend.cdir_...
def optimizejar(log, jar, outjar): entries = open(log).read().rstrip().split("\n") jarblob = BinaryBlob(jar) dirend = jarblob.read_struct(cdir_end, jarblob.length - size_of(cdir_end)) assert_true(dirend.signature == ENDSIG, "no signature in the end"); cdir_offset = dirend.cdir_offset jarblob.offset = cdir_offset cent...
outfd.write(dirend_data)
def optimizejar(log, jar, outjar): entries = open(log).read().rstrip().split("\n") jarblob = BinaryBlob(jar) dirend = jarblob.read_struct(cdir_end, jarblob.length - size_of(cdir_end)) assert_true(dirend.signature == ENDSIG, "no signature in the end"); cdir_offset = dirend.cdir_offset jarblob.offset = cdir_offset cent...
print "Ordered %d/%d in %s" % (reordered_count, len(central_directory), outjar) if len(sys.argv) != 4: print "Usage: %s JAR_LOG_DIR IN_JAR_DIR OUT_JAR_DIR" % sys.argv[0]
return outlog if len(sys.argv) != 5: print "Usage: --optimize|--deoptimize %s JAR_LOG_DIR IN_JAR_DIR OUT_JAR_DIR" % sys.argv[0]
def optimizejar(log, jar, outjar): entries = open(log).read().rstrip().split("\n") jarblob = BinaryBlob(jar) dirend = jarblob.read_struct(cdir_end, jarblob.length - size_of(cdir_end)) assert_true(dirend.signature == ENDSIG, "no signature in the end"); cdir_offset = dirend.cdir_offset jarblob.offset = cdir_offset cent...
JAR_LOG_DIR = sys.argv[1] IN_JAR_DIR = sys.argv[2] OUT_JAR_DIR = sys.argv[3] if not os.path.exists(JAR_LOG_DIR): print "No jar logs found. No jars to optimize." exit(0) ls = os.listdir(JAR_LOG_DIR) for logfile in ls: if logfile[-8:] != ".jar.log": continue injarfile = os.path.join(IN_JAR_DIR, logfile[:-4]) outjarfile...
def optimize(JAR_LOG_DIR, IN_JAR_DIR, OUT_JAR_DIR): if not os.path.exists(JAR_LOG_DIR): print("No jar logs found in %s. No jars to optimize." % JAR_LOG_DIR) exit(0) ls = os.listdir(JAR_LOG_DIR) for logfile in ls: if not logfile.endswith(".jar.log"): continue injarfile = os.path.join(IN_JAR_DIR, logfile[:-4]) outjarfil...
def optimizejar(log, jar, outjar): entries = open(log).read().rstrip().split("\n") jarblob = BinaryBlob(jar) dirend = jarblob.read_struct(cdir_end, jarblob.length - size_of(cdir_end)) assert_true(dirend.signature == ENDSIG, "no signature in the end"); cdir_offset = dirend.cdir_offset jarblob.offset = cdir_offset cent...
COMPILE_ASSERT(LastMsgIndex <= 64, need_to_update_IPC_MESSAGE_MACRO);
COMPILE_ASSERT(LastMsgIndex <= 65536, need_to_update_IPC_MESSAGE_MACRO);
#ifndef IPCMessageStart_h