diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-06-25 17:49:28 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-03 15:31:03 -0700 |
commit | 20e81c40735a5c98672900d3793f1cc8452b2471 (patch) | |
tree | c7e5c4badba7e3aa6b7d28c4bdd7233a3b7954b3 /tools | |
parent | 8bd809c849bdce4533c0062010e0c88fc1b0d467 (diff) |
begin work on memory relocation
Diffstat (limited to 'tools')
-rw-r--r-- | tools/js-optimizer.js | 2 | ||||
-rw-r--r-- | tools/shared.py | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index 85171a02..f382496f 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -2760,7 +2760,7 @@ function relocate(ast) { } else if (node[2][1] == 'H_BASE') { base = hBase; } - if (base) { + if (base !== null) { var other = node[3]; if (other[0] == 'num') { other[1] += base; diff --git a/tools/shared.py b/tools/shared.py index bc1177b2..1d70fcab 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -1352,10 +1352,16 @@ chunkify = cache.chunkify class JS: memory_initializer_pattern = '/\* memory initializer \*/ allocate\(([\d,\.concat\(\)\[\]\\n ]+)"i8", ALLOC_NONE, Runtime\.GLOBAL_BASE\)' + no_memory_initializer_pattern = '/\* no memory initializer \*/' @staticmethod def to_nice_ident(ident): # limited version of the JS function toNiceIdent - return ident.replace('%', '$').replace('@', '_'); + return ident.replace('%', '$').replace('@', '_') + + @staticmethod + def align(x, by): + while x % by != 0: x += 1 + return x # Compression of code and data for smaller downloads class Compression: |