forked from emscripten-core/emscripten
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSDCE.js
More file actions
93 lines (85 loc) · 1.85 KB
/
JSDCE.js
File metadata and controls
93 lines (85 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// all unused
var x;
var y = 1;
var z = fleefl();
var xx, yy = 1, zz = fleefl(); // but zz must remain due to the side effects in the value
var obj = { x: 5 };
var keeperObj = { x: fleefl() };
var array = [1, 2, '3', function() { ignoreInsideIt() }];
var keeperArray = [1, 2, '3', four()];
function f(x, y, z) {
// shadow the x,y,z
x = y;
y = z;
}
// exported
function g(a) {
return a+1;
}
Module['g'] = g;
// used
function h(a) {
var t; // unused
return a+1;
}
print(h(123));
// inner workings
(function() {
var x;
var y = 1;
var z = fleefl();
var xx, yy = 1, zz = fleefl();
function f(x, y, z) {
// shadow the x,y,z
x = y;
y = z;
}
// exported
function g(a) {
return a+1;
}
Module['g'] = g;
// used
function hh(a) {
var t; // unused
return a+1;
}
print(hh(123));
})();
function glue() {
function lookup() { // 2 passes needed for this one
throw 1;
}
function removable() { // first remove this
lookup();
}
}
glue();
// gl emulation style code
function _glCreateShader() {
return 1;
}
function emulate() {
var saved = _glCreateShader;
_glCreateShader = function _glCreateShader(shaderType) { // the name here is just for show in stack traces!
return glCreateShader();
};
}
emulate();
// has only a self-reference
function ___cxa_find_matching_catch() {
if (!___cxa_find_matching_catch.buffer) ___cxa_find_matching_catch.buffer = {};
}
// use before
___cxa_find_matching_catch_before();
function ___cxa_find_matching_catch_before() {
if (!___cxa_find_matching_catch_before.buffer) ___cxa_find_matching_catch_before.buffer = {};
}
// use after
function ___cxa_find_matching_catch_after() {
if (!___cxa_find_matching_catch_after.buffer) ___cxa_find_matching_catch_after.buffer = {};
}
___cxa_find_matching_catch_after();
// dot stuff
var dotMath = Math.something;
var dotOther = Side.effect;