summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcheck.py29
-rw-r--r--src/asm2wasm.h10
-rw-r--r--test/emcc_O2_hello_world.wast9
-rw-r--r--test/emcc_hello_world.wast3
4 files changed, 29 insertions, 22 deletions
diff --git a/check.py b/check.py
index 018f5977d..ade77f0af 100755
--- a/check.py
+++ b/check.py
@@ -79,19 +79,22 @@ for c in tests:
if os.path.exists(emcc):
extra = json.loads(open(emcc).read())
if os.path.exists('a.normal.js'): os.unlink('a.normal.js')
- subprocess.check_call(['./emcc_to_wasm.js.sh', os.path.join('test', c)] + extra, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- if post:
- open('a.normal.js', 'a').write(post)
- open('a.wasm.js', 'a').write(post)
- else:
- print ' (no post)'
- for which in ['normal', 'wasm']:
- print '....', which
- proc = subprocess.Popen(['nodejs', 'a.' + which + '.js'], stdout=subprocess.PIPE)
- out, err = proc.communicate()
- assert proc.returncode == 0
- if out.strip() != expected.strip():
- fail(out, expected)
+ for opts in [[], ['-O1'], ['-O3', '--profiling']]:
+ command = ['./emcc_to_wasm.js.sh', os.path.join('test', c)] + opts + extra
+ subprocess.check_call(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ print '....' + ' '.join(command)
+ if post:
+ open('a.normal.js', 'a').write(post)
+ open('a.wasm.js', 'a').write(post)
+ else:
+ print ' (no post)'
+ for which in ['normal', 'wasm']:
+ print '......', which
+ proc = subprocess.Popen(['nodejs', 'a.' + which + '.js'], stdout=subprocess.PIPE)
+ out, err = proc.communicate()
+ assert proc.returncode == 0
+ if out.strip() != expected.strip():
+ fail(out, expected)
print '\n[ success! ]'
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index 3a8d3d579..94107ae78 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -923,13 +923,13 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
ret->body = process(ast[2]);
continueStack.pop_back();
breakStack.pop_back();
- Break *continueIn = allocator.alloc<Break>();
- continueIn->name = in;
- continueIn->value = nullptr;
+ Break *breakOut = allocator.alloc<Break>();
+ breakOut->name = out;
+ breakOut->value = nullptr;
If *condition = allocator.alloc<If>();
condition->condition = process(ast[1]);
- condition->ifTrue = continueIn;
- condition->ifFalse = nullptr;
+ condition->ifTrue = allocator.alloc<Nop>();
+ condition->ifFalse = breakOut;
if (Block *block = ret->body->dyn_cast<Block>()) {
block->list.push_back(condition);
} else {
diff --git a/test/emcc_O2_hello_world.wast b/test/emcc_O2_hello_world.wast
index 777bcc9d0..5c3562b7c 100644
--- a/test/emcc_O2_hello_world.wast
+++ b/test/emcc_O2_hello_world.wast
@@ -4659,7 +4659,8 @@
(get_local $i63)
(i32.const 0)
)
- (break $do-in$29
+ (nop)
+ (break $do-out$28
)
)
)
@@ -6693,7 +6694,8 @@
(i32.const 0)
)
)
- (break $do-in$47
+ (nop)
+ (break $do-out$46
)
)
)
@@ -7388,7 +7390,8 @@
(get_local $i5)
(i32.const 32)
)
- (break $do-in$51
+ (nop)
+ (break $do-out$50
)
)
)
diff --git a/test/emcc_hello_world.wast b/test/emcc_hello_world.wast
index 7941533c6..6686b0762 100644
--- a/test/emcc_hello_world.wast
+++ b/test/emcc_hello_world.wast
@@ -2305,7 +2305,8 @@
(get_local $dest)
(get_local $stop)
)
- (break $do-in$1
+ (nop)
+ (break $do-out$0
)
)
)