diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-10 17:26:15 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-10 17:26:15 -0800 |
commit | f59ffc338e2c1df792709a823be1c1d2735e88bf (patch) | |
tree | 7268bc264e4364f9766f1b137882870bf7b90569 /tools | |
parent | 0162cc4bdc1955b442bec1a185d024d3d30cec0e (diff) | |
parent | 3a35fd9389a18707abd51dc71e2096c64413d510 (diff) |
Merge branch 'ta2bydefault'
Diffstat (limited to 'tools')
-rw-r--r-- | tools/js-optimizer.js | 5 | ||||
-rw-r--r-- | tools/shared.py | 21 |
2 files changed, 21 insertions, 5 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index e889c7a3..d22de39c 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -193,6 +193,11 @@ function unGlobalize(ast) { // - and in library/shell code too! - we should never rely on // undefined being assigned. So we can simply remove those assignments. // +// Note: An inlined function that kept a large value referenced, may +// keep that references when inlined, if we remove the setting to +// undefined. This is not dangerous in compiled code, but might be +// in supporting code (for example, holding on to the HEAP when copying). +// // This pass assumes that unGlobalize has been run, so undefined // is now explicit. function removeAssignsToUndefined(ast) { diff --git a/tools/shared.py b/tools/shared.py index 632cf633..0aead08a 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -144,11 +144,22 @@ def read_pgo_data(filename): 'overflows_lines': overflows_lines } -# Settings - -class Dummy: pass - -Settings = Dummy() # A global singleton. Not pretty, but nicer than passing |, settings| everywhere +# Settings. A global singleton. Not pretty, but nicer than passing |, settings| everywhere + +class Settings: + @classmethod + def reset(self): + global Settings + class Settings2: + reset = Settings.reset + load_defaults = Settings.load_defaults + Settings = Settings2 + + @classmethod + def load_defaults(self): + ''' Load the JS settings into Python ''' + settings = open(path_from_root('src', 'settings.js')).read().replace('var ', 'Settings.').replace('//', '#') + exec(settings) # Building |