aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-24 15:56:05 +0100
committerAlon Zakai <alonzakai@gmail.com>2012-11-24 15:56:05 +0100
commit915d48e596c36117b58c8d530f72abac8ea28e8e (patch)
tree4248f0f0c146a165886ca05d3904822865f50614 /src/jsifier.js
parent9c5a0dbdd3a7a1052a58735c654c3cb69dadf140 (diff)
remove STRING_TABLE in preparation for better system to reduce # of globals
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 595e057c..c361278a 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -250,7 +250,7 @@ function JSify(data, functionsOnly, givenFunctions) {
processItem: function(item) {
function needsPostSet(value) {
return value[0] in UNDERSCORE_OPENPARENS || value.substr(0, 14) === 'CHECK_OVERFLOW'
- || value.substr(0, 13) === 'STRING_TABLE.';
+ || false; // TODO: interact with output of makeGlobalUse/makeGlobalDef
}
item.intertype = 'GlobalVariableStub';
@@ -267,9 +267,7 @@ function JSify(data, functionsOnly, givenFunctions) {
// they would shadow similarly-named globals in the parent.
item.JS = '';
} else {
- if (!(item.ident in Variables.globals) || !Variables.globals[item.ident].isString) {
- item.JS = 'var ' + item.ident + ';';
- }
+ item.JS = makeGlobalDef(item.ident);
}
var constant = null;
if (item.external) {
@@ -320,13 +318,7 @@ function JSify(data, functionsOnly, givenFunctions) {
var js;
- // Strings are held in STRING_TABLE, to not clutter up the main namespace (in some cases we have
- // many many strings, possibly exceeding the js engine limit on global vars).
- if (Variables.globals[item.ident].isString) {
- js = 'STRING_TABLE.' + item.ident + '=' + constant + ';';
- } else {
- js = item.ident + '=' + constant + ';';
- }
+ js = makeGlobalUse(item.ident) + '=' + constant + ';';
// Special case: class vtables. We make sure they are null-terminated, to allow easy runtime operations
if (item.ident.substr(0, 5) == '__ZTV') {