aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-31 17:15:45 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-31 17:15:45 -0800
commitac0972ebf6cb8ff17f1bbbf01526d29fd2d2f420 (patch)
tree499dd06881cddf43520b40cc62b51276ca411c60 /src/preamble.js
parent64c779641a2a9587613cc65ad7251890f18e25c3 (diff)
parent375eb145c8a6c1627a8b93f81d40fd1aa7fc899b (diff)
Merge branch 'incoming'
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 52e6a7ca..aab50e9a 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -6,6 +6,11 @@
{{RUNTIME}}
+#if BENCHMARK
+Module.realPrint = Module.print;
+Module.print = Module.printErr = function(){};
+#endif
+
#if SAFE_HEAP
//========================================
// Debugging tools - Heap
@@ -30,8 +35,8 @@ function SAFE_HEAP_ACCESS(dest, type, store, ignore) {
// When using typed arrays, reads over the top of TOTAL_MEMORY will fail silently, so we must
// correct that by growing TOTAL_MEMORY as needed. Without typed arrays, memory is a normal
// JS array so it will work (potentially slowly, depending on the engine).
- assert(dest < STATICTOP);
- assert(STATICTOP <= TOTAL_MEMORY);
+ assert(ignore || dest < STATICTOP);
+ assert(ignore || STATICTOP <= TOTAL_MEMORY);
#endif
#if USE_TYPED_ARRAYS == 2
@@ -473,6 +478,14 @@ Module['ALLOC_STACK'] = ALLOC_STACK;
Module['ALLOC_STATIC'] = ALLOC_STATIC;
Module['ALLOC_NONE'] = ALLOC_NONE;
+// Simple unoptimized memset - necessary during startup
+var _memset = function(ptr, value, num) {
+ var stop = ptr + num;
+ while (ptr < stop) {
+ {{{ makeSetValue('ptr++', 0, 'value', 'i8', null, true) }}};
+ }
+}
+
// allocate(): This is for internal use. You can use it yourself as well, but the interface
// is a little tricky (see docs right below). The reason is that it is optimized
// for multiple syntaxes to save space in generated code. So you should