aboutsummaryrefslogtreecommitdiff
path: root/src/relooper/Relooper.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-11 16:17:16 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-11 16:17:16 -0800
commitc47f7eba9be951c8e308e66c2541091c6b057af8 (patch)
tree59aed1cd174e91921e867955507c13f63303f40e /src/relooper/Relooper.cpp
parentada59f0a9d23d8ec19ee6a1326977ddf6e93f5f9 (diff)
parent2113958017b5def518bd4bcf0bf77e8be233a93f (diff)
Merge branch 'incoming'
Diffstat (limited to 'src/relooper/Relooper.cpp')
-rw-r--r--src/relooper/Relooper.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/relooper/Relooper.cpp b/src/relooper/Relooper.cpp
index 933fda96..ae8577b1 100644
--- a/src/relooper/Relooper.cpp
+++ b/src/relooper/Relooper.cpp
@@ -58,6 +58,8 @@ void PutIndented(const char *String) {
*OutputBuffer = 0;
}
+static int AsmJS = 0;
+
// Indenter
#if EMSCRIPTEN
@@ -271,7 +273,11 @@ void MultipleShape::Render(bool InLoop) {
RenderLoopPrefix();
bool First = true;
for (BlockShapeMap::iterator iter = InnerMap.begin(); iter != InnerMap.end(); iter++) {
- PrintIndented("%sif (label == %d) {\n", First ? "" : "else ", iter->first->Id);
+ if (AsmJS) {
+ PrintIndented("%sif ((label|0) == %d) {\n", First ? "" : "else ", iter->first->Id);
+ } else {
+ PrintIndented("%sif (label == %d) {\n", First ? "" : "else ", iter->first->Id);
+ }
First = false;
Indenter::Indent();
iter->second->Render(InLoop);
@@ -977,6 +983,10 @@ void Relooper::MakeOutputBuffer(int Size) {
OutputBufferSize = Size;
}
+void Relooper::SetAsmJSMode(int On) {
+ AsmJS = On;
+}
+
#if DEBUG
// Debugging
@@ -1018,6 +1028,10 @@ void rl_make_output_buffer(int size) {
Relooper::SetOutputBuffer((char*)malloc(size), size);
}
+void rl_set_asm_js_mode(int on) {
+ Relooper::SetAsmJSMode(on);
+}
+
void *rl_new_block(const char *text) {
Block *ret = new Block(text);
#if DEBUG