diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-17 10:21:26 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-17 10:21:26 -0700 |
commit | 6d686fa81e80f096d273e7a710d8afbb4710ba23 (patch) | |
tree | 1ac6425b92177a3d72d455a157cb0f20150627d8 /src/jsifier.js | |
parent | f14734515b78b581f540ebca50e3f200a6a72ebe (diff) |
optimize globalVariableHandler a little
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 7901a5e3..01f1b27d 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -320,12 +320,9 @@ function JSify(data, functionsOnly, givenFunctions) { } // ensure alignment - constant = constant.concat(zeros(Runtime.alignMemory(constant.length) - constant.length)); - - // Special case: class vtables. We make sure they are null-terminated, to allow easy runtime operations - if (item.ident.substr(0, 5) == '__ZTV') { - constant = constant.concat(zeros(Runtime.alignMemory(QUANTUM_SIZE))); - } + var extra = Runtime.alignMemory(constant.length) - constant.length; + if (item.ident.substr(0, 5) == '__ZTV') extra += Runtime.alignMemory(QUANTUM_SIZE); + while (extra-- > 0) constant.push(0); } // NOTE: This is the only place that could potentially create static |