diff options
author | alon@honor <none@none> | 2010-09-09 21:22:12 -0700 |
---|---|---|
committer | alon@honor <none@none> | 2010-09-09 21:22:12 -0700 |
commit | 5bc458f7a3675ea2f36c71e4456fc1948526cae7 (patch) | |
tree | 824f3b2f9cdf48d05a45971e1025f20ccbd0c1fa | |
parent | a523ad539ccf91b7a162ac1ac18f9e1bf88f5147 (diff) |
fix some regexps that v8 and sm do not agree on
-rw-r--r-- | src/parser.js | 10 | ||||
-rw-r--r-- | tests/runner.py | 2 | ||||
-rw-r--r-- | tests/settings.py | 17 |
3 files changed, 14 insertions, 15 deletions
diff --git a/src/parser.js b/src/parser.js index 2ba20e45..6d74deff 100644 --- a/src/parser.js +++ b/src/parser.js @@ -85,7 +85,7 @@ function isStructPointerType(type) { } function isStructType(type) { - if (/^\[\d+\ x\ (.*)\]/g.test(type)) return true; // [15 x ?] blocks. Like structs + if (new RegExp(/^\[\d+\ x\ (.*)\]/g).test(type)) return true; // [15 x ?] blocks. Like structs if (isPointerType(type)) return false; var proofs = ['%struct', '%"struct']; return type.substr(0, proofs[0].length) == proofs[0] || @@ -377,10 +377,10 @@ function intertyper(data) { var inContinual = false; for (var i = 0; i < lines.length; i++) { var line = lines[i]; - if (inContinual || /^\ +to.*/g.test(line)) { + if (inContinual || new RegExp(/^\ +to.*/g).test(line)) { // to after invoke ret.slice(-1)[0].lineText += line; - if (/^\ +\]/g.test(line)) { // end of llvm switch + if (new RegExp(/^\ +\]/g).test(line)) { // end of llvm switch inContinual = false; } } else { @@ -388,7 +388,7 @@ function intertyper(data) { lineText: line, lineNum: i + 1, }); - if (/^\ +switch\ .*/g.test(line)) { + if (new RegExp(/^\ +switch\ .*/g).test(line)) { // beginning of llvm switch inContinual = true; } @@ -1018,7 +1018,7 @@ function analyzer(data) { if (data.types[type]) return; if (['internal', 'inbounds', 'void'].indexOf(type) != -1) return; dprint('types', '// addType: ' + type); - var check = /^\[(\d+)\ x\ (.*)\]$/g.exec(type); + var check = new RegExp(/^\[(\d+)\ x\ (.*)\]$/g).exec(type); // 'blocks': [14 x %struct.X] etc. if (check) { var num = parseInt(check[1]); diff --git a/tests/runner.py b/tests/runner.py index 6eb3df1f..982c758e 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -68,7 +68,7 @@ class T(unittest.TestCase): output = Popen([LLVM_DIS, filename + '.o', '-o=' + filename + '.o.llvm'], stdout=PIPE, stderr=STDOUT).communicate()[0] if DEBUG: print output # Run Emscripten - emscripten(filename + '.o.llvm', filename + '.o.js', JS_ENGINE) + emscripten(filename + '.o.llvm', filename + '.o.js', PARSER_ENGINE) output = open(filename + '.o.js').read() if output_processor is not None: output_processor(output) diff --git a/tests/settings.py b/tests/settings.py index 1ed85ed4..d4834faf 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -2,14 +2,13 @@ DEBUG=False TEMP_DIR='/dev/shm' LLVM_GCC=os.path.expanduser('~/Dev/llvm/llvm-gcc-27/cbuild/bin/bin/llvm-g++') LLVM_DIS=os.path.expanduser('~/Dev/llvm/llvm-27/cbuild/bin/llvm-dis') -PY_PARSER=path_from_root(['llvm-parser', 'parser.py']) -SPIDERMONKEY_SHELL=os.path.expanduser(os.path.expanduser('~/Dev/tracemonkey/js/src/js')) -V8_ENGINE=os.path.expanduser('~/Dev/v8/d8') # Note: Fails in test_strings etc. due to commandline arguments parsing -JS_ENGINE=SPIDERMONKEY_SHELL -JS_ENGINE_OPTS=[]#['-j'] -PARSER_ENGINE=SPIDERMONKEY_SHELL -PARSER_OPTS=[]#['-j'] -#PARSER_ENGINE=V8_ENGINE -#PARSER_OPTS = [] +SPIDERMONKEY_ENGINE=os.path.expanduser('~/Dev/tracemonkey/js/src/js') +V8_ENGINE=os.path.expanduser('~/Dev/v8/d8') + +#PARSER_ENGINE=SPIDERMONKEY_ENGINE +PARSER_ENGINE=V8_ENGINE + +JS_ENGINE=SPIDERMONKEY_ENGINE #JS_ENGINE=V8_ENGINE +JS_ENGINE_OPTS=[]#['-j'] |