diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-04-02 13:20:20 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-04-02 13:20:20 -0700 |
commit | d061071c37db687389e2f8aad64741d1ce9a2ad0 (patch) | |
tree | 9d075504e06bb0bbc539b96aa4b2b39251408604 /src/jsifier.js | |
parent | 1823aaf13bfbbc3cbbe6c8dc9ff153361f0bcf4a (diff) |
only include i64 precise code if it will actually be used
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index dcc853f2..8caab6e2 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -38,7 +38,6 @@ function JSify(data, functionsOnly, givenFunctions) { var preFile = BUILD_AS_SHARED_LIB ? 'preamble_sharedlib.js' : 'preamble.js'; var pre = processMacros(preprocess(read(preFile).replace('{{RUNTIME}}', getRuntime()))); print(pre); - if (PRECISE_I64_MATH) print(read('long.js')); Functions.implementedFunctions = set(data.unparsedFunctions.map(function(func) { return func.ident })); } @@ -1200,6 +1199,12 @@ function JSify(data, functionsOnly, givenFunctions) { // This is the main pass. Print out the generated code that we have here, together with the // rest of the output that we started to print out earlier (see comment on the // "Final shape that will be created"). + if (PRECISE_I64_MATH && preciseI64MathUsed) { + print(read('long.js')); + } else { + print('// Warning: printing of i64 values may be slightly rounded! No deep i64 math used, so precise i64 code not included'); + print('var i64Math = null;'); + } var generated = itemsDict.functionStub.concat(itemsDict.GlobalVariablePostSet); generated.forEach(function(item) { print(indentify(item.JS || '', 2)); }); if (RUNTIME_TYPE_INFO) { |