Changeset 288476 in webkit for trunk/Source/JavaScriptCore
- Timestamp:
- Jan 24, 2022, 3:20:23 PM (3 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r288473 r288476 1 2022-01-24 Mikhail R. Gadelha <[email protected]> 2 3 [JSC][32bit] Fix regexp crash on ARMv7 4 https://bugs.webkit.org/show_bug.cgi?id=234476 5 6 Reviewed by Yusuke Suzuki. 7 8 This patch fixes several regexp crashes on ARMv7 due to an incorrect 9 offset to retrieve the 5th argument from the stack: in ARMv7, only 10 4 arguments are passed via registers r0-r3i, and any other argument is 11 placed on the stack, however, YarrJIT was trying to get the 5th arg 12 from a fixed offset, so because the generateEnter() method pushed 13 register into the stack, the offset was wrong. This patch fixes how 14 the offset is calculated for MIPS and ARMv7. 15 16 This patch also introduces some small changes: 17 18 1. Added static_asserts that the YarrJIT calls do indeed have 5 arguments 19 and that the 5th argument has the type that we expect (MatchingContextHolder*). 20 21 2. Removed an unnecessary pointer from the MatchingContextHolder 22 constructor. 23 24 3. Fixed some warnings in the YarrJIT code here and there. 25 26 * dfg/DFGSpeculativeJIT64.cpp: 27 (JSC::DFG::SpeculativeJIT::compileRegExpTestInline): 28 * runtime/RegExpInlines.h: 29 (JSC::RegExp::matchInline): 30 * yarr/YarrJIT.cpp: 31 * yarr/YarrMatchingContextHolder.h: 32 (JSC::Yarr::MatchingContextHolder::MatchingContextHolder): 33 1 34 2022-01-24 Yusuke Suzuki <[email protected]> 2 35 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r288401 r288476 2889 2889 UNUSED_PARAM(node); 2890 2890 ASSERT_NOT_REACHED(); 2891 returncompileRegExpTest(node);2891 compileRegExpTest(node); 2892 2892 } 2893 2893 #endif -
trunk/Source/JavaScriptCore/jit/GPRInfo.h
r288401 r288476 627 627 typedef GPRReg RegisterType; 628 628 static constexpr unsigned numberOfRegisters = 16; 629 static constexpr unsigned numberOfArgumentRegisters = 8;629 static constexpr unsigned numberOfArgumentRegisters = NUMBER_OF_ARGUMENT_REGISTERS; 630 630 631 631 // These registers match the baseline JIT. … … 826 826 typedef GPRReg RegisterType; 827 827 static constexpr unsigned numberOfRegisters = 13; 828 static constexpr unsigned numberOfArgumentRegisters = 8;828 static constexpr unsigned numberOfArgumentRegisters = NUMBER_OF_ARGUMENT_REGISTERS; 829 829 830 830 static constexpr GPRReg callFrameRegister = RISCV64Registers::fp; -
trunk/Source/JavaScriptCore/runtime/RegExp.cpp
r288401 r288476 449 449 case JITCode: { 450 450 Yarr::YarrCodeBlock& codeBlock = *m_regExpJITCode.get(); 451 snprintf(jit8BitMatchOnlyAddr, jitAddrSize, "0x%014 lx", reinterpret_cast<uintptr_t>(codeBlock.get8BitMatchOnlyAddr()));452 snprintf(jit16BitMatchOnlyAddr, jitAddrSize, "0x%014 lx", reinterpret_cast<uintptr_t>(codeBlock.get16BitMatchOnlyAddr()));453 snprintf(jit8BitMatchAddr, jitAddrSize, "0x%014 lx", reinterpret_cast<uintptr_t>(codeBlock.get8BitMatchAddr()));454 snprintf(jit16BitMatchAddr, jitAddrSize, "0x%014 lx", reinterpret_cast<uintptr_t>(codeBlock.get16BitMatchAddr()));451 snprintf(jit8BitMatchOnlyAddr, jitAddrSize, "0x%014" PRIxPTR, reinterpret_cast<uintptr_t>(codeBlock.get8BitMatchOnlyAddr())); 452 snprintf(jit16BitMatchOnlyAddr, jitAddrSize, "0x%014" PRIxPTR, reinterpret_cast<uintptr_t>(codeBlock.get16BitMatchOnlyAddr())); 453 snprintf(jit8BitMatchAddr, jitAddrSize, "0x%014" PRIxPTR, reinterpret_cast<uintptr_t>(codeBlock.get8BitMatchAddr())); 454 snprintf(jit16BitMatchAddr, jitAddrSize, "0x%014" PRIxPTR, reinterpret_cast<uintptr_t>(codeBlock.get16BitMatchAddr())); 455 455 break; 456 456 } -
trunk/Source/JavaScriptCore/runtime/RegExpInlines.h
r288401 r288476 133 133 { 134 134 ASSERT(m_regExpJITCode); 135 Yarr::MatchingContextHolder regExpContext(vm, m_regExpJITCode .get(), this, matchFrom);135 Yarr::MatchingContextHolder regExpContext(vm, m_regExpJITCode->usesPatternContextBuffer(), this, matchFrom); 136 136 137 137 if (s.is8Bit()) 138 result = m_regExpJITCode->execute(s.characters8(), startOffset, s.length(), offsetVector, regExpContext).start;138 result = m_regExpJITCode->execute(s.characters8(), startOffset, s.length(), offsetVector, ®ExpContext).start; 139 139 else 140 result = m_regExpJITCode->execute(s.characters16(), startOffset, s.length(), offsetVector, regExpContext).start;140 result = m_regExpJITCode->execute(s.characters16(), startOffset, s.length(), offsetVector, ®ExpContext).start; 141 141 } 142 142 … … 147 147 return throwError(); 148 148 { 149 Yarr::MatchingContextHolder regExpContext(vm, nullptr, this, matchFrom); 149 constexpr bool usesPatternContextBuffer = false; 150 Yarr::MatchingContextHolder regExpContext(vm, usesPatternContextBuffer, this, matchFrom); 150 151 result = Yarr::interpret(m_regExpBytecode.get(), s, startOffset, reinterpret_cast<unsigned*>(offsetVector)); 151 152 } … … 163 164 #endif 164 165 { 165 Yarr::MatchingContextHolder regExpContext(vm, nullptr, this, matchFrom); 166 constexpr bool usesPatternContextBuffer = false; 167 Yarr::MatchingContextHolder regExpContext(vm, usesPatternContextBuffer, this, matchFrom); 166 168 result = Yarr::interpret(m_regExpBytecode.get(), s, startOffset, reinterpret_cast<unsigned*>(offsetVector)); 167 169 } … … 267 269 { 268 270 ASSERT(m_regExpJITCode); 269 Yarr::MatchingContextHolder regExpContext(vm, m_regExpJITCode .get(), this, matchFrom);271 Yarr::MatchingContextHolder regExpContext(vm, m_regExpJITCode->usesPatternContextBuffer(), this, matchFrom); 270 272 271 273 if (s.is8Bit()) 272 result = m_regExpJITCode->execute(s.characters8(), startOffset, s.length(), regExpContext);274 result = m_regExpJITCode->execute(s.characters8(), startOffset, s.length(), ®ExpContext); 273 275 else 274 result = m_regExpJITCode->execute(s.characters16(), startOffset, s.length(), regExpContext);276 result = m_regExpJITCode->execute(s.characters16(), startOffset, s.length(), ®ExpContext); 275 277 } 276 278 … … 296 298 offsetVector = nonReturnedOvector.data(); 297 299 { 298 Yarr::MatchingContextHolder regExpContext(vm, nullptr, this, matchFrom); 300 constexpr bool usesPatternContextBuffer = false; 301 Yarr::MatchingContextHolder regExpContext(vm, usesPatternContextBuffer, this, matchFrom); 299 302 result = Yarr::interpret(m_regExpBytecode.get(), s, startOffset, reinterpret_cast<unsigned*>(offsetVector)); 300 303 } -
trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp
r288401 r288476 28 28 #include "YarrJIT.h" 29 29 30 #include "CCallHelpers.h" 30 31 #include "LinkBuffer.h" 31 32 #include "Options.h" … … 187 188 class YarrGenerator final : public YarrJITInfo { 188 189 189 #ifdef JIT_UNICODE_EXPRESSIONS190 const MacroAssembler::TrustedImm32 surrogateTagMask = MacroAssembler::TrustedImm32(0xfffffc00);191 #endif192 193 190 #if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS) 194 191 struct ParenContextSizes { … … 604 601 605 602 // Is the character a leading surrogate? 606 m_jit.and32( YarrJITDefaultRegisters::surrogateTagMask, resultReg, m_regs.unicodeTemp);603 m_jit.and32(m_regs.surrogateTagMask, resultReg, m_regs.unicodeTemp); 607 604 notUnicode.append(m_jit.branch32(MacroAssembler::NotEqual, m_regs.unicodeTemp, m_regs.leadingSurrogateTag)); 608 605 … … 613 610 // Is the character a trailing surrogate? 614 611 m_jit.load16Unaligned(MacroAssembler::Address(m_regs.regUnicodeInputAndTrail), m_regs.regUnicodeInputAndTrail); 615 m_jit.and32( YarrJITDefaultRegisters::surrogateTagMask, m_regs.regUnicodeInputAndTrail, m_regs.unicodeTemp);612 m_jit.and32(m_regs.surrogateTagMask, m_regs.regUnicodeInputAndTrail, m_regs.unicodeTemp); 616 613 notUnicode.append(m_jit.branch32(MacroAssembler::NotEqual, m_regs.unicodeTemp, m_regs.trailingSurrogateTag)); 617 614 … … 3962 3959 void generateEnter() 3963 3960 { 3961 auto pushInEnter = [&](GPRReg gpr) { 3962 m_jit.push(gpr); 3963 m_pushCountInEnter += 1; 3964 }; 3965 3966 auto pushPairInEnter = [&](GPRReg gpr1, GPRReg gpr2) { 3967 m_jit.pushPair(gpr1, gpr2); 3968 m_pushCountInEnter += 2; 3969 }; 3970 3964 3971 #if CPU(X86_64) 3965 m_jit.push(X86Registers::ebp);3966 m_jit. move(MacroAssembler::stackPointerRegister, X86Registers::ebp);3972 UNUSED_VARIABLE(pushPairInEnter); 3973 m_jit.emitFunctionPrologue(); 3967 3974 3968 3975 if (m_pattern.m_saveInitialStartValue) 3969 m_jit.push(X86Registers::ebx);3976 pushInEnter(X86Registers::ebx); 3970 3977 3971 3978 #if OS(WINDOWS) 3972 m_jit.push(X86Registers::edi);3979 pushInEnter(X86Registers::edi); 3973 3980 #endif 3974 3981 #if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS) 3975 3982 if (m_containsNestedSubpatterns) { 3976 3983 #if OS(WINDOWS) 3977 m_jit.push(X86Registers::esi);3978 #endif 3979 m_jit.push(X86Registers::r12);3984 pushInEnter(X86Registers::esi); 3985 #endif 3986 pushInEnter(X86Registers::r12); 3980 3987 } 3981 3988 #endif 3982 3989 3983 3990 if (m_decodeSurrogatePairs) { 3984 m_jit.push(X86Registers::r13);3985 m_jit.push(X86Registers::r14);3986 m_jit.push(X86Registers::r15);3991 pushInEnter(X86Registers::r13); 3992 pushInEnter(X86Registers::r14); 3993 pushInEnter(X86Registers::r15); 3987 3994 } 3988 3995 #if OS(WINDOWS) 3989 3996 if (m_compileMode == JITCompileMode::IncludeSubpatterns) 3990 m_jit.loadPtr(MacroAssembler::Address( X86Registers::ebp, 6 * sizeof(void*)), m_regs.output);3997 m_jit.loadPtr(MacroAssembler::Address(MacroAssembler::framePointerRegister, 6 * sizeof(void*)), m_regs.output); 3991 3998 // rcx is the pointer to the allocated space for result in x64 Windows. 3992 m_jit.push(X86Registers::ecx);3999 pushInEnter(X86Registers::ecx); 3993 4000 #endif 3994 4001 #elif CPU(ARM64) 4002 UNUSED_VARIABLE(pushInEnter); 3995 4003 if (!Options::useJITCage()) 3996 4004 m_jit.tagReturnAddress(); 3997 4005 if (m_decodeSurrogatePairs) { 3998 4006 if (!Options::useJITCage()) 3999 m_jit.pushPair(MacroAssembler::framePointerRegister, MacroAssembler::linkRegister);4007 pushPairInEnter(MacroAssembler::framePointerRegister, MacroAssembler::linkRegister); 4000 4008 m_jit.move(MacroAssembler::TrustedImm32(0x10000), m_regs.supplementaryPlanesBase); 4001 4009 m_jit.move(MacroAssembler::TrustedImm32(0xd800), m_regs.leadingSurrogateTag); … … 4003 4011 } 4004 4012 #elif CPU(ARM_THUMB2) 4005 m_jit.push(ARMRegisters::r4); 4006 m_jit.push(ARMRegisters::r5); 4007 m_jit.push(ARMRegisters::r6); 4008 m_jit.push(ARMRegisters::r8); 4009 m_jit.push(ARMRegisters::r10); 4013 UNUSED_VARIABLE(pushPairInEnter); 4014 pushInEnter(ARMRegisters::r4); 4015 pushInEnter(ARMRegisters::r5); 4016 pushInEnter(ARMRegisters::r6); 4017 pushInEnter(ARMRegisters::r8); 4018 pushInEnter(ARMRegisters::r10); 4010 4019 #elif CPU(RISCV64) 4020 UNUSED_VARIABLE(pushInEnter); 4011 4021 if (m_decodeSurrogatePairs) 4012 m_jit.pushPair(MacroAssembler::framePointerRegister, MacroAssembler::linkRegister); 4013 #elif CPU(MIPS) 4014 // Do nothing. 4022 pushPairInEnter(MacroAssembler::framePointerRegister, MacroAssembler::linkRegister); 4023 #else 4024 UNUSED_VARIABLE(pushInEnter); 4025 UNUSED_VARIABLE(pushPairInEnter); 4015 4026 #endif 4016 4027 } … … 4053 4064 if (m_pattern.m_saveInitialStartValue) 4054 4065 m_jit.pop(X86Registers::ebx); 4055 m_jit. pop(X86Registers::ebp);4066 m_jit.emitFunctionEpilogue(); 4056 4067 #elif CPU(ARM64) 4057 4068 if (m_decodeSurrogatePairs) { … … 4068 4079 if (m_decodeSurrogatePairs) 4069 4080 m_jit.popPair(MacroAssembler::framePointerRegister, MacroAssembler::linkRegister); 4070 #elif CPU(MIPS) 4071 // Do nothing 4072 #endif 4081 #endif 4082 4073 4083 #if CPU(ARM64E) 4074 4084 if (Options::useJITCage()) … … 4087 4097 4088 4098 public: 4089 YarrGenerator( MacroAssembler& jit, const VM* vm, YarrCodeBlock* codeBlock, const YarrJITRegs& regs, YarrPattern& pattern, const String& patternString, CharSize charSize, JITCompileMode compileMode)4099 YarrGenerator(CCallHelpers& jit, const VM* vm, YarrCodeBlock* codeBlock, const YarrJITRegs& regs, YarrPattern& pattern, const String& patternString, CharSize charSize, JITCompileMode compileMode) 4090 4100 : m_jit(jit) 4091 4101 , m_vm(vm) … … 4106 4116 } 4107 4117 4108 YarrGenerator( MacroAssembler& jit, const VM* vm, YarrBoyerMoyerData* yarrBMData, const YarrJITRegs& regs, YarrPattern& pattern, const String& patternString, CharSize charSize, JITCompileMode compileMode)4118 YarrGenerator(CCallHelpers& jit, const VM* vm, YarrBoyerMoyerData* yarrBMData, const YarrJITRegs& regs, YarrPattern& pattern, const String& patternString, CharSize charSize, JITCompileMode compileMode) 4109 4119 : m_jit(jit) 4110 4120 , m_vm(vm) … … 4140 4150 } 4141 4151 4152 template<typename OperationType> 4153 static constexpr void functionChecks() 4154 { 4155 static_assert(FunctionTraits<OperationType>::cCallArity() == 5, "YarrJITCode takes 5 arguments"); 4156 static_assert(std::is_same<MatchingContextHolder*, typename FunctionTraits<OperationType>::template ArgumentType<4>>::value, "MatchingContextHolder* is expected as the function 5th argument"); 4157 } 4158 4142 4159 void compile(YarrCodeBlock& codeBlock) 4143 4160 { … … 4192 4209 // Check stack size 4193 4210 m_jit.addPtr(MacroAssembler::TrustedImm32(-callFrameSizeInBytes), MacroAssembler::stackPointerRegister, m_regs.regT0); 4211 4212 // Make sure that the JITed functions have 5 parameters and that the 5th argument is a MatchingContextHolder* 4213 functionChecks<YarrCodeBlock::YarrJITCode8>(); 4214 functionChecks<YarrCodeBlock::YarrJITCode16>(); 4215 functionChecks<YarrCodeBlock::YarrJITCodeMatchOnly8>(); 4216 functionChecks<YarrCodeBlock::YarrJITCodeMatchOnly16>(); 4194 4217 #if CPU(X86_64) && OS(WINDOWS) 4195 4218 // matchingContext is the 5th argument, it is found on the stack. 4196 4219 MacroAssembler::RegisterID matchingContext = m_regs.regT1; 4197 m_jit.loadPtr(MacroAssembler::Address( X86Registers::ebp, 7 * sizeof(void*)), matchingContext);4220 m_jit.loadPtr(MacroAssembler::Address(MacroAssembler::framePointerRegister, 7 * sizeof(void*)), matchingContext); 4198 4221 #elif CPU(ARM_THUMB2) || CPU(MIPS) 4199 // matchingContext is the 5th argument, it is found on the stack.4222 // Not enough argument registers: try to load the 5th argument from the stack 4200 4223 MacroAssembler::RegisterID matchingContext = m_regs.regT1; 4201 m_jit.loadPtr(MacroAssembler::Address(MacroAssembler::stackPointerRegister, 4 * sizeof(void*)), matchingContext); 4224 4225 // The argument will be in an offset that depends on the arch and the number of registers we pushed into the stack 4226 // POKE_ARGUMENT_OFFSET: MIPS reserves space in the stack for all arguments, so we add +4 offset 4227 // m_pushCountInEnter: number of registers pushed into the stack (see generateEnter()) 4228 unsigned offset = POKE_ARGUMENT_OFFSET + m_pushCountInEnter; 4229 m_jit.loadPtr(MacroAssembler::Address(MacroAssembler::stackPointerRegister, offset * sizeof(void*)), matchingContext); 4202 4230 #else 4203 4231 MacroAssembler::RegisterID matchingContext = m_regs.matchingContext; … … 4619 4647 4620 4648 private: 4621 MacroAssembler& m_jit;4649 CCallHelpers& m_jit; 4622 4650 const VM* m_vm; 4623 4651 YarrCodeBlock* m_codeBlock; … … 4673 4701 4674 4702 std::unique_ptr<YarrDisassembler> m_disassembler; 4703 4704 // Member is used to count the number of GPR pushed into the stack when 4705 // entering JITed code. It is used to figure out if an function argument 4706 // offset in the stack if there wasn't enough registers to pass it, e.g., 4707 // ARMv7 and MIPS only use 4 registers to pass function arguments. 4708 unsigned m_pushCountInEnter { 0 }; 4675 4709 }; 4676 4710 … … 4707 4741 void jitCompile(YarrPattern& pattern, String& patternString, CharSize charSize, VM* vm, YarrCodeBlock& codeBlock, JITCompileMode mode) 4708 4742 { 4709 MacroAssemblermasm;4743 CCallHelpers masm; 4710 4744 4711 4745 ASSERT(mode == JITCompileMode::MatchOnly || mode == JITCompileMode::IncludeSubpatterns); … … 4728 4762 #endif 4729 4763 4730 void jitCompileInlinedTest(StackCheck* m_compilationThreadStackChecker, const String& patternString, OptionSet<Yarr::Flags> flags, CharSize charSize, const VM* vm, YarrBoyerMoyerData& boyerMooreData, MacroAssembler& jit, YarrJITRegisters& jitRegisters)4764 void jitCompileInlinedTest(StackCheck* m_compilationThreadStackChecker, const String& patternString, OptionSet<Yarr::Flags> flags, CharSize charSize, const VM* vm, YarrBoyerMoyerData& boyerMooreData, CCallHelpers& jit, YarrJITRegisters& jitRegisters) 4731 4765 { 4732 4766 Yarr::ErrorCode errorCode; -
trunk/Source/JavaScriptCore/yarr/YarrJIT.h
r288401 r288476 44 44 namespace JSC { 45 45 46 class VM;46 class CCallHelpers; 47 47 class ExecutablePool; 48 48 class MacroAssembler; 49 class VM; 49 50 50 51 namespace Yarr { … … 272 273 WTF_MAKE_NONCOPYABLE(YarrCodeBlock); 273 274 274 using YarrJITCode8 = SlowPathReturnType (*)(const LChar* input, UCPURegister start, UCPURegister length, int* output, MatchingContextHolder& matchingContext) YARR_CALL;275 using YarrJITCode16 = SlowPathReturnType (*)(const UChar* input, UCPURegister start, UCPURegister length, int* output, MatchingContextHolder& matchingContext) YARR_CALL;276 using YarrJITCodeMatchOnly8 = SlowPathReturnType (*)(const LChar* input, UCPURegister start, UCPURegister length, void*, MatchingContextHolder& matchingContext) YARR_CALL;277 using YarrJITCodeMatchOnly16 = SlowPathReturnType (*)(const UChar* input, UCPURegister start, UCPURegister length, void*, MatchingContextHolder& matchingContext) YARR_CALL;278 279 275 public: 276 using YarrJITCode8 = SlowPathReturnType (*)(const LChar* input, UCPURegister start, UCPURegister length, int* output, MatchingContextHolder*) YARR_CALL; 277 using YarrJITCode16 = SlowPathReturnType (*)(const UChar* input, UCPURegister start, UCPURegister length, int* output, MatchingContextHolder*) YARR_CALL; 278 using YarrJITCodeMatchOnly8 = SlowPathReturnType (*)(const LChar* input, UCPURegister start, UCPURegister length, void*, MatchingContextHolder*) YARR_CALL; 279 using YarrJITCodeMatchOnly16 = SlowPathReturnType (*)(const UChar* input, UCPURegister start, UCPURegister length, void*, MatchingContextHolder*) YARR_CALL; 280 280 281 YarrCodeBlock() = default; 281 282 … … 327 328 InlineStats& get16BitInlineStats() { return m_matchOnly16Stats; } 328 329 329 MatchResult execute(const LChar* input, unsigned start, unsigned length, int* output, MatchingContextHolder &matchingContext)330 MatchResult execute(const LChar* input, unsigned start, unsigned length, int* output, MatchingContextHolder* matchingContext) 330 331 { 331 332 ASSERT(has8BitCode()); 332 333 #if CPU(ARM64E) 333 334 if (Options::useJITCage()) 334 return MatchResult(vmEntryToYarrJIT(input, start, length, output, &matchingContext, retagCodePtr<Yarr8BitPtrTag, YarrEntryPtrTag>(m_ref8.code().executableAddress())));335 return MatchResult(vmEntryToYarrJIT(input, start, length, output, matchingContext, retagCodePtr<Yarr8BitPtrTag, YarrEntryPtrTag>(m_ref8.code().executableAddress()))); 335 336 #endif 336 337 return MatchResult(untagCFunctionPtr<YarrJITCode8, Yarr8BitPtrTag>(m_ref8.code().executableAddress())(input, start, length, output, matchingContext)); 337 338 } 338 339 339 MatchResult execute(const UChar* input, unsigned start, unsigned length, int* output, MatchingContextHolder &matchingContext)340 MatchResult execute(const UChar* input, unsigned start, unsigned length, int* output, MatchingContextHolder* matchingContext) 340 341 { 341 342 ASSERT(has16BitCode()); 342 343 #if CPU(ARM64E) 343 344 if (Options::useJITCage()) 344 return MatchResult(vmEntryToYarrJIT(input, start, length, output, &matchingContext, retagCodePtr<Yarr16BitPtrTag, YarrEntryPtrTag>(m_ref16.code().executableAddress())));345 return MatchResult(vmEntryToYarrJIT(input, start, length, output, matchingContext, retagCodePtr<Yarr16BitPtrTag, YarrEntryPtrTag>(m_ref16.code().executableAddress()))); 345 346 #endif 346 347 return MatchResult(untagCFunctionPtr<YarrJITCode16, Yarr16BitPtrTag>(m_ref16.code().executableAddress())(input, start, length, output, matchingContext)); 347 348 } 348 349 349 MatchResult execute(const LChar* input, unsigned start, unsigned length, MatchingContextHolder &matchingContext)350 MatchResult execute(const LChar* input, unsigned start, unsigned length, MatchingContextHolder* matchingContext) 350 351 { 351 352 ASSERT(has8BitCodeMatchOnly()); 352 353 #if CPU(ARM64E) 353 354 if (Options::useJITCage()) 354 return MatchResult(vmEntryToYarrJIT(input, start, length, nullptr, &matchingContext, retagCodePtr<YarrMatchOnly8BitPtrTag, YarrEntryPtrTag>(m_matchOnly8.code().executableAddress())));355 return MatchResult(vmEntryToYarrJIT(input, start, length, nullptr, matchingContext, retagCodePtr<YarrMatchOnly8BitPtrTag, YarrEntryPtrTag>(m_matchOnly8.code().executableAddress()))); 355 356 #endif 356 357 return MatchResult(untagCFunctionPtr<YarrJITCodeMatchOnly8, YarrMatchOnly8BitPtrTag>(m_matchOnly8.code().executableAddress())(input, start, length, nullptr, matchingContext)); 357 358 } 358 359 359 MatchResult execute(const UChar* input, unsigned start, unsigned length, MatchingContextHolder &matchingContext)360 MatchResult execute(const UChar* input, unsigned start, unsigned length, MatchingContextHolder* matchingContext) 360 361 { 361 362 ASSERT(has16BitCodeMatchOnly()); 362 363 #if CPU(ARM64E) 363 364 if (Options::useJITCage()) 364 return MatchResult(vmEntryToYarrJIT(input, start, length, nullptr, &matchingContext, retagCodePtr<YarrMatchOnly16BitPtrTag, YarrEntryPtrTag>(m_matchOnly16.code().executableAddress())));365 return MatchResult(vmEntryToYarrJIT(input, start, length, nullptr, matchingContext, retagCodePtr<YarrMatchOnly16BitPtrTag, YarrEntryPtrTag>(m_matchOnly16.code().executableAddress()))); 365 366 #endif 366 367 return MatchResult(untagCFunctionPtr<YarrJITCodeMatchOnly16, YarrMatchOnly16BitPtrTag>(m_matchOnly16.code().executableAddress())(input, start, length, nullptr, matchingContext)); … … 440 441 class YarrJITRegisters; 441 442 442 void jitCompileInlinedTest(StackCheck*, const String&, OptionSet<Yarr::Flags>, CharSize, const VM*, YarrBoyerMoyerData&, MacroAssembler&, YarrJITRegisters&);443 void jitCompileInlinedTest(StackCheck*, const String&, OptionSet<Yarr::Flags>, CharSize, const VM*, YarrBoyerMoyerData&, CCallHelpers&, YarrJITRegisters&); 443 444 #endif 444 445 -
trunk/Source/JavaScriptCore/yarr/YarrJITRegisters.h
r288401 r288476 207 207 const MacroAssembler::TrustedImm32 leadingSurrogateTag = MacroAssembler::TrustedImm32(0xd800); 208 208 const MacroAssembler::TrustedImm32 trailingSurrogateTag = MacroAssembler::TrustedImm32(0xdc00); 209 const MacroAssembler::TrustedImm32 surrogateTagMask = MacroAssembler::TrustedImm32(0xfffffc00); 209 210 }; 210 211 #endif -
trunk/Source/JavaScriptCore/yarr/YarrMatchingContextHolder.h
r288401 r288476 38 38 namespace Yarr { 39 39 40 class YarrCodeBlock;41 42 40 class MatchingContextHolder { 43 41 WTF_FORBID_HEAP_ALLOCATION; 44 42 public: 45 MatchingContextHolder(VM&, YarrCodeBlock*, RegExp*, MatchFrom);43 MatchingContextHolder(VM&, bool, RegExp*, MatchFrom); 46 44 ~MatchingContextHolder(); 47 45 … … 62 60 }; 63 61 64 inline MatchingContextHolder::MatchingContextHolder(VM& vm, YarrCodeBlock* yarrCodeBlock, RegExp* regExp, MatchFrom matchFrom)62 inline MatchingContextHolder::MatchingContextHolder(VM& vm, bool usesPatternContextBuffer, RegExp* regExp, MatchFrom matchFrom) 65 63 : m_vm(vm) 66 64 , m_matchFrom(matchFrom) … … 75 73 76 74 #if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS) 77 if ( yarrCodeBlock && yarrCodeBlock->usesPatternContextBuffer()) {75 if (usesPatternContextBuffer) { 78 76 m_patternContextBuffer = m_vm.acquireRegExpPatternContexBuffer(); 79 77 m_patternContextBufferSize = VM::patternContextBufferSize; 80 78 } 81 79 #else 82 UNUSED_PARAM( yarrCodeBlock);80 UNUSED_PARAM(usesPatternContextBuffer); 83 81 #endif 84 82 }
Note:
See TracChangeset
for help on using the changeset viewer.