haikuwebkit/JSTests/stress/string-code-point-at-basic.js

5 lines
71 B
JavaScript
Raw Permalink Normal View History

[JSC] Add StringCodePointAt intrinsic https://bugs.webkit.org/show_bug.cgi?id=201673 Reviewed by Michael Saboff. JSTests: * stress/string-char-at-constant-index-out-of-range.js: Added. (shouldBe): (test): * stress/string-char-code-at-constant-index-out-of-range.js: Added. (shouldBe): (test): * stress/string-code-point-at--out-of-range.js: Added. (shouldBe): (test): * stress/string-code-point-at-basic.js: Added. (test): * stress/string-code-point-at-constant-index-out-of-range.js: Added. (shouldBe): (test): * stress/string-code-point-at-constant-int32-max-index-out-of-range.js: Added. (shouldBe): (test): * stress/string-code-point-at-constant-surrogate-pair.js: Added. (shouldBe): (test): (breaking): * stress/string-code-point-at-surrogate-pair.js: Added. (shouldBe): * stress/string-code-point-at.js: Added. (shouldBe): Source/JavaScriptCore: JetStream2/UniPoker executes String#codePointAt frequently. We should handle it in ThunkGenerator, DFG, and FTL like we are doing so for String#charCodeAt. This patch adds these supports for String#codePointAt to get ~10% score improvement in JetStream2/UniPoker. In ThunkGenerator, we add a thunk for String#codePointAt, which accelerates LLInt and Baseline. In DFG, we handle this as StringCodePointAt node, and emit inlined code in DFG and FTL. The characteristics of StringCodePointAt node is basically the same to StringCharAt. It has String array-mode, so it emits preceding CheckArray. This ensures that (1) StringCodePointAt node itself does not do GC since the string is always resolved, and (2) we can skip the rope check. This thing is just the same to the existing StringCharCodeAt mechanism. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGBackwardsPropagationPhase.cpp: (JSC::DFG::BackwardsPropagationPhase::propagate): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleIntrinsicCall): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGNode.h: (JSC::DFG::Node::hasArrayMode): * dfg/DFGNodeType.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::compileStringCodePointAt): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileStringCodePointAt): * jit/JITInlines.h: (JSC::JIT::emitLoadCharacterString): * jit/ThunkGenerators.cpp: (JSC::stringGetByValGenerator): (JSC::stringCharLoad): (JSC::stringPrototypeCodePointAtThunkGenerator): * jit/ThunkGenerators.h: * runtime/Intrinsic.cpp: (JSC::intrinsicName): * runtime/Intrinsic.h: * runtime/StringPrototype.cpp: (JSC::StringPrototype::finishCreation): * runtime/VM.cpp: (JSC::thunkGeneratorForIntrinsic): Canonical link: https://commits.webkit.org/215338@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249780 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-11 22:36:52 +00:00
function test(string, index)
{
return string.codePointAt(index);
}