@@ -73,32 +73,30 @@ var LibraryDylink = {
73
73
#if ! DISABLE_EXCEPTION_CATCHING || SUPPORT_LONGJMP = = 'emscripten'
74
74
$createInvokeFunction__internal : true ,
75
75
$createInvokeFunction__deps : [ '$dynCall' , 'setThrew' , '$stackSave' , '$stackRestore' ] ,
76
- $createInvokeFunction : ( sig ) => {
77
- return function ( ) {
78
- var sp = stackSave ( ) ;
79
- try {
80
- return dynCall ( sig , arguments [ 0 ] , Array . prototype . slice . call ( arguments , 1 ) ) ;
81
- } catch ( e ) {
82
- stackRestore ( sp ) ;
83
- // Create a try-catch guard that rethrows the Emscripten EH exception.
76
+ $createInvokeFunction : ( sig ) => ( ptr , ...args ) => {
77
+ var sp = stackSave ( ) ;
78
+ try {
79
+ return dynCall ( sig , ptr , args ) ;
80
+ } catch ( e ) {
81
+ stackRestore ( sp ) ;
82
+ // Create a try-catch guard that rethrows the Emscripten EH exception.
84
83
#if EXCEPTION_STACK_TRACES
85
- // Exceptions thrown from C++ and longjmps will be an instance of
86
- // EmscriptenEH.
87
- if ( ! ( e instanceof EmscriptenEH ) ) throw e ;
84
+ // Exceptions thrown from C++ and longjmps will be an instance of
85
+ // EmscriptenEH.
86
+ if ( ! ( e instanceof EmscriptenEH ) ) throw e ;
88
87
#else
89
- // Exceptions thrown from C++ will be a pointer (number) and longjmp
90
- // will throw the number Infinity. Use the compact and fast "e !== e+0"
91
- // test to check if e was not a Number.
92
- if ( e !== e + 0 ) throw e ;
93
- #endif
94
- _setThrew ( 1 , 0 ) ;
95
- #if WASM_BIGINT
96
- // In theory this if statement could be done on
97
- // creating the function, but I just added this to
98
- // save wasting code space as it only happens on exception.
99
- if ( sig [ 0 ] == "j" ) return 0n ;
100
- #endif
101
- }
88
+ // Exceptions thrown from C++ will be a pointer (number) and longjmp
89
+ // will throw the number Infinity. Use the compact and fast "e !== e+0"
90
+ // test to check if e was not a Number.
91
+ if ( e !== e + 0 ) throw e ;
92
+ #endif
93
+ _setThrew ( 1 , 0 ) ;
94
+ #if WASM_BIGINT
95
+ // In theory this if statement could be done on
96
+ // creating the function, but I just added this to
97
+ // save wasting code space as it only happens on exception.
98
+ if ( sig [ 0 ] == "j" ) return 0n ;
99
+ #endif
102
100
}
103
101
} ,
104
102
#endif
@@ -140,8 +138,7 @@ var LibraryDylink = {
140
138
// `__cxa_find_matching_catch_` (see jsifier.js) that we know are needed,
141
139
// but a side module loaded at runtime might need different/additional
142
140
// variants so we create those dynamically.
143
- sym = wasmImports [ symName ] = function ( ) {
144
- var args = Array . from ( arguments ) ;
141
+ sym = wasmImports [ symName ] = ( ...args ) => {
145
142
#if MEMORY64
146
143
args = args . map ( Number ) ;
147
144
#endif
0 commit comments