Yarr: if we're not using the output array, don't populate it!
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Mar 2012 22:18:20 +0000 (22:18 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Mar 2012 22:18:20 +0000 (22:18 +0000)
commit8d780674628be2e46ee9155c4d2ba949f8a4969e
tree99e4a43e13e57610437c63874d4b87af1e7e0b60
parent6ec5e97748b0a2d8d2e393aa8fd9e1804e416ff0
Yarr: if we're not using the output array, don't populate it!
https://bugs.webkit.org/show_bug.cgi?id=82519

Reviewed by Sam Weinig.

../JavaScriptCore:

Add a new variant of the match method to RegExp that returns a MatchResult,
and modify YarrJIT to be able to compile code that doesn't use an output vector.

This is a 3% progression on v8-regexp.

* JavaScriptCore.xcodeproj/project.pbxproj:
    - Moved MatchResult into its own header.
* assembler/AbstractMacroAssembler.h:
    - Added missing include.
* runtime/MatchResult.h: Added.
(MatchResult::MatchResult):
(MatchResult):
(MatchResult::failed):
(MatchResult::operator bool):
(MatchResult::empty):
    - Moved MatchResult into its own header.
* runtime/RegExp.cpp:
(JSC::RegExp::compile):
(JSC::RegExp::compileIfNecessary):
(JSC::RegExp::match):
    - Changed due to execute & representation changes.
(JSC::RegExp::compileMatchOnly):
(JSC::RegExp::compileIfNecessaryMatchOnly):
    - Added helper to compile MatchOnly code.
(JSC::RegExp::invalidateCode):
(JSC::RegExp::matchCompareWithInterpreter):
(JSC::RegExp::printTraceData):
    - Changed due representation changes.
* runtime/RegExp.h:
(RegExp):
(JSC::RegExp::hasCode):
    - Made YarrCodeBlock a member.
* runtime/RegExpConstructor.h:
(RegExpConstructor):
(JSC::RegExpConstructor::performMatch):
    - Added no-ovector form.
* runtime/RegExpMatchesArray.cpp:
(JSC::RegExpMatchesArray::reifyAllProperties):
    - Match now takes a reference to ovector, not a pointer.
* runtime/RegExpObject.h:
(JSC):
    - Moved MatchResult into its own header.
* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncSplit):
    - Match now takes a reference to ovector, not a pointer.
* testRegExp.cpp:
(testOneRegExp):
    - Match now takes a reference to ovector, not a pointer.
* yarr/YarrJIT.cpp:
(Yarr):
(YarrGenerator):
(JSC::Yarr::YarrGenerator::initCallFrame):
(JSC::Yarr::YarrGenerator::removeCallFrame):
(JSC::Yarr::YarrGenerator::setSubpatternStart):
(JSC::Yarr::YarrGenerator::setSubpatternEnd):
(JSC::Yarr::YarrGenerator::clearSubpatternStart):
(JSC::Yarr::YarrGenerator::setMatchStart):
(JSC::Yarr::YarrGenerator::getMatchStart):
    - Added helper functions to intermediate access to output.
(JSC::Yarr::YarrGenerator::generateDotStarEnclosure):
(JSC::Yarr::YarrGenerator::generate):
(JSC::Yarr::YarrGenerator::backtrack):
(JSC::Yarr::YarrGenerator::generateEnter):
(JSC::Yarr::YarrGenerator::compile):
    - Changed to use the new helpers, only generate subpatterns if IncludeSubpatterns.
(JSC::Yarr::jitCompile):
    - Needs to template of MatchOnly or IncludeSubpatterns.
* yarr/YarrJIT.h:
(YarrCodeBlock):
(JSC::Yarr::YarrCodeBlock::set8BitCode):
(JSC::Yarr::YarrCodeBlock::set16BitCode):
(JSC::Yarr::YarrCodeBlock::has8BitCodeMatchOnly):
(JSC::Yarr::YarrCodeBlock::has16BitCodeMatchOnly):
(JSC::Yarr::YarrCodeBlock::set8BitCodeMatchOnly):
(JSC::Yarr::YarrCodeBlock::set16BitCodeMatchOnly):
(JSC::Yarr::YarrCodeBlock::execute):
(JSC::Yarr::YarrCodeBlock::clear):
    - Added a second set of CodeRefs, so that we can compile RexExps with/without subpattern matching.

../WebCore:

* ForwardingHeaders/runtime/MatchResult.h: Added.
* ForwardingHeaders/yarr/YarrJIT.h: Added.
    - Added forwarding headers.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112454 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
Source/JavaScriptCore/runtime/MatchResult.h [new file with mode: 0644]
Source/JavaScriptCore/runtime/RegExp.cpp
Source/JavaScriptCore/runtime/RegExp.h
Source/JavaScriptCore/runtime/RegExpConstructor.h
Source/JavaScriptCore/runtime/RegExpMatchesArray.cpp
Source/JavaScriptCore/runtime/RegExpObject.h
Source/JavaScriptCore/runtime/StringPrototype.cpp
Source/JavaScriptCore/testRegExp.cpp
Source/JavaScriptCore/yarr/YarrJIT.cpp
Source/JavaScriptCore/yarr/YarrJIT.h
Source/WebCore/ChangeLog
Source/WebCore/ForwardingHeaders/runtime/MatchResult.h [new file with mode: 0644]
Source/WebCore/ForwardingHeaders/yarr/YarrJIT.h [new file with mode: 0644]