diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-08-31 17:53:41 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-08-31 17:53:41 -0700 |
commit | 7565b00cce206bb7fd8899ba121e412996d0d8e2 (patch) | |
tree | 3389e5916e24b65edb8e6dd1b293f4f8240e6282 /src/jsifier.js | |
parent | 1e7f45eb40bf8597ae7b1263e9e546737979851c (diff) |
initial work to support resume, landingpad and insertvalue
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 330597bf..82642f6b 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -701,6 +701,9 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) { } return ret + ';'; }); + makeFuncLineActor('resume', function(item) { + return (EXCEPTION_DEBUG ? 'print("Resuming exception");' : '') + 'throw [0,0];'; + }); makeFuncLineActor('invoke', function(item) { // Wrapping in a function lets us easily return values if we are // in an assignment @@ -716,6 +719,10 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) { + ' } else { ' + makeBranch(item.unwindLabel, item.currLabelId) + ' }'; return ret; }); + makeFuncLineActor('landingpad', function(item) { + // Just a stub + return '{ f0: 0, f1: 0 }'; + }); makeFuncLineActor('load', function(item) { var value = finalizeLLVMParameter(item.pointer); var impl = item.ident ? getVarImpl(item.funcData, item.ident) : VAR_EMULATED; @@ -732,6 +739,15 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) { // and we emulate them using simple JS objects { f1: , f2: , } etc., for speed return item.ident + '.f' + item.indexes[0][0].text; }); + makeFuncLineActor('insertvalue', function(item) { + assert(item.indexes.length == 1); // TODO: see extractvalue + var ret, ident; + if (item.ident === 'undef') { + ident = 'tempValue'; + ret += ident + ' = ' + makeEmptyStruct(item.type) + ', '; + } + return item.ident + '.f' + item.indexes[0][0].text + ' = ' + finalizeLLVMParameter(item.value) + ', ' + item.ident; + }); makeFuncLineActor('indirectbr', function(item) { return makeBranch(finalizeLLVMParameter(item.pointer), item.currLabelId, true); }); |