diff options
35 files changed, 625 insertions, 351 deletions
@@ -105,4 +105,5 @@ a license to everyone to use it as detailed in LICENSE.) * Remi Papillie <remi.papillie@gmail.com> * Fraser Adams <fraser.adams@blueyonder.co.uk> * Michael Tirado <icetooth333@gmail.com> +* Ben Noordhuis <info@bnoordhuis.nl> diff --git a/CONTRIBUTING.markdown b/CONTRIBUTING.markdown new file mode 100644 index 00000000..ceea8735 --- /dev/null +++ b/CONTRIBUTING.markdown @@ -0,0 +1,5 @@ + +See our wiki for information about contributing to Emscripten: + +[Contribution section on wiki](https://github.com/kripken/emscripten/wiki#contributing) + @@ -777,6 +777,7 @@ try: save_bc = False memory_init_file = False use_preload_cache = False + no_heap_copy = False proxy_to_worker = False if use_cxx: @@ -897,6 +898,9 @@ try: elif newargs[i].startswith('--use-preload-cache'): use_preload_cache = True newargs[i] = '' + elif newargs[i].startswith('--no-heap-copy'): + no_heap_copy = True + newargs[i] = '' elif newargs[i] == '--ignore-dynamic-linking': ignore_dynamic_linking = True newargs[i] = '' @@ -1667,6 +1671,8 @@ try: file_args += ['--compress', Compression.encoder, Compression.decoder, Compression.js_name] if use_preload_cache: file_args.append('--use-preload-cache') + if no_heap_copy: + file_args.append('--no-heap-copy') file_code = execute([shared.PYTHON, shared.FILE_PACKAGER, unsuffixed(target) + '.data'] + file_args, stdout=PIPE)[0] pre_js = file_code + pre_js diff --git a/emscripten.py b/emscripten.py index dbea6eb2..5576baba 100755 --- a/emscripten.py +++ b/emscripten.py @@ -578,7 +578,7 @@ var asm = (function(global, env, buffer) { var HEAPU32 = new global.Uint32Array(buffer); var HEAPF32 = new global.Float32Array(buffer); var HEAPF64 = new global.Float64Array(buffer); -''' % (asm_setup, "'use asm';" if not forwarded_json['Types']['hasInlineJS'] and not settings['SIDE_MODULE'] else "'almost asm';") + '\n' + asm_global_vars + ''' +''' % (asm_setup, "'use asm';" if not forwarded_json['Types']['hasInlineJS'] and not settings['SIDE_MODULE'] and settings['ASM_JS'] == 1 else "'almost asm';") + '\n' + asm_global_vars + ''' var __THREW__ = 0; var threwValue = 0; var setjmpId = 0; diff --git a/src/analyzer.js b/src/analyzer.js index 2b74a83f..253c5505 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -418,7 +418,7 @@ function analyzer(data, sidePass) { toAdd.push({ intertype: 'value', assignTo: element.ident, - type: element.bits, + type: 'i' + element.bits, ident: 'tempRet' + (j - 1) }); assert(j<10); // TODO: dynamically create more than 10 tempRet-s diff --git a/src/intertyper.js b/src/intertyper.js index d3640889..fceeb38d 100644 --- a/src/intertyper.js +++ b/src/intertyper.js @@ -682,7 +682,7 @@ function intertyper(lines, sidePass, baseLineNums) { } if (item.assignTo) item.ident = 'return ' + item.ident; item.ident = '(function(' + params + ') { ' + item.ident + ' })(' + args + ');'; - return { forward: null, ret: item, item: item }; + return { ret: item, item: item }; } if (item.ident.substr(-2) == '()') { // See comment in isStructType() @@ -705,13 +705,12 @@ function intertyper(lines, sidePass, baseLineNums) { if (item.indent == 2) { // standalone call - not in assign item.standalone = true; - return { forward: null, ret: item, item: item }; + return { ret: item, item: item }; } - return { forward: item, ret: null, item: item }; + return { ret: null, item: item }; } function callHandler(item) { var result = makeCall.call(this, item, 'call'); - if (result.forward) this.forwardItem(result.forward, 'Reintegrator'); return result.ret; } function invokeHandler(item) { @@ -721,10 +720,9 @@ function intertyper(lines, sidePass, baseLineNums) { finalResults.push({ intertype: 'branch', label: result.item.toLabel, - lineNum: (result.forward ? item.parentLineNum : item.lineNum) + 0.5 + lineNum: item.lineNum + 0.5 }); } - if (result.forward) this.forwardItem(result.forward, 'Reintegrator'); return result.ret; } function atomicHandler(item) { diff --git a/src/jsifier.js b/src/jsifier.js index ec7ad1c2..0da48a8c 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -953,7 +953,7 @@ function JSify(data, functionsOnly, givenFunctions) { return '(' + makeSetValue(item.ident, 0, value + '.x', native, 0, 0, item.align) + ',' + makeSetValue(item.ident, 4, value + '.y', native, 0, 0, item.align) + ',' + makeSetValue(item.ident, 8, value + '.z', native, 0, 0, item.align) + ',' + - makeSetValue(item.ident, 12, value + '.w', native, 0, 0, item.align) + ')'; + makeSetValue(item.ident, 12, value + '.w', native, 0, 0, item.align) + ');'; } switch (impl) { case VAR_NATIVIZED: @@ -1329,7 +1329,7 @@ function JSify(data, functionsOnly, givenFunctions) { return base + '32x4(' + makeGetValue(value, 0, native, 0, item.unsigned, 0, item.align) + ',' + makeGetValue(value, 4, native, 0, item.unsigned, 0, item.align) + ',' + makeGetValue(value, 8, native, 0, item.unsigned, 0, item.align) + ',' + - makeGetValue(value, 12, native, 0, item.unsigned, 0, item.align) + ')'; + makeGetValue(value, 12, native, 0, item.unsigned, 0, item.align) + ');'; } var impl = item.ident ? getVarImpl(item.funcData, item.ident) : VAR_EMULATED; switch (impl) { @@ -1491,7 +1491,7 @@ function JSify(data, functionsOnly, givenFunctions) { } params.forEach(function(param, i) { - var val = finalizeParam(param); + var val = finalizeLLVMParameter(param); if (!hasVarArgs || useJSArgs || i < normalArgs) { args.push(val); argsTypes.push(param.type); diff --git a/src/library.js b/src/library.js index 6eab2587..501f766c 100644 --- a/src/library.js +++ b/src/library.js @@ -1602,12 +1602,12 @@ LibraryManager.library = { if (format.indexOf('%n') >= 0) { // need to track soFar var _get = get; - get = function() { + get = function get() { soFar++; return _get(); } var _unget = unget; - unget = function() { + unget = function unget() { soFar--; return _unget(); } @@ -2755,12 +2755,12 @@ LibraryManager.library = { return -1; } var buffer = []; - var get = function() { + function get() { var c = _fgetc(stream); buffer.push(c); return c; }; - var unget = function() { + function unget() { _ungetc(buffer.pop(), stream); }; return __scanString(format, get, unget, varargs); @@ -2777,8 +2777,8 @@ LibraryManager.library = { // int sscanf(const char *restrict s, const char *restrict format, ... ); // http://pubs.opengroup.org/onlinepubs/000095399/functions/scanf.html var index = 0; - var get = function() { return {{{ makeGetValue('s', 'index++', 'i8') }}}; }; - var unget = function() { index--; }; + function get() { return {{{ makeGetValue('s', 'index++', 'i8') }}}; }; + function unget() { index--; }; return __scanString(format, get, unget, varargs); }, snprintf__deps: ['_formatString'], @@ -3040,7 +3040,7 @@ LibraryManager.library = { }, bsearch: function(key, base, num, size, compar) { - var cmp = function(x, y) { + function cmp(x, y) { #if ASM_JS return Module['dynCall_iii'](compar, x, y); #else @@ -5108,7 +5108,7 @@ LibraryManager.library = { table[from + i] = {}; sigs.forEach(function(sig) { // TODO: new Function etc. var full = 'dynCall_' + sig; - table[from + i][sig] = function() { + table[from + i][sig] = function dynCall_sig() { arguments[0] -= from; return asm[full].apply(null, arguments); } @@ -5132,7 +5132,7 @@ LibraryManager.library = { // patch js module dynCall_* to use functionTable sigs.forEach(function(sig) { - jsModule['dynCall_' + sig] = function() { + jsModule['dynCall_' + sig] = function dynCall_sig() { return table[arguments[0]][sig].apply(null, arguments); }; }); @@ -5295,6 +5295,16 @@ LibraryManager.library = { } }, + dladdr: function(addr, info) { + // report all function pointers as coming from this program itself XXX not really correct in any way + var fname = allocate(intArrayFromString("/bin/this.program"), 'i8', ALLOC_NORMAL); // XXX leak + {{{ makeSetValue('addr', 0, 'fname', 'i32') }}}; + {{{ makeSetValue('addr', QUANTUM_SIZE, '0', 'i32') }}}; + {{{ makeSetValue('addr', QUANTUM_SIZE*2, '0', 'i32') }}}; + {{{ makeSetValue('addr', QUANTUM_SIZE*3, '0', 'i32') }}}; + return 1; + }, + // ========================================================================== // pwd.h // ========================================================================== @@ -5596,7 +5606,7 @@ LibraryManager.library = { var WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; var MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; - var leadingSomething = function(value, digits, character) { + function leadingSomething(value, digits, character) { var str = typeof value === 'number' ? value.toString() : (value || ''); while (str.length < digits) { str = character[0]+str; @@ -5604,12 +5614,12 @@ LibraryManager.library = { return str; }; - var leadingNulls = function(value, digits) { + function leadingNulls(value, digits) { return leadingSomething(value, digits, '0'); }; - var compareByDay = function(date1, date2) { - var sgn = function(value) { + function compareByDay(date1, date2) { + function sgn(value) { return value < 0 ? -1 : (value > 0 ? 1 : 0); }; @@ -5622,7 +5632,7 @@ LibraryManager.library = { return compare; }; - var getFirstWeekStartDate = function(janFourth) { + function getFirstWeekStartDate(janFourth) { switch (janFourth.getDay()) { case 0: // Sunday return new Date(janFourth.getFullYear()-1, 11, 29); @@ -5641,7 +5651,7 @@ LibraryManager.library = { } }; - var getWeekBasedYear = function(date) { + function getWeekBasedYear(date) { var thisDate = __addDays(new Date(date.tm_year+1900, 0, 1), date.tm_yday); var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4); @@ -5928,8 +5938,8 @@ LibraryManager.library = { var matches = new RegExp('^'+pattern).exec(Pointer_stringify(buf)) // Module['print'](Pointer_stringify(buf)+ ' is matched by '+((new RegExp('^'+pattern)).source)+' into: '+JSON.stringify(matches)); - var initDate = function() { - var fixup = function(value, min, max) { + function initDate() { + function fixup(value, min, max) { return (typeof value !== 'number' || isNaN(value)) ? min : (value>=min ? (value<=max ? value: max): min); }; return { @@ -5946,7 +5956,7 @@ LibraryManager.library = { var date = initDate(); var value; - var getMatch = function(symbol) { + function getMatch(symbol) { var pos = capture.indexOf(symbol); // check if symbol appears in regexp if (pos >= 0) { @@ -6876,6 +6886,10 @@ LibraryManager.library = { pthread_mutex_trylock: function() { return 0; }, + pthread_mutexattr_setpshared: function(attr, pshared) { + // XXX implement if/when getpshared is required + return 0; + }, pthread_cond_init: function() {}, pthread_cond_destroy: function() {}, pthread_cond_broadcast: function() { @@ -6971,6 +6985,10 @@ LibraryManager.library = { _pthread_cleanup_push.level = __ATEXIT__.length; }, + pthread_rwlock_init: function() { + return 0; // XXX + }, + // ========================================================================== // malloc.h // ========================================================================== @@ -7681,7 +7699,7 @@ LibraryManager.library = { var session = Module['webrtc']['session']; var peer = new Peer(broker); var listenOptions = Module['webrtc']['hostOptions'] || {}; - peer.onconnection = function(connection) { + peer.onconnection = function peer_onconnection(connection) { console.log('connected'); var addr; /* If this peer is connecting to the host, assign 10.0.0.1 to the host so it can be @@ -7695,7 +7713,7 @@ LibraryManager.library = { } connection['addr'] = addr; Sockets.connections[addr] = connection; - connection.ondisconnect = function() { + connection.ondisconnect = function connection_ondisconnect() { console.log('disconnect'); // Don't return the host address (10.0.0.1) to the pool if (!(session && session === Sockets.connections[addr]['route'])) { @@ -7707,12 +7725,12 @@ LibraryManager.library = { Module['webrtc']['ondisconnect'](peer); } }; - connection.onerror = function(error) { + connection.onerror = function connection_onerror(error) { if (Module['webrtc']['onerror'] && 'function' === typeof Module['webrtc']['onerror']) { Module['webrtc']['onerror'](error); } }; - connection.onmessage = function(label, message) { + connection.onmessage = function connection_onmessage(label, message) { if ('unreliable' === label) { handleMessage(addr, message.data); } @@ -7722,13 +7740,13 @@ LibraryManager.library = { Module['webrtc']['onconnect'](peer); } }; - peer.onpending = function(pending) { + peer.onpending = function peer_onpending(pending) { console.log('pending from: ', pending['route'], '; initiated by: ', (pending['incoming']) ? 'remote' : 'local'); }; - peer.onerror = function(error) { + peer.onerror = function peer_onerror(error) { console.error(error); }; - peer.onroute = function(route) { + peer.onroute = function peer_onroute(route) { if (Module['webrtc']['onpeer'] && 'function' === typeof Module['webrtc']['onpeer']) { Module['webrtc']['onpeer'](peer, route); } @@ -7744,7 +7762,7 @@ LibraryManager.library = { console.log("unable to deliver message: ", addr, header[1], message); } } - window.onbeforeunload = function() { + window.onbeforeunload = function window_onbeforeunload() { var ids = Object.keys(Sockets.connections); ids.forEach(function(id) { Sockets.connections[id].close(); @@ -7813,7 +7831,7 @@ LibraryManager.library = { } info.addr = Sockets.localAddr; // 10.0.0.254 info.host = __inet_ntop4_raw(info.addr); - info.close = function() { + info.close = function info_close() { Sockets.portmap[info.port] = undefined; } Sockets.portmap[info.port] = info; @@ -8545,7 +8563,13 @@ LibraryManager.library = { return -1; } var arg = {{{ makeGetValue('varargs', '0', 'i32') }}}; - return FS.ioctl(stream, request, arg); + + try { + return FS.ioctl(stream, request, arg); + } catch (e) { + FS.handleFSError(e); + return -1; + } }, #endif @@ -8578,7 +8602,7 @@ LibraryManager.library = { }, emscripten_run_script_string: function(ptr) { - var s = eval(Pointer_stringify(ptr)); + var s = eval(Pointer_stringify(ptr)) + ''; var me = _emscripten_run_script_string; if (!me.bufferSize || me.bufferSize < s.length+1) { if (me.bufferSize) _free(me.buffer); @@ -8621,6 +8645,14 @@ LibraryManager.library = { }, //============================ + // emscripten vector ops + //============================ + + emscripten_float32x4_signmask__inline: function(x) { + return x + '.signMask()'; + }, + + //============================ // i64 math //============================ @@ -8716,6 +8748,6 @@ function autoAddDeps(object, name) { // Add aborting stubs for various libc stuff needed by libc++ ['pthread_cond_signal', 'pthread_equal', 'wcstol', 'wcstoll', 'wcstoul', 'wcstoull', 'wcstof', 'wcstod', 'wcstold', 'pthread_join', 'pthread_detach', 'catgets', 'catopen', 'catclose', 'fputwc', '__lockfile', '__unlockfile'].forEach(function(aborter) { - LibraryManager.library[aborter] = function() { throw 'TODO: ' + aborter }; + LibraryManager.library[aborter] = function aborting_stub() { throw 'TODO: ' + aborter }; }); diff --git a/src/library_browser.js b/src/library_browser.js index 59d2945e..b70dbc84 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -4,12 +4,12 @@ mergeInto(LibraryManager.library, { $Browser__deps: ['$PATH'], - $Browser__postset: 'Module["requestFullScreen"] = function(lockPointer, resizeCanvas) { Browser.requestFullScreen(lockPointer, resizeCanvas) };\n' + // exports - 'Module["requestAnimationFrame"] = function(func) { Browser.requestAnimationFrame(func) };\n' + - 'Module["setCanvasSize"] = function(width, height, noUpdates) { Browser.setCanvasSize(width, height, noUpdates) };\n' + - 'Module["pauseMainLoop"] = function() { Browser.mainLoop.pause() };\n' + - 'Module["resumeMainLoop"] = function() { Browser.mainLoop.resume() };\n' + - 'Module["getUserMedia"] = function() { Browser.getUserMedia() }', + $Browser__postset: 'Module["requestFullScreen"] = function Module_requestFullScreen(lockPointer, resizeCanvas) { Browser.requestFullScreen(lockPointer, resizeCanvas) };\n' + // exports + 'Module["requestAnimationFrame"] = function Module_requestAnimationFrame(func) { Browser.requestAnimationFrame(func) };\n' + + 'Module["setCanvasSize"] = function Module_setCanvasSize(width, height, noUpdates) { Browser.setCanvasSize(width, height, noUpdates) };\n' + + 'Module["pauseMainLoop"] = function Module_pauseMainLoop() { Browser.mainLoop.pause() };\n' + + 'Module["resumeMainLoop"] = function Module_resumeMainLoop() { Browser.mainLoop.resume() };\n' + + 'Module["getUserMedia"] = function Module_getUserMedia() { Browser.getUserMedia() }', $Browser: { mainLoop: { scheduler: null, @@ -77,10 +77,10 @@ mergeInto(LibraryManager.library, { // might create some side data structure for use later (like an Image element, etc.). var imagePlugin = {}; - imagePlugin['canHandle'] = function(name) { + imagePlugin['canHandle'] = function imagePlugin_canHandle(name) { return !Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/i.test(name); }; - imagePlugin['handle'] = function(byteArray, name, onload, onerror) { + imagePlugin['handle'] = function imagePlugin_handle(byteArray, name, onload, onerror) { var b = null; if (Browser.hasBlobConstructor) { try { @@ -103,7 +103,7 @@ mergeInto(LibraryManager.library, { assert(typeof url == 'string', 'createObjectURL must return a url as a string'); #endif var img = new Image(); - img.onload = function() { + img.onload = function img_onload() { assert(img.complete, 'Image ' + name + ' could not be decoded'); var canvas = document.createElement('canvas'); canvas.width = img.width; @@ -114,7 +114,7 @@ mergeInto(LibraryManager.library, { Browser.URLObject.revokeObjectURL(url); if (onload) onload(byteArray); }; - img.onerror = function(event) { + img.onerror = function img_onerror(event) { console.log('Image ' + url + ' could not be decoded'); if (onerror) onerror(); }; @@ -123,10 +123,10 @@ mergeInto(LibraryManager.library, { Module['preloadPlugins'].push(imagePlugin); var audioPlugin = {}; - audioPlugin['canHandle'] = function(name) { + audioPlugin['canHandle'] = function audioPlugin_canHandle(name) { return !Module.noAudioDecoding && name.substr(-4) in { '.ogg': 1, '.wav': 1, '.mp3': 1 }; }; - audioPlugin['handle'] = function(byteArray, name, onload, onerror) { + audioPlugin['handle'] = function audioPlugin_handle(byteArray, name, onload, onerror) { var done = false; function finish(audio) { if (done) return; @@ -152,7 +152,7 @@ mergeInto(LibraryManager.library, { #endif var audio = new Audio(); audio.addEventListener('canplaythrough', function() { finish(audio) }, false); // use addEventListener due to chromium bug 124926 - audio.onerror = function(event) { + audio.onerror = function audio_onerror(event) { if (done) return; console.log('warning: browser could not fully decode audio ' + name + ', trying slower base64 approach'); function encode64(data) { @@ -268,7 +268,7 @@ mergeInto(LibraryManager.library, { (function(prop) { switch (typeof tempCtx[prop]) { case 'function': { - wrapper[prop] = function() { + wrapper[prop] = function gl_wrapper() { if (GL.debug) { var printArgs = Array.prototype.slice.call(arguments).map(Runtime.prettyPrint); Module.printErr('[gl_f:' + prop + ':' + printArgs + ']'); @@ -360,15 +360,19 @@ mergeInto(LibraryManager.library, { }, requestAnimationFrame: function(func) { - if (!window.requestAnimationFrame) { - window.requestAnimationFrame = window['requestAnimationFrame'] || - window['mozRequestAnimationFrame'] || - window['webkitRequestAnimationFrame'] || - window['msRequestAnimationFrame'] || - window['oRequestAnimationFrame'] || - window['setTimeout']; + if (typeof window === 'undefined') { // Provide fallback to setTimeout if window is undefined (e.g. in Node.js) + setTimeout(func, 1000/60); + } else { + if (!window.requestAnimationFrame) { + window.requestAnimationFrame = window['requestAnimationFrame'] || + window['mozRequestAnimationFrame'] || + window['webkitRequestAnimationFrame'] || + window['msRequestAnimationFrame'] || + window['oRequestAnimationFrame'] || + window['setTimeout']; + } + window.requestAnimationFrame(func); } - window.requestAnimationFrame(func); }, // generic abort-aware wrapper for an async callback @@ -497,7 +501,7 @@ mergeInto(LibraryManager.library, { var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.responseType = 'arraybuffer'; - xhr.onload = function() { + xhr.onload = function xhr_onload() { if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0 onload(xhr.response); } else { @@ -610,7 +614,7 @@ mergeInto(LibraryManager.library, { http.responseType = 'arraybuffer'; // LOAD - http.onload = function(e) { + http.onload = function http_onload(e) { if (http.status == 200) { FS.createDataFile( _file.substr(0, index), _file.substr(index + 1), new Uint8Array(http.response), true, true); if (onload) Runtime.dynCall('vii', onload, [arg, file]); @@ -620,12 +624,12 @@ mergeInto(LibraryManager.library, { }; // ERROR - http.onerror = function(e) { + http.onerror = function http_onerror(e) { if (onerror) Runtime.dynCall('vii', onerror, [arg, http.status]); }; // PROGRESS - http.onprogress = function(e) { + http.onprogress = function http_onprogress(e) { var percentComplete = (e.position / e.totalSize)*100; if (onprogress) Runtime.dynCall('vii', onprogress, [arg, percentComplete]); }; @@ -705,7 +709,7 @@ mergeInto(LibraryManager.library, { assert(runDependencies === 0, 'async_load_script must be run when no other dependencies are active'); var script = document.createElement('script'); - script.onload = function() { + script.onload = function script_onload() { if (runDependencies > 0) { dependenciesFulfilled = onload; } else { @@ -720,7 +724,7 @@ mergeInto(LibraryManager.library, { emscripten_set_main_loop: function(func, fps, simulateInfiniteLoop) { Module['noExitRuntime'] = true; - Browser.mainLoop.runner = function() { + Browser.mainLoop.runner = function Browser_mainLoop_runner() { if (ABORT) return; if (Browser.mainLoop.queue.length > 0) { var start = Date.now(); @@ -777,11 +781,11 @@ mergeInto(LibraryManager.library, { Browser.mainLoop.scheduler(); } if (fps && fps > 0) { - Browser.mainLoop.scheduler = function() { + Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler() { setTimeout(Browser.mainLoop.runner, 1000/fps); // doing this each time means that on exception, we stop } } else { - Browser.mainLoop.scheduler = function() { + Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler() { Browser.requestAnimationFrame(Browser.mainLoop.runner); } } @@ -870,14 +874,14 @@ mergeInto(LibraryManager.library, { emscripten_get_now: function() { if (!_emscripten_get_now.actual) { if (ENVIRONMENT_IS_NODE) { - _emscripten_get_now.actual = function() { + _emscripten_get_now.actual = function _emscripten_get_now_actual() { var t = process['hrtime'](); return t[0] * 1e3 + t[1] / 1e6; } } else if (typeof dateNow !== 'undefined') { _emscripten_get_now.actual = dateNow; } else if (ENVIRONMENT_IS_WEB && window['performance'] && window['performance']['now']) { - _emscripten_get_now.actual = function() { return window['performance']['now'](); }; + _emscripten_get_now.actual = function _emscripten_get_now_actual() { return window['performance']['now'](); }; } else { _emscripten_get_now.actual = Date.now; } @@ -895,7 +899,7 @@ mergeInto(LibraryManager.library, { buffer: 0, bufferSize: 0 }; - info.worker.onmessage = function(msg) { + info.worker.onmessage = function info_worker_onmessage(msg) { var info = Browser.workers[id]; if (!info) return; // worker was destroyed meanwhile var callbackId = msg.data['callbackId']; diff --git a/src/library_fs.js b/src/library_fs.js index aece2664..5412185f 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -361,9 +361,10 @@ mergeInto(LibraryManager.library, { // SOCKFS is completed. createStream: function(stream, fd_start, fd_end) { if (!FS.FSStream) { - FS.FSStream = {}; + FS.FSStream = function(){}; + FS.FSStream.prototype = {}; // compatibility - Object.defineProperties(FS.FSStream, { + Object.defineProperties(FS.FSStream.prototype, { object |