aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2010-11-17 23:13:17 -0800
committerAlon Zakai <azakai@mozilla.com>2010-11-17 23:13:17 -0800
commitdaa624b9f9be7abdff1c4551e193a26f913b695b (patch)
tree6d321cc891ef5377c3e77fbf21abf9f3496cc16f /src
parent6ce73a0bd1f8a1c6b2edf4b2f3d5eca64bcf3544 (diff)
tweaks for frontend-optimized input
Diffstat (limited to 'src')
-rw-r--r--src/intertyper.js2
-rw-r--r--src/preamble.js4
-rw-r--r--src/runtime.js2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/intertyper.js b/src/intertyper.js
index 932acbe5..2ffae602 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -389,7 +389,7 @@ function intertyper(data, parseFunctions) {
return [{
__result__: true,
intertype: 'label',
- ident: LLVM_STYLE == 'old' ?
+ ident: item.tokens[0].text.substr(-1) == ':' ?
'%' + item.tokens[0].text.substr(0, item.tokens[0].text.length-1) :
'%' + item.tokens[2].text.substr(1),
lineNum: item.lineNum,
diff --git a/src/preamble.js b/src/preamble.js
index 439e0e41..bff5b91a 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -226,7 +226,7 @@ function __formatString() {
var argIndex = 1;
var ret = [];
var curr = -1;
- while (curr != 0) {
+ while (curr) { // Note: should be curr != 0, technically. But this helps catch bugs with undefineds
#if USE_TYPED_ARRAYS
curr = IHEAP[textIndex];
next = IHEAP[textIndex+1];
@@ -332,7 +332,7 @@ _llvm_memset_p0i8_i64 = _llvm_memset_p0i8_i32 = llvm_memset_i32;
function _strlen(ptr) {
var i = 0;
- while (IHEAP[ptr+i] != 0) i++;
+ while (IHEAP[ptr+i]) i++; // Note: should be IHEAP[ptr+i] != 0, technically. But this helps catch bugs with undefineds
return i;
}
diff --git a/src/runtime.js b/src/runtime.js
index cdd85ab3..daa9086d 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -5,7 +5,7 @@
RuntimeGenerator = {
alloc: function(size, type) {
var ret = type + 'TOP';
-// ret += '; for (var i = 0; i < ' + size + '; i++) HEAP[' + type + 'TOP+i] = 0';
+// ret += '; for (var i = 0; i < ' + size + '; i++) HEAP[' + type + 'TOP+i] = 0'; // No need for typed arrays - per the spec, initialized to 0 anyhow
if (GUARD_MEMORY) {
ret += '; assert(' + size + ' > 0)';
}