aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-04 20:47:57 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-04 20:47:57 -0800
commit76713673d5f1c587de7e807d52dcb08ad5f2fda7 (patch)
tree6200c1b9f7404c8131874ed720904018874441ae
parent2a1fcbe0d990665e1cdd8916b8a3f7d4af3dca3b (diff)
enlarge stack size default to 5MB
-rw-r--r--src/preamble.js2
-rw-r--r--src/settings.js8
2 files changed, 7 insertions, 3 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 51e22390..c8e3570a 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -578,6 +578,7 @@ function enlargeMemory() {
}
#endif
+var TOTAL_STACK = Module['TOTAL_STACK'] || {{{ TOTAL_STACK }}};
var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || {{{ TOTAL_MEMORY }}};
var FAST_MEMORY = Module['FAST_MEMORY'] || {{{ FAST_MEMORY }}};
@@ -641,7 +642,6 @@ Module['HEAPF32'] = HEAPF32;
#endif
STACK_ROOT = STACKTOP = alignMemoryPage(10);
-var TOTAL_STACK = 1024*1024; // XXX: Changing this value can lead to bad perf on v8!
STACK_MAX = STACK_ROOT + TOTAL_STACK;
STATICTOP = alignMemoryPage(STACK_MAX);
diff --git a/src/settings.js b/src/settings.js
index c5b10454..ee9f10b9 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -31,11 +31,15 @@ var INVOKE_RUN = 1; // Whether we will call run(). Disable if you embed the gene
// code in your own, and will call run() yourself at the right time
var INIT_STACK = 0; // Whether to initialize memory on the stack to 0.
var INIT_HEAP = 0; // Whether to initialize memory anywhere other than the stack to 0.
-var FAST_MEMORY = 2*1024*1024; // The amount of memory to initialize to 0. This ensures it will be
- // in a flat array. This only matters in non-typed array builds.
+var TOTAL_STACK = 5*1024*1024; // The total stack size. There is no way to enlarge the stack, so this
+ // value must be large enough for the program's requirements. If
+ // assertions are on, we will assert on not exceeding this, otherwise,
+ // it will fail silently.
var TOTAL_MEMORY = 10*1024*1024; // The total amount of memory to use. Using more memory than this will
// cause us to expand the heap, which can be costly with typed arrays:
// we need to copy the old heap into a new one in that case.
+var FAST_MEMORY = 2*1024*1024; // The amount of memory to initialize to 0. This ensures it will be
+ // in a flat array. This only matters in non-typed array builds.
// Code embetterments
var MICRO_OPTS = 1; // Various micro-optimizations, like nativizing variables