diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-08-29 18:17:37 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-08-29 18:17:37 -0700 |
commit | 6f3e4af49c10f8a835ecb35abd6f3b6ad44827de (patch) | |
tree | 48c486ca9488a6042f2351103e677fa06d22ff39 | |
parent | f0812027a3fb3a924d2aae984cbd13e58c983320 (diff) |
make FAST_MEMORY and TOTAL_MEMORY easier to use; fix slowdown in dlmalloc benchmark
-rw-r--r-- | src/preamble.js | 8 | ||||
-rw-r--r-- | src/settings.js | 6 | ||||
-rw-r--r-- | tests/runner.py | 3 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src/preamble.js b/src/preamble.js index 59389e58..54011558 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -428,7 +428,8 @@ var STACK_ROOT, STACKTOP, STACK_MAX; var STATICTOP; var HAS_TYPED_ARRAYS = false; -var TOTAL_MEMORY = 50*1024*1024; +var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || {{{ TOTAL_MEMORY }}}; +var FAST_MEMORY = Module['FAST_MEMORY'] || {{{ FAST_MEMORY }}}; // Initialize the runtime's memory #if USE_TYPED_ARRAYS @@ -459,9 +460,8 @@ if (HAS_TYPED_ARRAYS) { } else #endif { - // Without this optimization, Chrome is slow. Sadly, the constant here needs to be tweaked depending on the code being run... - var FAST_MEMORY = TOTAL_MEMORY/32; - HEAP = new Array(FAST_MEMORY); + // Make sure that our HEAP is implemented as a flat array. + HEAP = new Array(TOTAL_MEMORY); for (var i = 0; i < FAST_MEMORY; i++) { HEAP[i] = 0; // XXX We do *not* use {{| makeSetValue(0, 'i', 0, 'null') |}} here, since this is done just to optimize runtime speed } diff --git a/src/settings.js b/src/settings.js index 1b1665bc..ab532e67 100644 --- a/src/settings.js +++ b/src/settings.js @@ -34,6 +34,12 @@ INVOKE_RUN = 1; // Whether we will call run(). Disable if you embed the generate // code in your own, and will call run() yourself at the right time INIT_STACK = 1; // Whether to initialize memory on the stack to 0. INIT_HEAP = 0; // Whether to initialize memory anywhere other than the stack to 0. +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. +TOTAL_MEMORY = 50*1024*1024; // The total amount of memory to use. This mainly matters in + // typed array builds - accessing memory about this value will + // return undefined values and lead to serious problems, and there + // is currently no warning about that! // Code embetterments OPTIMIZE = 0; // Optimize llvm operations into js commands diff --git a/tests/runner.py b/tests/runner.py index 9b7c8ec9..7fabd17a 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -178,7 +178,7 @@ class RunnerCore(unittest.TestCase): def do_emscripten(self, filename, output_processor=None, append_ext=True, extra_args=[]): # Run Emscripten exported_settings = {} - for setting in ['QUANTUM_SIZE', 'RELOOP', 'OPTIMIZE', 'ASSERTIONS', 'USE_TYPED_ARRAYS', 'SAFE_HEAP', 'CHECK_OVERFLOWS', 'CORRECT_OVERFLOWS', 'CORRECT_SIGNS', 'CHECK_SIGNS', 'CORRECT_OVERFLOWS_LINES', 'CORRECT_SIGNS_LINES', 'CORRECT_ROUNDINGS', 'CORRECT_ROUNDINGS_LINES', 'INVOKE_RUN', 'SAFE_HEAP_LINES', 'INIT_STACK', 'AUTO_OPTIMIZE', 'EXPORTED_FUNCTIONS', 'EXPORTED_GLOBALS', 'BUILD_AS_SHARED_LIB', 'INCLUDE_FULL_LIBRARY', 'RUNTIME_TYPE_INFO', 'DISABLE_EXCEPTIONS']: + for setting in ['QUANTUM_SIZE', 'RELOOP', 'OPTIMIZE', 'ASSERTIONS', 'USE_TYPED_ARRAYS', 'SAFE_HEAP', 'CHECK_OVERFLOWS', 'CORRECT_OVERFLOWS', 'CORRECT_SIGNS', 'CHECK_SIGNS', 'CORRECT_OVERFLOWS_LINES', 'CORRECT_SIGNS_LINES', 'CORRECT_ROUNDINGS', 'CORRECT_ROUNDINGS_LINES', 'INVOKE_RUN', 'SAFE_HEAP_LINES', 'INIT_STACK', 'AUTO_OPTIMIZE', 'EXPORTED_FUNCTIONS', 'EXPORTED_GLOBALS', 'BUILD_AS_SHARED_LIB', 'INCLUDE_FULL_LIBRARY', 'RUNTIME_TYPE_INFO', 'DISABLE_EXCEPTIONS', 'FAST_MEMORY']: try: value = eval(setting) exported_settings[setting] = value @@ -3991,6 +3991,7 @@ else: CORRECT_OVERFLOWS_LINES = CORRECT_SIGNS_LINES = CORRECT_ROUNDINGS_LINES = SAFE_HEAP_LINES = [] LLVM_OPTS = 1 DISABLE_EXCEPTIONS = 1 + FAST_MEMORY = 10*1024*1024 TEST_REPS = 4 TOTAL_TESTS = 6 |