From 3ce44a956a248c3c9aabf721ee9a52f92e92fa75 Mon Sep 17 00:00:00 2001 From: "alon@honor" Date: Thu, 21 Oct 2010 12:13:26 -0700 Subject: optimize away unneeded FLATTENER[0]; enable gcc_unmangler test --- src/jsifier.js | 6 +++++- tests/runner.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/jsifier.js b/src/jsifier.js index f82a497c..d4e9f403 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -768,7 +768,11 @@ function JSify(data) { if (typeData.flatFactor) { indexes.push(getFastValue(curr, '*', typeData.flatFactor)); } else { - indexes.push(toNiceIdent(type) + '___FLATTENER[' + curr + ']'); // TODO: If curr is constant, optimize out the flattener struct + if (curr == 0) { + indexes.push(0); // The first index is always 0 anyhow TODO: Assert this in the other places + } else { + indexes.push(toNiceIdent(type) + '___FLATTENER[' + curr + ']'); // TODO: If curr is constant, optimize out the flattener struct + } } } else { if (curr != 0) { diff --git a/tests/runner.py b/tests/runner.py index 793bdb26..79d5062e 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -908,7 +908,7 @@ if 'benchmark' not in sys.argv: self.do_test(path_from_root(['tests', 'sauer']), '*\nTemp is 33\n9\n5\nhello, everyone\n*', main_file='command.cpp') - def zzztest_gcc_unmangler(self): + def test_gcc_unmangler(self): self.do_test(path_from_root(['third_party']), '*d_demangle(char const*, int, unsigned int*)*', main_file='gcc_demangler.c') # Generate tests for all our compilers -- cgit v1.2.3-18-g5258