From 860d56e5c724d32ce8cc890ff97a02dbdf379259 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 12 Jan 2016 11:56:12 -0800 Subject: implement br_if in wasm-as --- src/wasm-binary.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/wasm-binary.h') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 79742a414..9accbfbc0 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -543,14 +543,14 @@ public: breakStack.pop_back(); } void visitBreak(Break *curr) { - o << int8_t(BinaryConsts::Br); + o << int8_t(curr->condition ? BinaryConsts::BrIf : BinaryConsts::Br); for (int i = breakStack.size() - 1; i >= 0; i--) { if (breakStack[i] == curr->name) { o << int8_t(breakStack.size() - 1 - i); return; } } - abort(); + if (curr->condition) visit(curr->condition); } void visitSwitch(Switch *curr) { o << int8_t(BinaryConsts::TableSwitch) << int16_t(curr->cases.size()) -- cgit v1.2.3