Skip to content

Commit b644e12

Browse files
committed
Remove yet more WASM_BACKEND usage in src/. See #11860
1 parent c6212ef commit b644e12

7 files changed

+9
-79
lines changed

src/library_stack_trace.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
*/
66

77
var LibraryStackTrace = {
8-
9-
$demangle__deps: [
10-
#if MINIMAL_RUNTIME && !WASM_BACKEND
11-
'$stackSave', '$stackAlloc', '$stackRestore'
12-
#if ASSERTIONS
13-
, '$warnOnce'
14-
#endif
15-
#endif
16-
],
178
$demangle: function(func) {
189
#if DEMANGLE_SUPPORT
1910
// If demangle has failed before, stop demangling any further function names
@@ -54,11 +45,7 @@ var LibraryStackTrace = {
5445

5546
$demangleAll: function(text) {
5647
var regex =
57-
#if WASM_BACKEND
5848
/\b_Z[\w\d_]+/g;
59-
#else
60-
/\b__Z[\w\d_]+/g;
61-
#endif
6249
return text.replace(regex,
6350
function(x) {
6451
var y = demangle(x);

src/memoryprofiler.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,7 @@ var emscriptenMemoryProfiler = {
6565
totalTimesFreeCalled: 0,
6666

6767
// Tracks the highest seen location of the STACKTOP variable.
68-
#if WASM_BACKEND
6968
stackTopWatermark: Infinity,
70-
#else
71-
stackTopWatermark: 0,
72-
#endif
7369

7470
// The canvas DOM element to which to draw the allocation map.
7571
canvas: null,
@@ -160,11 +156,7 @@ var emscriptenMemoryProfiler = {
160156

161157
recordStackWatermark: function() {
162158
var self = emscriptenMemoryProfiler;
163-
#if WASM_BACKEND
164159
self.stackTopWatermark = Math.min(self.stackTopWatermark, STACKTOP);
165-
#else
166-
self.stackTopWatermark = Math.max(self.stackTopWatermark, STACKTOP);
167-
#endif
168160
},
169161

170162
onMalloc: function onMalloc(ptr, size) {

src/modules.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,10 @@ var LibraryManager = {
258258
}
259259
}
260260

261-
if (WASM_BACKEND) {
262-
// all asm.js methods should just be run in JS. We should optimize them eventually into wasm. TODO
263-
for (var x in lib) {
264-
if (lib[x + '__asm']) {
265-
lib[x + '__asm'] = undefined;
266-
}
261+
// all asm.js methods should just be run in JS. We should optimize them eventually into wasm. TODO
262+
for (var x in lib) {
263+
if (lib[x + '__asm']) {
264+
lib[x + '__asm'] = undefined;
267265
}
268266
}
269267

src/postamble.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66

77
// === Auto-generated postamble setup entry stuff ===
88

9-
#if !WASM_BACKEND && !WASM
10-
// asm.js startup is synchronous
11-
Module['asm'] = asm;
12-
#endif
13-
149
{{{ exportRuntime() }}}
1510

1611
#if MEM_INIT_IN_WASM == 0
@@ -194,7 +189,7 @@ function callMain(args) {
194189
var start = Date.now();
195190
#endif
196191

197-
#if WASM_BACKEND && STACK_OVERFLOW_CHECK >= 2
192+
#if STACK_OVERFLOW_CHECK >= 2
198193
Module['___set_stack_limit'](STACK_MAX);
199194
#endif
200195

src/postamble_minimal.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ function initRuntime(asm) {
5454

5555
#if USE_PTHREADS
5656
// Export needed variables that worker.js needs to Module.
57-
#if WASM_BACKEND
5857
Module['_emscripten_tls_init'] = _emscripten_tls_init;
59-
#endif
6058
Module['HEAPU32'] = HEAPU32;
6159
Module['dynCall_ii'] = dynCall_ii;
6260
Module['registerPthreadPtr'] = registerPthreadPtr;
@@ -88,26 +86,11 @@ var imports = {
8886
'env': asmLibraryArg
8987
, '{{{ WASI_MODULE_NAME }}}': asmLibraryArg
9088
#endif // MINIFY_WASM_IMPORTED_MODULES
91-
#if WASM_BACKEND == 0
92-
, 'global': {
93-
'NaN': NaN,
94-
'Infinity': Infinity
95-
},
96-
'global.Math': Math,
97-
'asm2wasm': {
98-
'f64-rem': function(x, y) { return x % y; },
99-
'debugger': function() {
100-
#if ASSERTIONS // Disable debugger; statement from being present in release builds to avoid Firefox deoptimizations, see https://bugzilla.mozilla.org/show_bug.cgi?id=1538375
101-
debugger;
102-
#endif
103-
}
104-
}
105-
#endif
10689
};
10790

10891
// In non-fastcomp non-asm.js builds, grab wasm exports to outer scope
10992
// for emscripten_get_exported_function() to be able to access them.
110-
#if (LibraryManager.has('library_exports.js')) && (WASM || WASM_BACKEND)
93+
#if LibraryManager.has('library_exports.js')) && WASM
11194
var asm;
11295
#endif
11396

@@ -164,7 +147,7 @@ WebAssembly.instantiate(Module['wasm'], imports).then(function(output) {
164147
wasmModule = output.module || Module['wasm'];
165148
#endif
166149

167-
#if !(LibraryManager.has('library_exports.js') && (WASM || WASM_BACKEND)) && !EMBIND
150+
#if !(LibraryManager.has('library_exports.js') && WASM) && !EMBIND
168151
// If not using the emscripten_get_exported_function() API or embind, keep the 'asm'
169152
// exports variable in local scope to this instantiate function to save code size.
170153
// (otherwise access it without to export it to outer scope)

src/preamble.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ var wasmMemory;
4747
// In fastcomp asm.js, we don't need a wasm Table at all.
4848
// In the wasm backend, we polyfill the WebAssembly object,
4949
// so this creates a (non-native-wasm) table for us.
50-
#if WASM_BACKEND || WASM
5150
#include "runtime_init_table.js"
52-
#endif // WASM_BACKEND || WASM
5351

5452
#if USE_PTHREADS
5553
// For sending to workers.
@@ -790,11 +788,6 @@ Module['FS_createPreloadedFile'] = FS.createPreloadedFile;
790788
function createExportWrapper(name, fixedasm) {
791789
return function() {
792790
var displayName = name;
793-
#if !WASM_BACKEND
794-
if (name[0] == '_') {
795-
displayName = name.substr(1);
796-
}
797-
#endif
798791
var asm = fixedasm;
799792
if (!fixedasm) {
800793
asm = Module['asm'];
@@ -887,15 +880,6 @@ function createWasm() {
887880
'env': asmLibraryArg,
888881
'{{{ WASI_MODULE_NAME }}}': asmLibraryArg
889882
#endif // MINIFY_WASM_IMPORTED_MODULES
890-
#if WASM_BACKEND == 0
891-
,
892-
'global': {
893-
'NaN': NaN,
894-
'Infinity': Infinity
895-
},
896-
'global.Math': Math,
897-
'asm2wasm': asm2wasmImports
898-
#endif
899883
};
900884
// Load the wasm module and create an instance of using native support in the JS engine.
901885
// handle a generated wasm instance, receiving its exports and
@@ -1148,10 +1132,6 @@ function createWasm() {
11481132
}
11491133
#endif
11501134

1151-
#if WASM && !WASM_BACKEND // fastcomp wasm support: create an asm.js-like function
1152-
Module['asm'] = createWasm;
1153-
#endif
1154-
11551135
// Globals used by JS i64 conversions
11561136
var tempDouble;
11571137
var tempI64;

src/preamble_minimal.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ var HEAPF32 = new Float32Array(buffer);
166166
var HEAPF64 = new Float64Array(buffer);
167167
#endif
168168

169-
#if USE_PTHREADS && ((MEM_INIT_METHOD == 1 && !MEM_INIT_IN_WASM && !SINGLE_FILE) || (SINGLE_FILE && !WASM && !WASM_BACKEND) || USES_DYNAMIC_ALLOC)
169+
#if USE_PTHREADS && ((MEM_INIT_METHOD == 1 && !MEM_INIT_IN_WASM && !SINGLE_FILE) || USES_DYNAMIC_ALLOC)
170170
if (!ENVIRONMENT_IS_PTHREAD) {
171171
#endif
172172

@@ -179,16 +179,11 @@ HEAPU8.set(new Uint8Array(Module['mem']), GLOBAL_BASE);
179179

180180
#endif
181181

182-
#if SINGLE_FILE && !WASM && !WASM_BACKEND
183-
#include "base64Decode.js"
184-
HEAPU8.set(base64Decode('{{{ getQuoted("BASE64_MEMORY_INITIALIZER") }}}'), GLOBAL_BASE);
185-
#endif
186-
187182
#if USES_DYNAMIC_ALLOC
188183
HEAP32[DYNAMICTOP_PTR>>2] = {{{ getQuoted('DYNAMIC_BASE') }}};
189184
#endif
190185

191-
#if USE_PTHREADS && ((MEM_INIT_METHOD == 1 && !MEM_INIT_IN_WASM && !SINGLE_FILE) || (SINGLE_FILE && !WASM && !WASM_BACKEND) || USES_DYNAMIC_ALLOC)
186+
#if USE_PTHREADS && ((MEM_INIT_METHOD == 1 && !MEM_INIT_IN_WASM && !SINGLE_FILE) || USES_DYNAMIC_ALLOC)
192187
}
193188
#endif
194189

0 commit comments

Comments
 (0)