Skip to content

Commit 6cdd1b3

Browse files
committed
[JSC] Use UCPURegister argument to remove zero extension in JIT code
https://bugs.webkit.org/show_bug.cgi?id=228625 Reviewed by Robin Morisset. Yarr JIT code emits zeroExtend32ToWord for some arguments, but this is not necessary if argument is defined as UCPURegister. In that case, caller guarantees that top 32bits are cleared. * yarr/YarrJIT.cpp: * yarr/YarrJIT.h: Canonical link: https://commits.webkit.org/240105@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280470 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 585c090 commit 6cdd1b3

3 files changed

Lines changed: 19 additions & 12 deletions

File tree

Source/JavaScriptCore/ChangeLog

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
2021-07-30 Yusuke Suzuki <ysuzuki@apple.com>
2+
3+
[JSC] Use UCPURegister argument to remove zero extension in JIT code
4+
https://bugs.webkit.org/show_bug.cgi?id=228625
5+
6+
Reviewed by Robin Morisset.
7+
8+
Yarr JIT code emits zeroExtend32ToWord for some arguments, but this is not necessary if
9+
argument is defined as UCPURegister. In that case, caller guarantees that top 32bits are
10+
cleared.
11+
12+
* yarr/YarrJIT.cpp:
13+
* yarr/YarrJIT.h:
14+
115
2021-07-29 Myles C. Maxfield <mmaxfield@apple.com>
216

317
Stop building WebGPU and the WHLSL compiler to decrease binary size

Source/JavaScriptCore/yarr/YarrJIT.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3972,9 +3972,6 @@ class YarrGenerator final : public YarrJITInfo, private MacroAssembler {
39723972
push(X86Registers::r14);
39733973
push(X86Registers::r15);
39743974
}
3975-
// The ABI doesn't guarantee the upper bits are zero on unsigned arguments, so clear them ourselves.
3976-
zeroExtend32ToWord(index, index);
3977-
zeroExtend32ToWord(length, length);
39783975
#if OS(WINDOWS)
39793976
if (m_compileMode == JITCompileMode::IncludeSubpatterns)
39803977
loadPtr(Address(X86Registers::ebp, 6 * sizeof(void*)), output);
@@ -3991,10 +3988,6 @@ class YarrGenerator final : public YarrJITInfo, private MacroAssembler {
39913988
move(TrustedImm32(0xd800), leadingSurrogateTag);
39923989
move(TrustedImm32(0xdc00), trailingSurrogateTag);
39933990
}
3994-
3995-
// The ABI doesn't guarantee the upper bits are zero on unsigned arguments, so clear them ourselves.
3996-
zeroExtend32ToWord(index, index);
3997-
zeroExtend32ToWord(length, length);
39983991
#elif CPU(ARM_THUMB2)
39993992
push(ARMRegisters::r4);
40003993
push(ARMRegisters::r5);

Source/JavaScriptCore/yarr/YarrJIT.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,18 @@ class BoyerMooreByteVector : public std::array<uint8_t, BoyerMooreBitmap::mapSiz
103103
};
104104

105105
#if CPU(ARM64E)
106-
extern "C" EncodedMatchResult vmEntryToYarrJIT(const void* input, unsigned start, unsigned length, int* output, MatchingContextHolder* matchingContext, const void* codePtr);
106+
extern "C" EncodedMatchResult vmEntryToYarrJIT(const void* input, UCPURegister start, UCPURegister length, int* output, MatchingContextHolder* matchingContext, const void* codePtr);
107107
extern "C" void vmEntryToYarrJITAfter(void);
108108
#endif
109109

110110
class YarrCodeBlock {
111111
WTF_MAKE_FAST_ALLOCATED;
112112
WTF_MAKE_NONCOPYABLE(YarrCodeBlock);
113113

114-
using YarrJITCode8 = EncodedMatchResult (*)(const LChar* input, unsigned start, unsigned length, int* output, MatchingContextHolder& matchingContext) YARR_CALL;
115-
using YarrJITCode16 = EncodedMatchResult (*)(const UChar* input, unsigned start, unsigned length, int* output, MatchingContextHolder& matchingContext) YARR_CALL;
116-
using YarrJITCodeMatchOnly8 = EncodedMatchResult (*)(const LChar* input, unsigned start, unsigned length, void*, MatchingContextHolder& matchingContext) YARR_CALL;
117-
using YarrJITCodeMatchOnly16 = EncodedMatchResult (*)(const UChar* input, unsigned start, unsigned length, void*, MatchingContextHolder& matchingContext) YARR_CALL;
114+
using YarrJITCode8 = EncodedMatchResult (*)(const LChar* input, UCPURegister start, UCPURegister length, int* output, MatchingContextHolder& matchingContext) YARR_CALL;
115+
using YarrJITCode16 = EncodedMatchResult (*)(const UChar* input, UCPURegister start, UCPURegister length, int* output, MatchingContextHolder& matchingContext) YARR_CALL;
116+
using YarrJITCodeMatchOnly8 = EncodedMatchResult (*)(const LChar* input, UCPURegister start, UCPURegister length, void*, MatchingContextHolder& matchingContext) YARR_CALL;
117+
using YarrJITCodeMatchOnly16 = EncodedMatchResult (*)(const UChar* input, UCPURegister start, UCPURegister length, void*, MatchingContextHolder& matchingContext) YARR_CALL;
118118

119119
public:
120120
YarrCodeBlock() = default;

0 commit comments

Comments
 (0)