Skip to content

Commit e46579e

Browse files
authored
Remove unnecessary hasOwnProperty call. NFC (#25249)
This was causing issues with another patch I'm working on and I realized we can simply remove it for code size win.
1 parent 293b8df commit e46579e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/lib/libdylink.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,11 +1313,11 @@ var LibraryDylink = {
13131313
#if ASSERTIONS
13141314
assert(lib, `Tried to dlsym() from an unopened handle: ${handle}`);
13151315
#endif
1316-
if (!lib.exports.hasOwnProperty(symbol) || lib.exports[symbol].stub) {
1316+
newSymIndex = Object.keys(lib.exports).indexOf(symbol);
1317+
if (newSymIndex == -1 || lib.exports[symbol]?.stub) {
13171318
dlSetError(`Tried to lookup unknown symbol "${symbol}" in dynamic lib: ${lib.name}`)
13181319
return 0;
13191320
}
1320-
newSymIndex = Object.keys(lib.exports).indexOf(symbol);
13211321
#if !WASM_BIGINT
13221322
var origSym = 'orig$' + symbol;
13231323
result = lib.exports[origSym];

test/code_size/test_codesize_hello_dylink_all.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"a.out.js": 246044,
2+
"a.out.js": 246022,
33
"a.out.nodebug.wasm": 597767,
4-
"total": 843811,
4+
"total": 843789,
55
"sent": [
66
"IMG_Init",
77
"IMG_Load",

0 commit comments

Comments
 (0)