aboutsummaryrefslogtreecommitdiff
path: root/src/modules.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-28 17:05:01 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-07 14:23:19 -0800
commit4a1ac20dd8a12a19f92f6c0c0ce344eb203dcff7 (patch)
tree207ef771ee8707bffecffb697df7341c65de2b99 /src/modules.js
parent19d06326b6cbfe729ab9613a22a4246aa95b9f52 (diff)
clean up function table generating code
Diffstat (limited to 'src/modules.js')
-rw-r--r--src/modules.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/modules.js b/src/modules.js
index 5bcf614f..f03953f3 100644
--- a/src/modules.js
+++ b/src/modules.js
@@ -258,16 +258,20 @@ var Functions = {
// Generate code for function indexing
generateIndexing: function() {
+ var total = this.nextIndex;
+ function emptyTable(sig) {
+ return zeros(total);
+ }
var tables = {};
if (ASM_JS) {
['ii'].forEach(function(sig) { // add some default signatures that are used in the library
- tables[sig] = zeros(this.nextIndex); // TODO: make them compact
+ tables[sig] = emptyTable(sig); // TODO: make them compact
});
}
for (var ident in this.indexedFunctions) {
var sig = ASM_JS ? Functions.implementedFunctions[ident] || Functions.unimplementedFunctions[ident] : 'x';
assert(sig, ident);
- if (!tables[sig]) tables[sig] = zeros(this.nextIndex); // TODO: make them compact
+ if (!tables[sig]) tables[sig] = emptyTable(sig); // TODO: make them compact
tables[sig][this.indexedFunctions[ident]] = ident;
}
// Resolve multi-level aliases all the way down