-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop parameters on NativeFunction toString.
Summary: Hermes, historistically, synthsize formal parameters from the function arity, while all other engines print NativeFunction as 0-arity. This gave the JS community the assumption that this behavior is standardized and come out heuristics that detect NativeFunction by matching on `() { [native code] }` and resulted in Hermes fail the check and trigger librares' slow path. This diff drop the synthsized parameters for Hermes toString implementation on NativeFunction to avoid breaking those heuristcs. This fix #471. This change alone improved `test-lodash` benchmark on Hermes from `787` to `43` which is in the same ballpark with others on my local: `v8 --jitless` (30), `jsc --useJIT=false` (44), and `qjs` (60). Also see normative dicussion to ECMA-262 on enforcing the spec closer to the reality: tc39/ecma262#2381. Reviewed By: avp Differential Revision: D27698165 fbshipit-source-id: bb39438bd21e34fb0c4d7c5df5d97db939648295
- Loading branch information
1 parent
0ba04d6
commit 582a529
Showing
2 changed files
with
42 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters