Skip to content

Commit

Permalink
Remove some closure compiler hacks (emscripten-core#8437)
Browse files Browse the repository at this point in the history
The hacks for GL are not just ugly, but also bad for code size in some cases, it turns out (apparently closure will not optimize as much in their presence).

This is a step towards emscripten-core#8421, the changes for which end up causing closure to emit worse code if not for this PR.
  • Loading branch information
kripken authored and VirtualTim committed May 21, 2019
1 parent a13f12d commit 0439bc1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
10 changes: 0 additions & 10 deletions src/closure-defined-fs-annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ var Browser;
*/
var SDL;

/**
* @suppress {duplicate, undefinedVars}
*/
var GL;

/**
* @suppress {duplicate, undefinedVars}
*/
var GLctx;

/**
* @suppress {duplicate, undefinedVars}
*/
Expand Down
3 changes: 3 additions & 0 deletions src/library_glfw.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ var LibraryGLFW = {

event.preventDefault();

#if '$FS' in addedLibraryItems
var filenames = allocate(new Array(event.dataTransfer.files.length*4), 'i8*', ALLOC_NORMAL);
var filenamesArray = [];
var count = event.dataTransfer.files.length;
Expand Down Expand Up @@ -794,6 +795,8 @@ var LibraryGLFW = {
save(event.dataTransfer.files[i]);
}

#endif // '$FS' in addedLibraryItems

return false;
},

Expand Down
8 changes: 3 additions & 5 deletions tools/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -2378,12 +2378,10 @@ def closure_compiler(filename, pretty=True):

if not Settings.ASMFS:
# If we have filesystem disabled, tell Closure not to bark when there are syscalls emitted that still reference the nonexisting FS object.
if not Settings.FILESYSTEM:
CLOSURE_ANNOTATIONS += ['--js', path_from_root('src', 'closure-undefined-fs-annotation.js')]

# If we do have filesystem enabled, tell Closure not to bark when FS references different libraries that might not exist.
if Settings.FILESYSTEM and not Settings.ASMFS:
if Settings.FILESYSTEM:
CLOSURE_ANNOTATIONS += ['--js', path_from_root('src', 'closure-defined-fs-annotation.js')]
else:
CLOSURE_ANNOTATIONS += ['--js', path_from_root('src', 'closure-undefined-fs-annotation.js')]

# Closure externs file contains known symbols to be extern to the minification, Closure
# should not minify these symbol names.
Expand Down

0 comments on commit 0439bc1

Please sign in to comment.