diff options
author | max99x <max99x@gmail.com> | 2011-07-31 05:19:02 +0300 |
---|---|---|
committer | max99x <max99x@gmail.com> | 2011-07-31 05:19:02 +0300 |
commit | cd7fea411be8151351ea24c562bf906d3fcd3821 (patch) | |
tree | 9171873dbe0d3f181e4d30d9375ca3649e89c3c8 | |
parent | 7f735afe5ee57f693602b661e8e6286dcc914c72 (diff) |
Fixed allocate() ignoring ALLOC_NORMAL.
-rw-r--r-- | src/preamble.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/preamble.js b/src/preamble.js index d4f5e570..7d1b725a 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -354,7 +354,7 @@ function allocate(slab, types, allocator) { size = slab.length; } - var ret = [_malloc, Runtime.stackAlloc, Runtime.staticAlloc][allocator ? allocator : ALLOC_STATIC](Math.max(size, 1)); + var ret = [_malloc, Runtime.stackAlloc, Runtime.staticAlloc][allocator === undefined ? ALLOC_STATIC : allocator](Math.max(size, 1)); var singleType = typeof types === 'string' ? types : null; @@ -549,8 +549,13 @@ function String_copy(ptr, addZero) { // Tools -if (typeof print === 'undefined') { - print = console.log; // we are on the web +function jrint(label, obj) { // XXX manual debugging + if (!obj) { + obj = label; + label = ''; + } else + label = label + ' : '; + print(label + JSON.stringify(obj)); } // This processes a JS string into a C-line array of numbers, 0-terminated. |