Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[JSC] Make StringConstructor call faster
https://bugs.webkit.org/show_bug.cgi?id=252099 rdar://105306684 Reviewed by Justin Michaud. String constructor is used in a form of call (not construct) to apply ToString-like effect onto the input. This patch makes String constructor JSFunction so that we can make this call faster than InternalFunction calls. This is the same optimization done for Number constructor. ToT Patched string-on-string 8.6568+-0.0778 ^ 7.2580+-0.0923 ^ definitely 1.1927x faster * JSTests/microbenchmarks/string-on-string.js: Added. (shouldBe): (test): * Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleIntrinsicCall): * Source/JavaScriptCore/jit/ThunkGenerators.cpp: (JSC::stringConstructorCallThunkGenerator): * Source/JavaScriptCore/jit/ThunkGenerators.h: * Source/JavaScriptCore/runtime/Intrinsic.h: * Source/JavaScriptCore/runtime/StringConstructor.cpp: (JSC::StringConstructor::StringConstructor): (JSC::StringConstructor::finishCreation): (JSC::StringConstructor::create): * Source/JavaScriptCore/runtime/StringConstructor.h: * Source/JavaScriptCore/runtime/VM.cpp: (JSC::thunkGeneratorForIntrinsic): Canonical link: https://commits.webkit.org/260146@main
- Loading branch information
1 parent
1464751
commit 57c000d
Showing
8 changed files
with
60 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function shouldBe(actual, expected) { | ||
if (actual !== expected) | ||
throw new Error('bad value: ' + actual); | ||
} | ||
|
||
function test(string) { | ||
return String(string); | ||
} | ||
noInline(test); | ||
|
||
for (var i = 0; i < 1e5; ++i) { | ||
shouldBe(test("-0"), "-0"); | ||
shouldBe(test("240"), "240"); | ||
shouldBe(test("-1"), "-1"); | ||
} |
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
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
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
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