aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 6b831b04..8de20c80 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -6,7 +6,6 @@
// Handy sets
var STRUCT_LIST = set('struct', 'list');
-var UNDERSCORE_OPENPARENS = set('_', '(');
var RELOOP_IGNORED_LASTS = set('return', 'unreachable', 'resume');
var addedLibraryItems = {};
@@ -19,7 +18,7 @@ var INDENTATION = ' ';
var functionStubSigs = {};
// JSifier
-function JSify(data, functionsOnly, givenFunctions) {
+function JSify(data, functionsOnly) {
//B.start('jsifier');
var mainPass = !functionsOnly;
@@ -96,19 +95,6 @@ function JSify(data, functionsOnly, givenFunctions) {
// Functions
- Functions.currExternalFunctions = !mainPass ? givenFunctions.currExternalFunctions : {};
-
- data.functionStubs.forEach(function(func) {
- // Don't overwrite stubs that have more info.
- if (!Functions.currExternalFunctions.hasOwnProperty(func.ident) ||
- !Functions.currExternalFunctions[func.ident].numParams === undefined) {
- Functions.currExternalFunctions[func.ident] = {
- hasVarArgs: func.hasVarArgs,
- numParams: func.params && func.params.length
- };
- }
- });
-
if (phase == 'funcs') { // || phase == 'pre') { // pre has function shells, just to defined implementedFunctions
var MAX_BATCH_FUNC_LINES = 1000;
while (data.unparsedFunctions.length > 0) {
@@ -123,7 +109,7 @@ function JSify(data, functionsOnly, givenFunctions) {
dprint('unparsedFunctions','====================\n// Processing function batch of ' + currBaseLineNums.length +
' functions, ' + currFuncLines.length + ' lines, functions left: ' + data.unparsedFunctions.length);
if (DEBUG_MEMORY) MemoryDebugger.tick('pre-func');
- JSify(analyzer(intertyper(currFuncLines, true, currBaseLineNums), true), true, Functions);
+ JSify(analyzer(intertyper(currFuncLines, true, currBaseLineNums), true), true);
if (DEBUG_MEMORY) MemoryDebugger.tick('post-func');
}
currFuncLines = currBaseLineNums = null; // Do not hold on to anything from inside that loop (JS function scoping..)
@@ -639,8 +625,8 @@ function JSify(data, functionsOnly, givenFunctions) {
}
}
- if (CLOSURE_ANNOTATIONS) func.JS += '/** @type {number} */';
if (!ASM_JS) {
+ if (CLOSURE_ANNOTATIONS) func.JS += '/** @type {number} */';
func.JS += INDENTATION + 'var label=0;\n';
}
@@ -892,8 +878,8 @@ function JSify(data, functionsOnly, givenFunctions) {
function makeAssign(item) {
var valueJS = item.JS;
item.JS = '';
- if (CLOSURE_ANNOTATIONS) item.JS += '/** @type {number} */ ';
if (!ASM_JS || item.intertype != 'alloca' || item.funcData.variables[item.assignTo].impl == VAR_EMULATED) { // asm only needs non-allocas
+ if (CLOSURE_ANNOTATIONS) item.JS += '/** @type {number} */ ';
item.JS += ((ASM_JS || item.overrideSSA) ? '' : 'var ') + toNiceIdent(item.assignTo);
}
var value = parseNumerical(valueJS);
@@ -1810,7 +1796,7 @@ function JSify(data, functionsOnly, givenFunctions) {
}
});
}
- JSify(globalsData, true, Functions);
+ JSify(globalsData, true);
globalsData = null;
data.unparsedGlobalss = null;
@@ -1824,7 +1810,7 @@ function JSify(data, functionsOnly, givenFunctions) {
print('staticSealed = true; // seal the static portion of memory\n');
print('STACK_MAX = STACK_BASE + ' + TOTAL_STACK + ';\n');
print('DYNAMIC_BASE = DYNAMICTOP = Runtime.alignMemory(STACK_MAX);\n');
- print('assert(DYNAMIC_BASE < TOTAL_MEMORY); // Stack must fit in TOTAL_MEMORY; allocations from here on may enlarge TOTAL_MEMORY\n');
+ print('assert(DYNAMIC_BASE < TOTAL_MEMORY, "TOTAL_MEMORY not big enough for stack");\n');
}
if (asmLibraryFunctions.length > 0) {