diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-04-18 17:43:43 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-04-18 17:43:43 -0700 |
commit | 46e3b2a78717b112254be5f6e8cbd1fad6ab1703 (patch) | |
tree | 6c2d8966086d72e632eb37ed313d1f3c0a939e7d /src/runtime.js | |
parent | f89d9e2be63cbc3d4984dc748dac433dc3491fed (diff) |
refactor assertions and parsing code
Diffstat (limited to 'src/runtime.js')
-rw-r--r-- | src/runtime.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime.js b/src/runtime.js index 6c3d630c..10aab3c9 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -7,7 +7,7 @@ RuntimeGenerator = { alloc: function(size, type, init) { var ret = type + 'TOP'; - if (GUARD_MEMORY) { + if (ASSERTIONS) { ret += '; assert(' + size + ' > 0, "Trying to allocate 0")'; } if (init) { @@ -23,7 +23,7 @@ RuntimeGenerator = { // An allocation that lives as long as the current function call stackAlloc: function(size) { var ret = RuntimeGenerator.alloc(size, 'STACK', INIT_STACK); - if (GUARD_MEMORY) { + if (ASSERTIONS) { ret += '; assert(STACKTOP < STACK_ROOT + STACK_MAX, "Ran out of stack")'; } return ret; @@ -35,7 +35,7 @@ RuntimeGenerator = { // until the parent unwinds its stack. So potentially if we are in // a loop, we can use a lot of memory. var ret = 'var __stackBase__ = STACKTOP; STACKTOP += ' + initial; - if (GUARD_MEMORY) { + if (ASSERTIONS) { ret += '; assert(STACKTOP < STACK_MAX)'; } if (INIT_STACK) { |