diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-12-13 14:43:40 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-12-13 14:43:40 -0800 |
commit | 2e55061621e16964e244906c3236797408aee119 (patch) | |
tree | 676342deb4e9562880527556e8dcccd6ee0c637a /src/jsifier.js | |
parent | c4978b6c248bc076850743df2ba6b9a6d9af24bb (diff) |
emit numeric constants for global variables, using our knowledge of the fixed value of GLOBAL_BASE
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 5cea1dfa..7568c088 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1353,12 +1353,11 @@ function JSify(data, functionsOnly, givenFunctions) { if (phase == 'pre' && !Variables.generatedGlobalBase) { Variables.generatedGlobalBase = true; if (Variables.nextIndexedOffset > 0) { - // Variables have been calculated, get to base generation before we print them - print('var GLOBAL_BASE = STATICTOP; assert(GLOBAL_BASE == STACK_MAX); \n'); + // Variables have been calculated, get to base stuff before we print them + // GLOBAL_BASE is statically known to be equal to STACK_MAX and to TOTAL_STACK, assert on this + print('assert(STATICTOP == STACK_MAX); assert(STACK_MAX == TOTAL_STACK);\n'); print('STATICTOP += ' + Variables.nextIndexedOffset + ';\n'); print('assert(STATICTOP < TOTAL_MEMORY);\n'); - } else { - print('var GLOBAL_BASE = 0;\n'); } } var generated = itemsDict.function.concat(itemsDict.type).concat(itemsDict.GlobalVariableStub).concat(itemsDict.GlobalVariable).concat(itemsDict.GlobalVariablePostSet); |