diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-11-05 12:24:46 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-11-06 10:26:10 -0800 |
commit | 33cdfe5819e789cb9a98b8b7f66447ceab861f84 (patch) | |
tree | 602ae78dc7437a1cd3d87b6bb46dcb598416d9e6 /src/compiler.js | |
parent | 13b82208767b3af7a8716356c07b6eac26da5ac3 (diff) |
split js compiler into three passes, to facilitate future parallization
Diffstat (limited to 'src/compiler.js')
-rw-r--r-- | src/compiler.js | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/compiler.js b/src/compiler.js index e589646b..3220c977 100644 --- a/src/compiler.js +++ b/src/compiler.js @@ -129,7 +129,13 @@ load('settings.js'); var settings_file = arguments_[0]; var ll_file = arguments_[1]; -additionalLibraries = Array.prototype.slice.call(arguments_, 2); +phase = arguments_[2]; +if (phase == 'pre') { + additionalLibraries = Array.prototype.slice.call(arguments_, 3); +} else { + var forwardedDataFile = arguments_[3]; + additionalLibraries = Array.prototype.slice.call(arguments_, 4); +} if (settings_file) { var settings = JSON.parse(read(settings_file)); @@ -191,6 +197,15 @@ load('jsifier.js'); globalEval(processMacros(preprocess(read('runtime.js')))); Runtime.QUANTUM_SIZE = QUANTUM_SIZE; +var temp = {}; +for (var i = 0; i < NECESSARY_BLOCKADDRS.length; i++) { + var func = toNiceIdent(NECESSARY_BLOCKADDRS[i][0]); + var label = toNiceIdent(NECESSARY_BLOCKADDRS[i][1]); + if (!temp[func]) temp[func] = {}; + temp[func][label] = 1; +} +NECESSARY_BLOCKADDRS = temp; + //=============================== // Main //=============================== @@ -209,8 +224,17 @@ raw = null; // Pre-process the LLVM assembly +//printErr('JS compiler in action, phase ' + phase); + Debugging.handleMetadata(lines); -PreProcessor.eliminateUnneededIntrinsics(lines); + +if (phase != 'pre') { + PassManager.load(read(forwardedDataFile)); + + if (phase == 'funcs') { + PreProcessor.eliminateUnneededIntrinsics(lines); + } +} // Do it |