Changeset 42481 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Apr 14, 2009, 12:06:41 AM (16 years ago)
Author:
[email protected]
Message:

2009-04-13 Gavin Barraclough <[email protected]>

Reviewed by Cap'n Geoff Garen.

Yarr!
(Yet another regex runtime).

Currently disabled by default since the interpreter, whilst awesomely
functional, has not been optimized and is likely slower than PCRE, and
the JIT, whilst faster than WREC, is presently incomplete and does not
fallback to using an interpreter for the cases it cannot handle.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::move): (JSC::MacroAssemblerX86Common::swap): (JSC::MacroAssemblerX86Common::signExtend32ToPtr): (JSC::MacroAssemblerX86Common::zeroExtend32ToPtr): (JSC::MacroAssemblerX86Common::branch32): (JSC::MacroAssemblerX86Common::branch16):
  • assembler/X86Assembler.h: (JSC::X86Assembler::cmpw_im): (JSC::X86Assembler::testw_rr): (JSC::X86Assembler::X86InstructionFormatter::immediate16):
  • runtime/RegExp.cpp: (JSC::RegExp::RegExp): (JSC::RegExp::~RegExp): (JSC::RegExp::create): (JSC::RegExp::compile): (JSC::RegExp::match):
  • runtime/RegExp.h:
  • wtf/Platform.h:
  • yarr: Added.
  • yarr/RegexCompiler.cpp: Added. (JSC::Yarr::CharacterClassConstructor::CharacterClassConstructor): (JSC::Yarr::CharacterClassConstructor::reset): (JSC::Yarr::CharacterClassConstructor::append): (JSC::Yarr::CharacterClassConstructor::putChar): (JSC::Yarr::CharacterClassConstructor::isUnicodeUpper): (JSC::Yarr::CharacterClassConstructor::isUnicodeLower): (JSC::Yarr::CharacterClassConstructor::putRange): (JSC::Yarr::CharacterClassConstructor::charClass): (JSC::Yarr::CharacterClassConstructor::addSorted): (JSC::Yarr::CharacterClassConstructor::addSortedRange): (JSC::Yarr::newlineCreate): (JSC::Yarr::digitsCreate): (JSC::Yarr::spacesCreate): (JSC::Yarr::wordcharCreate): (JSC::Yarr::nondigitsCreate): (JSC::Yarr::nonspacesCreate): (JSC::Yarr::nonwordcharCreate): (JSC::Yarr::RegexPatternConstructor::RegexPatternConstructor): (JSC::Yarr::RegexPatternConstructor::~RegexPatternConstructor): (JSC::Yarr::RegexPatternConstructor::reset): (JSC::Yarr::RegexPatternConstructor::assertionBOL): (JSC::Yarr::RegexPatternConstructor::assertionEOL): (JSC::Yarr::RegexPatternConstructor::assertionWordBoundary): (JSC::Yarr::RegexPatternConstructor::atomPatternCharacter): (JSC::Yarr::RegexPatternConstructor::atomBuiltInCharacterClass): (JSC::Yarr::RegexPatternConstructor::atomCharacterClassBegin): (JSC::Yarr::RegexPatternConstructor::atomCharacterClassAtom): (JSC::Yarr::RegexPatternConstructor::atomCharacterClassRange): (JSC::Yarr::RegexPatternConstructor::atomCharacterClassBuiltIn): (JSC::Yarr::RegexPatternConstructor::atomCharacterClassEnd): (JSC::Yarr::RegexPatternConstructor::atomParenthesesSubpatternBegin): (JSC::Yarr::RegexPatternConstructor::atomParentheticalAssertionBegin): (JSC::Yarr::RegexPatternConstructor::atomParenthesesEnd): (JSC::Yarr::RegexPatternConstructor::atomBackReference): (JSC::Yarr::RegexPatternConstructor::copyDisjunction): (JSC::Yarr::RegexPatternConstructor::copyTerm): (JSC::Yarr::RegexPatternConstructor::quantifyAtom): (JSC::Yarr::RegexPatternConstructor::disjunction): (JSC::Yarr::RegexPatternConstructor::regexBegin): (JSC::Yarr::RegexPatternConstructor::regexEnd): (JSC::Yarr::RegexPatternConstructor::regexError): (JSC::Yarr::RegexPatternConstructor::setupAlternativeOffsets): (JSC::Yarr::RegexPatternConstructor::setupDisjunctionOffsets): (JSC::Yarr::RegexPatternConstructor::setupOffsets): (JSC::Yarr::compileRegex):
  • yarr/RegexCompiler.h: Added.
  • yarr/RegexInterpreter.cpp: Added. (JSC::Yarr::Interpreter::appendParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::popParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::DisjunctionContext::DisjunctionContext): (JSC::Yarr::Interpreter::DisjunctionContext::operator new): (JSC::Yarr::Interpreter::allocDisjunctionContext): (JSC::Yarr::Interpreter::freeDisjunctionContext): (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::ParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::operator new): (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::restoreOutput): (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::getDisjunctionContext): (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext): (JSC::Yarr::Interpreter::InputStream::InputStream): (JSC::Yarr::Interpreter::InputStream::next): (JSC::Yarr::Interpreter::InputStream::rewind): (JSC::Yarr::Interpreter::InputStream::read): (JSC::Yarr::Interpreter::InputStream::readChecked): (JSC::Yarr::Interpreter::InputStream::reread): (JSC::Yarr::Interpreter::InputStream::prev): (JSC::Yarr::Interpreter::InputStream::getPos): (JSC::Yarr::Interpreter::InputStream::setPos): (JSC::Yarr::Interpreter::InputStream::atStart): (JSC::Yarr::Interpreter::InputStream::atEnd): (JSC::Yarr::Interpreter::InputStream::checkInput): (JSC::Yarr::Interpreter::InputStream::uncheckInput): (JSC::Yarr::Interpreter::testCharacterClass): (JSC::Yarr::Interpreter::tryConsumeCharacter): (JSC::Yarr::Interpreter::checkCharacter): (JSC::Yarr::Interpreter::tryConsumeCharacterClass): (JSC::Yarr::Interpreter::checkCharacterClass): (JSC::Yarr::Interpreter::tryConsumeBackReference): (JSC::Yarr::Interpreter::matchAssertionBOL): (JSC::Yarr::Interpreter::matchAssertionEOL): (JSC::Yarr::Interpreter::matchAssertionWordBoundary): (JSC::Yarr::Interpreter::matchPatternCharacter): (JSC::Yarr::Interpreter::backtrackPatternCharacter): (JSC::Yarr::Interpreter::matchCharacterClass): (JSC::Yarr::Interpreter::backtrackCharacterClass): (JSC::Yarr::Interpreter::matchBackReference): (JSC::Yarr::Interpreter::backtrackBackReference): (JSC::Yarr::Interpreter::recordParenthesesMatch): (JSC::Yarr::Interpreter::resetMatches): (JSC::Yarr::Interpreter::resetAssertionMatches): (JSC::Yarr::Interpreter::parenthesesDoBacktrack): (JSC::Yarr::Interpreter::matchParenthesesOnceBegin): (JSC::Yarr::Interpreter::matchParenthesesOnceEnd): (JSC::Yarr::Interpreter::backtrackParenthesesOnceBegin): (JSC::Yarr::Interpreter::backtrackParenthesesOnceEnd): (JSC::Yarr::Interpreter::matchParentheticalAssertionOnceBegin): (JSC::Yarr::Interpreter::matchParentheticalAssertionOnceEnd): (JSC::Yarr::Interpreter::backtrackParentheticalAssertionOnceBegin): (JSC::Yarr::Interpreter::backtrackParentheticalAssertionOnceEnd): (JSC::Yarr::Interpreter::matchParentheses): (JSC::Yarr::Interpreter::backtrackParentheses): (JSC::Yarr::Interpreter::matchTerm): (JSC::Yarr::Interpreter::backtrackTerm): (JSC::Yarr::Interpreter::matchAlternative): (JSC::Yarr::Interpreter::matchDisjunction): (JSC::Yarr::Interpreter::matchNonZeroDisjunction): (JSC::Yarr::Interpreter::interpret): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::ParenthesesStackEntry::ParenthesesStackEntry): (JSC::Yarr::ByteCompiler::ByteCompiler): (JSC::Yarr::ByteCompiler::compile): (JSC::Yarr::ByteCompiler::checkInput): (JSC::Yarr::ByteCompiler::assertionBOL): (JSC::Yarr::ByteCompiler::assertionEOL): (JSC::Yarr::ByteCompiler::assertionWordBoundary): (JSC::Yarr::ByteCompiler::atomPatternCharacter): (JSC::Yarr::ByteCompiler::atomCharacterClass): (JSC::Yarr::ByteCompiler::atomBackReference): (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternBegin): (JSC::Yarr::ByteCompiler::atomParentheticalAssertionBegin): (JSC::Yarr::ByteCompiler::popParenthesesStack): (JSC::Yarr::ByteCompiler::dumpDisjunction): (JSC::Yarr::ByteCompiler::closeAlternative): (JSC::Yarr::ByteCompiler::atomParenthesesEnd): (JSC::Yarr::ByteCompiler::regexBegin): (JSC::Yarr::ByteCompiler::regexEnd): (JSC::Yarr::ByteCompiler::alterantiveDisjunction): (JSC::Yarr::ByteCompiler::emitDisjunction): (JSC::Yarr::byteCompileRegex): (JSC::Yarr::interpretRegex):
  • yarr/RegexInterpreter.h: Added. (JSC::Yarr::ByteTerm::): (JSC::Yarr::ByteTerm::ByteTerm): (JSC::Yarr::ByteTerm::BOL): (JSC::Yarr::ByteTerm::CheckInput): (JSC::Yarr::ByteTerm::EOL): (JSC::Yarr::ByteTerm::WordBoundary): (JSC::Yarr::ByteTerm::BackReference): (JSC::Yarr::ByteTerm::AlternativeBegin): (JSC::Yarr::ByteTerm::AlternativeDisjunction): (JSC::Yarr::ByteTerm::AlternativeEnd): (JSC::Yarr::ByteTerm::PatternEnd): (JSC::Yarr::ByteTerm::invert): (JSC::Yarr::ByteTerm::capture): (JSC::Yarr::ByteDisjunction::ByteDisjunction): (JSC::Yarr::BytecodePattern::BytecodePattern): (JSC::Yarr::BytecodePattern::~BytecodePattern):
  • yarr/RegexJIT.cpp: Added. (JSC::Yarr::RegexGenerator::optimizeAlternative): (JSC::Yarr::RegexGenerator::matchCharacterClassRange): (JSC::Yarr::RegexGenerator::matchCharacterClass): (JSC::Yarr::RegexGenerator::jumpIfNoAvailableInput): (JSC::Yarr::RegexGenerator::jumpIfAvailableInput): (JSC::Yarr::RegexGenerator::checkInput): (JSC::Yarr::RegexGenerator::atEndOfInput): (JSC::Yarr::RegexGenerator::notAtEndOfInput): (JSC::Yarr::RegexGenerator::jumpIfCharEquals): (JSC::Yarr::RegexGenerator::jumpIfCharNotEquals): (JSC::Yarr::RegexGenerator::readCharacter): (JSC::Yarr::RegexGenerator::storeToFrame): (JSC::Yarr::RegexGenerator::loadFromFrame): (JSC::Yarr::RegexGenerator::TermGenerationState::TermGenerationState): (JSC::Yarr::RegexGenerator::TermGenerationState::resetAlternative): (JSC::Yarr::RegexGenerator::TermGenerationState::alternativeValid): (JSC::Yarr::RegexGenerator::TermGenerationState::nextAlternative): (JSC::Yarr::RegexGenerator::TermGenerationState::alternative): (JSC::Yarr::RegexGenerator::TermGenerationState::resetTerm): (JSC::Yarr::RegexGenerator::TermGenerationState::termValid): (JSC::Yarr::RegexGenerator::TermGenerationState::nextTerm): (JSC::Yarr::RegexGenerator::TermGenerationState::term): (JSC::Yarr::RegexGenerator::TermGenerationState::lookaheadTerm): (JSC::Yarr::RegexGenerator::TermGenerationState::isSinglePatternCharacterLookaheadTerm): (JSC::Yarr::RegexGenerator::TermGenerationState::inputOffset): (JSC::Yarr::RegexGenerator::TermGenerationState::jumpToBacktrack): (JSC::Yarr::RegexGenerator::TermGenerationState::setBacktrackGenerated): (JSC::Yarr::RegexGenerator::jumpToBacktrackCheckEmitPending): (JSC::Yarr::RegexGenerator::genertateAssertionBOL): (JSC::Yarr::RegexGenerator::genertateAssertionEOL): (JSC::Yarr::RegexGenerator::matchAssertionWordchar): (JSC::Yarr::RegexGenerator::genertateAssertionWordBoundary): (JSC::Yarr::RegexGenerator::genertatePatternCharacterSingle): (JSC::Yarr::RegexGenerator::genertatePatternCharacterPair): (JSC::Yarr::RegexGenerator::genertatePatternCharacterFixed): (JSC::Yarr::RegexGenerator::genertatePatternCharacterGreedy): (JSC::Yarr::RegexGenerator::genertatePatternCharacterNonGreedy): (JSC::Yarr::RegexGenerator::genertateCharacterClassSingle): (JSC::Yarr::RegexGenerator::genertateCharacterClassFixed): (JSC::Yarr::RegexGenerator::genertateCharacterClassGreedy): (JSC::Yarr::RegexGenerator::genertateCharacterClassNonGreedy): (JSC::Yarr::RegexGenerator::generateParenthesesSingleDisjunctionOneAlternative): (JSC::Yarr::RegexGenerator::generateParenthesesSingle): (JSC::Yarr::RegexGenerator::generateTerm): (JSC::Yarr::RegexGenerator::generateDisjunction): (JSC::Yarr::RegexGenerator::RegexGenerator): (JSC::Yarr::RegexGenerator::generate): (JSC::Yarr::jitCompileRegex): (JSC::Yarr::executeRegex):
  • yarr/RegexJIT.h: Added. (JSC::Yarr::RegexCodeBlock::RegexCodeBlock):
  • yarr/RegexParser.h: Added. (JSC::Yarr::): (JSC::Yarr::Parser::): (JSC::Yarr::Parser::CharacterClassParserDelegate::CharacterClassParserDelegate): (JSC::Yarr::Parser::CharacterClassParserDelegate::begin): (JSC::Yarr::Parser::CharacterClassParserDelegate::atomPatternCharacterUnescaped): (JSC::Yarr::Parser::CharacterClassParserDelegate::atomPatternCharacter): (JSC::Yarr::Parser::CharacterClassParserDelegate::atomBuiltInCharacterClass): (JSC::Yarr::Parser::CharacterClassParserDelegate::end): (JSC::Yarr::Parser::CharacterClassParserDelegate::assertionWordBoundary): (JSC::Yarr::Parser::CharacterClassParserDelegate::atomBackReference): (JSC::Yarr::Parser::CharacterClassParserDelegate::flush): (JSC::Yarr::Parser::CharacterClassParserDelegate::): (JSC::Yarr::Parser::Parser): (JSC::Yarr::Parser::parseEscape): (JSC::Yarr::Parser::parseAtomEscape): (JSC::Yarr::Parser::parseCharacterClassEscape): (JSC::Yarr::Parser::parseCharacterClass): (JSC::Yarr::Parser::parseParenthesesBegin): (JSC::Yarr::Parser::parseParenthesesEnd): (JSC::Yarr::Parser::parseQuantifier): (JSC::Yarr::Parser::parseTokens): (JSC::Yarr::Parser::parse): (JSC::Yarr::Parser::saveState): (JSC::Yarr::Parser::restoreState): (JSC::Yarr::Parser::atEndOfPattern): (JSC::Yarr::Parser::peek): (JSC::Yarr::Parser::peekIsDigit): (JSC::Yarr::Parser::peekDigit): (JSC::Yarr::Parser::consume): (JSC::Yarr::Parser::consumeDigit): (JSC::Yarr::Parser::consumeNumber): (JSC::Yarr::Parser::consumeOctal): (JSC::Yarr::Parser::tryConsume): (JSC::Yarr::Parser::tryConsumeHex): (JSC::Yarr::parse):
  • yarr/RegexPattern.h: Added. (JSC::Yarr::CharacterRange::CharacterRange): (JSC::Yarr::): (JSC::Yarr::PatternTerm::): (JSC::Yarr::PatternTerm::PatternTerm): (JSC::Yarr::PatternTerm::BOL): (JSC::Yarr::PatternTerm::EOL): (JSC::Yarr::PatternTerm::WordBoundary): (JSC::Yarr::PatternTerm::invert): (JSC::Yarr::PatternTerm::capture): (JSC::Yarr::PatternTerm::quantify): (JSC::Yarr::PatternAlternative::PatternAlternative): (JSC::Yarr::PatternAlternative::lastTerm): (JSC::Yarr::PatternAlternative::removeLastTerm): (JSC::Yarr::PatternDisjunction::PatternDisjunction): (JSC::Yarr::PatternDisjunction::~PatternDisjunction): (JSC::Yarr::PatternDisjunction::addNewAlternative): (JSC::Yarr::RegexPattern::RegexPattern): (JSC::Yarr::RegexPattern::~RegexPattern): (JSC::Yarr::RegexPattern::reset): (JSC::Yarr::RegexPattern::containsIllegalBackReference): (JSC::Yarr::RegexPattern::newlineCharacterClass): (JSC::Yarr::RegexPattern::digitsCharacterClass): (JSC::Yarr::RegexPattern::spacesCharacterClass): (JSC::Yarr::RegexPattern::wordcharCharacterClass): (JSC::Yarr::RegexPattern::nondigitsCharacterClass): (JSC::Yarr::RegexPattern::nonspacesCharacterClass): (JSC::Yarr::RegexPattern::nonwordcharCharacterClass):
Location:
trunk/JavaScriptCore
Files:
9 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r42480 r42481  
     12009-04-13  Gavin Barraclough  <[email protected]>
     2
     3        Reviewed by Cap'n Geoff Garen.
     4
     5        Yarr!
     6        (Yet another regex runtime).
     7
     8        Currently disabled by default since the interpreter, whilst awesomely
     9        functional, has not been optimized and is likely slower than PCRE, and
     10        the JIT, whilst faster than WREC, is presently incomplete and does not
     11        fallback to using an interpreter for the cases it cannot handle.
     12
     13        * JavaScriptCore.xcodeproj/project.pbxproj:
     14        * assembler/MacroAssemblerX86Common.h:
     15        (JSC::MacroAssemblerX86Common::move):
     16        (JSC::MacroAssemblerX86Common::swap):
     17        (JSC::MacroAssemblerX86Common::signExtend32ToPtr):
     18        (JSC::MacroAssemblerX86Common::zeroExtend32ToPtr):
     19        (JSC::MacroAssemblerX86Common::branch32):
     20        (JSC::MacroAssemblerX86Common::branch16):
     21        * assembler/X86Assembler.h:
     22        (JSC::X86Assembler::cmpw_im):
     23        (JSC::X86Assembler::testw_rr):
     24        (JSC::X86Assembler::X86InstructionFormatter::immediate16):
     25        * runtime/RegExp.cpp:
     26        (JSC::RegExp::RegExp):
     27        (JSC::RegExp::~RegExp):
     28        (JSC::RegExp::create):
     29        (JSC::RegExp::compile):
     30        (JSC::RegExp::match):
     31        * runtime/RegExp.h:
     32        * wtf/Platform.h:
     33        * yarr: Added.
     34        * yarr/RegexCompiler.cpp: Added.
     35        (JSC::Yarr::CharacterClassConstructor::CharacterClassConstructor):
     36        (JSC::Yarr::CharacterClassConstructor::reset):
     37        (JSC::Yarr::CharacterClassConstructor::append):
     38        (JSC::Yarr::CharacterClassConstructor::putChar):
     39        (JSC::Yarr::CharacterClassConstructor::isUnicodeUpper):
     40        (JSC::Yarr::CharacterClassConstructor::isUnicodeLower):
     41        (JSC::Yarr::CharacterClassConstructor::putRange):
     42        (JSC::Yarr::CharacterClassConstructor::charClass):
     43        (JSC::Yarr::CharacterClassConstructor::addSorted):
     44        (JSC::Yarr::CharacterClassConstructor::addSortedRange):
     45        (JSC::Yarr::newlineCreate):
     46        (JSC::Yarr::digitsCreate):
     47        (JSC::Yarr::spacesCreate):
     48        (JSC::Yarr::wordcharCreate):
     49        (JSC::Yarr::nondigitsCreate):
     50        (JSC::Yarr::nonspacesCreate):
     51        (JSC::Yarr::nonwordcharCreate):
     52        (JSC::Yarr::RegexPatternConstructor::RegexPatternConstructor):
     53        (JSC::Yarr::RegexPatternConstructor::~RegexPatternConstructor):
     54        (JSC::Yarr::RegexPatternConstructor::reset):
     55        (JSC::Yarr::RegexPatternConstructor::assertionBOL):
     56        (JSC::Yarr::RegexPatternConstructor::assertionEOL):
     57        (JSC::Yarr::RegexPatternConstructor::assertionWordBoundary):
     58        (JSC::Yarr::RegexPatternConstructor::atomPatternCharacter):
     59        (JSC::Yarr::RegexPatternConstructor::atomBuiltInCharacterClass):
     60        (JSC::Yarr::RegexPatternConstructor::atomCharacterClassBegin):
     61        (JSC::Yarr::RegexPatternConstructor::atomCharacterClassAtom):
     62        (JSC::Yarr::RegexPatternConstructor::atomCharacterClassRange):
     63        (JSC::Yarr::RegexPatternConstructor::atomCharacterClassBuiltIn):
     64        (JSC::Yarr::RegexPatternConstructor::atomCharacterClassEnd):
     65        (JSC::Yarr::RegexPatternConstructor::atomParenthesesSubpatternBegin):
     66        (JSC::Yarr::RegexPatternConstructor::atomParentheticalAssertionBegin):
     67        (JSC::Yarr::RegexPatternConstructor::atomParenthesesEnd):
     68        (JSC::Yarr::RegexPatternConstructor::atomBackReference):
     69        (JSC::Yarr::RegexPatternConstructor::copyDisjunction):
     70        (JSC::Yarr::RegexPatternConstructor::copyTerm):
     71        (JSC::Yarr::RegexPatternConstructor::quantifyAtom):
     72        (JSC::Yarr::RegexPatternConstructor::disjunction):
     73        (JSC::Yarr::RegexPatternConstructor::regexBegin):
     74        (JSC::Yarr::RegexPatternConstructor::regexEnd):
     75        (JSC::Yarr::RegexPatternConstructor::regexError):
     76        (JSC::Yarr::RegexPatternConstructor::setupAlternativeOffsets):
     77        (JSC::Yarr::RegexPatternConstructor::setupDisjunctionOffsets):
     78        (JSC::Yarr::RegexPatternConstructor::setupOffsets):
     79        (JSC::Yarr::compileRegex):
     80        * yarr/RegexCompiler.h: Added.
     81        * yarr/RegexInterpreter.cpp: Added.
     82        (JSC::Yarr::Interpreter::appendParenthesesDisjunctionContext):
     83        (JSC::Yarr::Interpreter::popParenthesesDisjunctionContext):
     84        (JSC::Yarr::Interpreter::DisjunctionContext::DisjunctionContext):
     85        (JSC::Yarr::Interpreter::DisjunctionContext::operator new):
     86        (JSC::Yarr::Interpreter::allocDisjunctionContext):
     87        (JSC::Yarr::Interpreter::freeDisjunctionContext):
     88        (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::ParenthesesDisjunctionContext):
     89        (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::operator new):
     90        (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::restoreOutput):
     91        (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::getDisjunctionContext):
     92        (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext):
     93        (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext):
     94        (JSC::Yarr::Interpreter::InputStream::InputStream):
     95        (JSC::Yarr::Interpreter::InputStream::next):
     96        (JSC::Yarr::Interpreter::InputStream::rewind):
     97        (JSC::Yarr::Interpreter::InputStream::read):
     98        (JSC::Yarr::Interpreter::InputStream::readChecked):
     99        (JSC::Yarr::Interpreter::InputStream::reread):
     100        (JSC::Yarr::Interpreter::InputStream::prev):
     101        (JSC::Yarr::Interpreter::InputStream::getPos):
     102        (JSC::Yarr::Interpreter::InputStream::setPos):
     103        (JSC::Yarr::Interpreter::InputStream::atStart):
     104        (JSC::Yarr::Interpreter::InputStream::atEnd):
     105        (JSC::Yarr::Interpreter::InputStream::checkInput):
     106        (JSC::Yarr::Interpreter::InputStream::uncheckInput):
     107        (JSC::Yarr::Interpreter::testCharacterClass):
     108        (JSC::Yarr::Interpreter::tryConsumeCharacter):
     109        (JSC::Yarr::Interpreter::checkCharacter):
     110        (JSC::Yarr::Interpreter::tryConsumeCharacterClass):
     111        (JSC::Yarr::Interpreter::checkCharacterClass):
     112        (JSC::Yarr::Interpreter::tryConsumeBackReference):
     113        (JSC::Yarr::Interpreter::matchAssertionBOL):
     114        (JSC::Yarr::Interpreter::matchAssertionEOL):
     115        (JSC::Yarr::Interpreter::matchAssertionWordBoundary):
     116        (JSC::Yarr::Interpreter::matchPatternCharacter):
     117        (JSC::Yarr::Interpreter::backtrackPatternCharacter):
     118        (JSC::Yarr::Interpreter::matchCharacterClass):
     119        (JSC::Yarr::Interpreter::backtrackCharacterClass):
     120        (JSC::Yarr::Interpreter::matchBackReference):
     121        (JSC::Yarr::Interpreter::backtrackBackReference):
     122        (JSC::Yarr::Interpreter::recordParenthesesMatch):
     123        (JSC::Yarr::Interpreter::resetMatches):
     124        (JSC::Yarr::Interpreter::resetAssertionMatches):
     125        (JSC::Yarr::Interpreter::parenthesesDoBacktrack):
     126        (JSC::Yarr::Interpreter::matchParenthesesOnceBegin):
     127        (JSC::Yarr::Interpreter::matchParenthesesOnceEnd):
     128        (JSC::Yarr::Interpreter::backtrackParenthesesOnceBegin):
     129        (JSC::Yarr::Interpreter::backtrackParenthesesOnceEnd):
     130        (JSC::Yarr::Interpreter::matchParentheticalAssertionOnceBegin):
     131        (JSC::Yarr::Interpreter::matchParentheticalAssertionOnceEnd):
     132        (JSC::Yarr::Interpreter::backtrackParentheticalAssertionOnceBegin):
     133        (JSC::Yarr::Interpreter::backtrackParentheticalAssertionOnceEnd):
     134        (JSC::Yarr::Interpreter::matchParentheses):
     135        (JSC::Yarr::Interpreter::backtrackParentheses):
     136        (JSC::Yarr::Interpreter::matchTerm):
     137        (JSC::Yarr::Interpreter::backtrackTerm):
     138        (JSC::Yarr::Interpreter::matchAlternative):
     139        (JSC::Yarr::Interpreter::matchDisjunction):
     140        (JSC::Yarr::Interpreter::matchNonZeroDisjunction):
     141        (JSC::Yarr::Interpreter::interpret):
     142        (JSC::Yarr::Interpreter::Interpreter):
     143        (JSC::Yarr::ByteCompiler::ParenthesesStackEntry::ParenthesesStackEntry):
     144        (JSC::Yarr::ByteCompiler::ByteCompiler):
     145        (JSC::Yarr::ByteCompiler::compile):
     146        (JSC::Yarr::ByteCompiler::checkInput):
     147        (JSC::Yarr::ByteCompiler::assertionBOL):
     148        (JSC::Yarr::ByteCompiler::assertionEOL):
     149        (JSC::Yarr::ByteCompiler::assertionWordBoundary):
     150        (JSC::Yarr::ByteCompiler::atomPatternCharacter):
     151        (JSC::Yarr::ByteCompiler::atomCharacterClass):
     152        (JSC::Yarr::ByteCompiler::atomBackReference):
     153        (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternBegin):
     154        (JSC::Yarr::ByteCompiler::atomParentheticalAssertionBegin):
     155        (JSC::Yarr::ByteCompiler::popParenthesesStack):
     156        (JSC::Yarr::ByteCompiler::dumpDisjunction):
     157        (JSC::Yarr::ByteCompiler::closeAlternative):
     158        (JSC::Yarr::ByteCompiler::atomParenthesesEnd):
     159        (JSC::Yarr::ByteCompiler::regexBegin):
     160        (JSC::Yarr::ByteCompiler::regexEnd):
     161        (JSC::Yarr::ByteCompiler::alterantiveDisjunction):
     162        (JSC::Yarr::ByteCompiler::emitDisjunction):
     163        (JSC::Yarr::byteCompileRegex):
     164        (JSC::Yarr::interpretRegex):
     165        * yarr/RegexInterpreter.h: Added.
     166        (JSC::Yarr::ByteTerm::):
     167        (JSC::Yarr::ByteTerm::ByteTerm):
     168        (JSC::Yarr::ByteTerm::BOL):
     169        (JSC::Yarr::ByteTerm::CheckInput):
     170        (JSC::Yarr::ByteTerm::EOL):
     171        (JSC::Yarr::ByteTerm::WordBoundary):
     172        (JSC::Yarr::ByteTerm::BackReference):
     173        (JSC::Yarr::ByteTerm::AlternativeBegin):
     174        (JSC::Yarr::ByteTerm::AlternativeDisjunction):
     175        (JSC::Yarr::ByteTerm::AlternativeEnd):
     176        (JSC::Yarr::ByteTerm::PatternEnd):
     177        (JSC::Yarr::ByteTerm::invert):
     178        (JSC::Yarr::ByteTerm::capture):
     179        (JSC::Yarr::ByteDisjunction::ByteDisjunction):
     180        (JSC::Yarr::BytecodePattern::BytecodePattern):
     181        (JSC::Yarr::BytecodePattern::~BytecodePattern):
     182        * yarr/RegexJIT.cpp: Added.
     183        (JSC::Yarr::RegexGenerator::optimizeAlternative):
     184        (JSC::Yarr::RegexGenerator::matchCharacterClassRange):
     185        (JSC::Yarr::RegexGenerator::matchCharacterClass):
     186        (JSC::Yarr::RegexGenerator::jumpIfNoAvailableInput):
     187        (JSC::Yarr::RegexGenerator::jumpIfAvailableInput):
     188        (JSC::Yarr::RegexGenerator::checkInput):
     189        (JSC::Yarr::RegexGenerator::atEndOfInput):
     190        (JSC::Yarr::RegexGenerator::notAtEndOfInput):
     191        (JSC::Yarr::RegexGenerator::jumpIfCharEquals):
     192        (JSC::Yarr::RegexGenerator::jumpIfCharNotEquals):
     193        (JSC::Yarr::RegexGenerator::readCharacter):
     194        (JSC::Yarr::RegexGenerator::storeToFrame):
     195        (JSC::Yarr::RegexGenerator::loadFromFrame):
     196        (JSC::Yarr::RegexGenerator::TermGenerationState::TermGenerationState):
     197        (JSC::Yarr::RegexGenerator::TermGenerationState::resetAlternative):
     198        (JSC::Yarr::RegexGenerator::TermGenerationState::alternativeValid):
     199        (JSC::Yarr::RegexGenerator::TermGenerationState::nextAlternative):
     200        (JSC::Yarr::RegexGenerator::TermGenerationState::alternative):
     201        (JSC::Yarr::RegexGenerator::TermGenerationState::resetTerm):
     202        (JSC::Yarr::RegexGenerator::TermGenerationState::termValid):
     203        (JSC::Yarr::RegexGenerator::TermGenerationState::nextTerm):
     204        (JSC::Yarr::RegexGenerator::TermGenerationState::term):
     205        (JSC::Yarr::RegexGenerator::TermGenerationState::lookaheadTerm):
     206        (JSC::Yarr::RegexGenerator::TermGenerationState::isSinglePatternCharacterLookaheadTerm):
     207        (JSC::Yarr::RegexGenerator::TermGenerationState::inputOffset):
     208        (JSC::Yarr::RegexGenerator::TermGenerationState::jumpToBacktrack):
     209        (JSC::Yarr::RegexGenerator::TermGenerationState::setBacktrackGenerated):
     210        (JSC::Yarr::RegexGenerator::jumpToBacktrackCheckEmitPending):
     211        (JSC::Yarr::RegexGenerator::genertateAssertionBOL):
     212        (JSC::Yarr::RegexGenerator::genertateAssertionEOL):
     213        (JSC::Yarr::RegexGenerator::matchAssertionWordchar):
     214        (JSC::Yarr::RegexGenerator::genertateAssertionWordBoundary):
     215        (JSC::Yarr::RegexGenerator::genertatePatternCharacterSingle):
     216        (JSC::Yarr::RegexGenerator::genertatePatternCharacterPair):
     217        (JSC::Yarr::RegexGenerator::genertatePatternCharacterFixed):
     218        (JSC::Yarr::RegexGenerator::genertatePatternCharacterGreedy):
     219        (JSC::Yarr::RegexGenerator::genertatePatternCharacterNonGreedy):
     220        (JSC::Yarr::RegexGenerator::genertateCharacterClassSingle):
     221        (JSC::Yarr::RegexGenerator::genertateCharacterClassFixed):
     222        (JSC::Yarr::RegexGenerator::genertateCharacterClassGreedy):
     223        (JSC::Yarr::RegexGenerator::genertateCharacterClassNonGreedy):
     224        (JSC::Yarr::RegexGenerator::generateParenthesesSingleDisjunctionOneAlternative):
     225        (JSC::Yarr::RegexGenerator::generateParenthesesSingle):
     226        (JSC::Yarr::RegexGenerator::generateTerm):
     227        (JSC::Yarr::RegexGenerator::generateDisjunction):
     228        (JSC::Yarr::RegexGenerator::RegexGenerator):
     229        (JSC::Yarr::RegexGenerator::generate):
     230        (JSC::Yarr::jitCompileRegex):
     231        (JSC::Yarr::executeRegex):
     232        * yarr/RegexJIT.h: Added.
     233        (JSC::Yarr::RegexCodeBlock::RegexCodeBlock):
     234        * yarr/RegexParser.h: Added.
     235        (JSC::Yarr::):
     236        (JSC::Yarr::Parser::):
     237        (JSC::Yarr::Parser::CharacterClassParserDelegate::CharacterClassParserDelegate):
     238        (JSC::Yarr::Parser::CharacterClassParserDelegate::begin):
     239        (JSC::Yarr::Parser::CharacterClassParserDelegate::atomPatternCharacterUnescaped):
     240        (JSC::Yarr::Parser::CharacterClassParserDelegate::atomPatternCharacter):
     241        (JSC::Yarr::Parser::CharacterClassParserDelegate::atomBuiltInCharacterClass):
     242        (JSC::Yarr::Parser::CharacterClassParserDelegate::end):
     243        (JSC::Yarr::Parser::CharacterClassParserDelegate::assertionWordBoundary):
     244        (JSC::Yarr::Parser::CharacterClassParserDelegate::atomBackReference):
     245        (JSC::Yarr::Parser::CharacterClassParserDelegate::flush):
     246        (JSC::Yarr::Parser::CharacterClassParserDelegate::):
     247        (JSC::Yarr::Parser::Parser):
     248        (JSC::Yarr::Parser::parseEscape):
     249        (JSC::Yarr::Parser::parseAtomEscape):
     250        (JSC::Yarr::Parser::parseCharacterClassEscape):
     251        (JSC::Yarr::Parser::parseCharacterClass):
     252        (JSC::Yarr::Parser::parseParenthesesBegin):
     253        (JSC::Yarr::Parser::parseParenthesesEnd):
     254        (JSC::Yarr::Parser::parseQuantifier):
     255        (JSC::Yarr::Parser::parseTokens):
     256        (JSC::Yarr::Parser::parse):
     257        (JSC::Yarr::Parser::saveState):
     258        (JSC::Yarr::Parser::restoreState):
     259        (JSC::Yarr::Parser::atEndOfPattern):
     260        (JSC::Yarr::Parser::peek):
     261        (JSC::Yarr::Parser::peekIsDigit):
     262        (JSC::Yarr::Parser::peekDigit):
     263        (JSC::Yarr::Parser::consume):
     264        (JSC::Yarr::Parser::consumeDigit):
     265        (JSC::Yarr::Parser::consumeNumber):
     266        (JSC::Yarr::Parser::consumeOctal):
     267        (JSC::Yarr::Parser::tryConsume):
     268        (JSC::Yarr::Parser::tryConsumeHex):
     269        (JSC::Yarr::parse):
     270        * yarr/RegexPattern.h: Added.
     271        (JSC::Yarr::CharacterRange::CharacterRange):
     272        (JSC::Yarr::):
     273        (JSC::Yarr::PatternTerm::):
     274        (JSC::Yarr::PatternTerm::PatternTerm):
     275        (JSC::Yarr::PatternTerm::BOL):
     276        (JSC::Yarr::PatternTerm::EOL):
     277        (JSC::Yarr::PatternTerm::WordBoundary):
     278        (JSC::Yarr::PatternTerm::invert):
     279        (JSC::Yarr::PatternTerm::capture):
     280        (JSC::Yarr::PatternTerm::quantify):
     281        (JSC::Yarr::PatternAlternative::PatternAlternative):
     282        (JSC::Yarr::PatternAlternative::lastTerm):
     283        (JSC::Yarr::PatternAlternative::removeLastTerm):
     284        (JSC::Yarr::PatternDisjunction::PatternDisjunction):
     285        (JSC::Yarr::PatternDisjunction::~PatternDisjunction):
     286        (JSC::Yarr::PatternDisjunction::addNewAlternative):
     287        (JSC::Yarr::RegexPattern::RegexPattern):
     288        (JSC::Yarr::RegexPattern::~RegexPattern):
     289        (JSC::Yarr::RegexPattern::reset):
     290        (JSC::Yarr::RegexPattern::containsIllegalBackReference):
     291        (JSC::Yarr::RegexPattern::newlineCharacterClass):
     292        (JSC::Yarr::RegexPattern::digitsCharacterClass):
     293        (JSC::Yarr::RegexPattern::spacesCharacterClass):
     294        (JSC::Yarr::RegexPattern::wordcharCharacterClass):
     295        (JSC::Yarr::RegexPattern::nondigitsCharacterClass):
     296        (JSC::Yarr::RegexPattern::nonspacesCharacterClass):
     297        (JSC::Yarr::RegexPattern::nonwordcharCharacterClass):
     298
    12992009-04-13  Oliver Hunt  <[email protected]>
    2300
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r42344 r42481  
    126126                86CC85C40EE7A89400288682 /* JITPropertyAccess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */; };
    127127                86CCEFDE0F413F8900FD7F9E /* JITCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CCEFDD0F413F8900FD7F9E /* JITCode.h */; };
     128                86EAC4950F93E8D1008EC948 /* RegexCompiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EAC48D0F93E8D1008EC948 /* RegexCompiler.cpp */; };
     129                86EAC4960F93E8D1008EC948 /* RegexCompiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EAC48E0F93E8D1008EC948 /* RegexCompiler.h */; };
     130                86EAC4970F93E8D1008EC948 /* RegexInterpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EAC48F0F93E8D1008EC948 /* RegexInterpreter.cpp */; };
     131                86EAC4980F93E8D1008EC948 /* RegexInterpreter.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EAC4900F93E8D1008EC948 /* RegexInterpreter.h */; };
     132                86EAC4990F93E8D1008EC948 /* RegexJIT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EAC4910F93E8D1008EC948 /* RegexJIT.cpp */; };
     133                86EAC49A0F93E8D1008EC948 /* RegexJIT.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EAC4920F93E8D1008EC948 /* RegexJIT.h */; };
     134                86EAC49B0F93E8D1008EC948 /* RegexParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EAC4930F93E8D1008EC948 /* RegexParser.h */; };
     135                86EAC49C0F93E8D1008EC948 /* RegexPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EAC4940F93E8D1008EC948 /* RegexPattern.h */; };
    128136                905B02AE0E28640F006DF882 /* RefCountedLeakCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 905B02AD0E28640F006DF882 /* RefCountedLeakCounter.cpp */; };
    129137                90D3469C0E285280009492EE /* RefCountedLeakCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D3469B0E285280009492EE /* RefCountedLeakCounter.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    607615                86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess.cpp; sourceTree = "<group>"; };
    608616                86CCEFDD0F413F8900FD7F9E /* JITCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITCode.h; sourceTree = "<group>"; };
     617                86EAC48D0F93E8D1008EC948 /* RegexCompiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegexCompiler.cpp; path = yarr/RegexCompiler.cpp; sourceTree = "<group>"; };
     618                86EAC48E0F93E8D1008EC948 /* RegexCompiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexCompiler.h; path = yarr/RegexCompiler.h; sourceTree = "<group>"; };
     619                86EAC48F0F93E8D1008EC948 /* RegexInterpreter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegexInterpreter.cpp; path = yarr/RegexInterpreter.cpp; sourceTree = "<group>"; };
     620                86EAC4900F93E8D1008EC948 /* RegexInterpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexInterpreter.h; path = yarr/RegexInterpreter.h; sourceTree = "<group>"; };
     621                86EAC4910F93E8D1008EC948 /* RegexJIT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegexJIT.cpp; path = yarr/RegexJIT.cpp; sourceTree = "<group>"; };
     622                86EAC4920F93E8D1008EC948 /* RegexJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexJIT.h; path = yarr/RegexJIT.h; sourceTree = "<group>"; };
     623                86EAC4930F93E8D1008EC948 /* RegexParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexParser.h; path = yarr/RegexParser.h; sourceTree = "<group>"; };
     624                86EAC4940F93E8D1008EC948 /* RegexPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexPattern.h; path = yarr/RegexPattern.h; sourceTree = "<group>"; };
    609625                905B02AD0E28640F006DF882 /* RefCountedLeakCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefCountedLeakCounter.cpp; sourceTree = "<group>"; };
    610626                90D3469B0E285280009492EE /* RefCountedLeakCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCountedLeakCounter.h; sourceTree = "<group>"; };
     
    932948                                869083120E6518D7000D36ED /* wrec */,
    933949                                65162EF108E6A21C007556CD /* wtf */,
     950                                86EAC48C0F93E8B9008EC948 /* yarr */,
    934951                                1C90513E0BA9E8830081E9D0 /* Configurations */,
    935952                                650FDF8D09D0FCA700769E54 /* Derived Sources */,
     
    14201437                        );
    14211438                        path = wrec;
     1439                        sourceTree = "<group>";
     1440                };
     1441                86EAC48C0F93E8B9008EC948 /* yarr */ = {
     1442                        isa = PBXGroup;
     1443                        children = (
     1444                                86EAC48D0F93E8D1008EC948 /* RegexCompiler.cpp */,
     1445                                86EAC48E0F93E8D1008EC948 /* RegexCompiler.h */,
     1446                                86EAC48F0F93E8D1008EC948 /* RegexInterpreter.cpp */,
     1447                                86EAC4900F93E8D1008EC948 /* RegexInterpreter.h */,
     1448                                86EAC4910F93E8D1008EC948 /* RegexJIT.cpp */,
     1449                                86EAC4920F93E8D1008EC948 /* RegexJIT.h */,
     1450                                86EAC4930F93E8D1008EC948 /* RegexParser.h */,
     1451                                86EAC4940F93E8D1008EC948 /* RegexPattern.h */,
     1452                        );
     1453                        name = yarr;
    14221454                        sourceTree = "<group>";
    14231455                };
     
    17531785                                14A42E400F4F60EE00599099 /* TimeoutChecker.h in Headers */,
    17541786                                E48E0F2D0F82151700A8CA37 /* FastAllocBase.h in Headers */,
     1787                                86EAC4960F93E8D1008EC948 /* RegexCompiler.h in Headers */,
     1788                                86EAC4980F93E8D1008EC948 /* RegexInterpreter.h in Headers */,
     1789                                86EAC49A0F93E8D1008EC948 /* RegexJIT.h in Headers */,
     1790                                86EAC49B0F93E8D1008EC948 /* RegexParser.h in Headers */,
     1791                                86EAC49C0F93E8D1008EC948 /* RegexPattern.h in Headers */,
    17551792                        );
    17561793                        runOnlyForDeploymentPostprocessing = 0;
     
    21082145                                0B330C270F38C62300692DE3 /* TypeTraits.cpp in Sources */,
    21092146                                14A42E3F0F4F60EE00599099 /* TimeoutChecker.cpp in Sources */,
     2147                                86EAC4950F93E8D1008EC948 /* RegexCompiler.cpp in Sources */,
     2148                                86EAC4970F93E8D1008EC948 /* RegexInterpreter.cpp in Sources */,
     2149                                86EAC4990F93E8D1008EC948 /* RegexJIT.cpp in Sources */,
    21102150                        );
    21112151                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/JavaScriptCore/assembler/MacroAssemblerX86Common.h

    r41089 r42481  
    328328    void move(RegisterID src, RegisterID dest)
    329329    {
    330         m_assembler.movl_rr(src, dest);
     330        if (src != dest)
     331            m_assembler.movl_rr(src, dest);
    331332    }
    332333
     
    338339    void swap(RegisterID reg1, RegisterID reg2)
    339340    {
    340         m_assembler.xchgl_rr(reg1, reg2);
     341        if (reg1 != reg2)
     342            m_assembler.xchgl_rr(reg1, reg2);
    341343    }
    342344
    343345    void signExtend32ToPtr(RegisterID src, RegisterID dest)
    344346    {
    345         if (src != dest)
    346             move(src, dest);
     347        move(src, dest);
    347348    }
    348349
    349350    void zeroExtend32ToPtr(RegisterID src, RegisterID dest)
    350351    {
    351         if (src != dest)
    352             move(src, dest);
     352        move(src, dest);
    353353    }
    354354#endif
     
    407407    }
    408408
     409    Jump branch32(Condition cond, BaseIndex left, Imm32 right)
     410    {
     411        m_assembler.cmpl_im(right.m_value, left.offset, left.base, left.index, left.scale);
     412        return Jump(m_assembler.jCC(cond));
     413    }
     414
    409415    Jump branch16(Condition cond, BaseIndex left, RegisterID right)
    410416    {
    411417        m_assembler.cmpw_rm(right, left.offset, left.base, left.index, left.scale);
     418        return Jump(m_assembler.jCC(cond));
     419    }
     420
     421    Jump branch16(Condition cond, BaseIndex left, Imm32 right)
     422    {
     423        ASSERT(!(right.m_value & 0xFFFF0000));
     424
     425        m_assembler.cmpw_im(right.m_value, left.offset, left.base, left.index, left.scale);
    412426        return Jump(m_assembler.jCC(cond));
    413427    }
  • trunk/JavaScriptCore/assembler/X86Assembler.h

    r41544 r42481  
    727727    }
    728728
     729    void cmpw_im(int imm, int offset, RegisterID base, RegisterID index, int scale)
     730    {
     731        if (CAN_SIGN_EXTEND_8_32(imm)) {
     732            m_formatter.prefix(PRE_OPERAND_SIZE);
     733            m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_CMP, base, index, scale, offset);
     734            m_formatter.immediate8(imm);
     735        } else {
     736            m_formatter.prefix(PRE_OPERAND_SIZE);
     737            m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_CMP, base, index, scale, offset);
     738            m_formatter.immediate16(imm);
     739        }
     740    }
     741
    729742    void testl_rr(RegisterID src, RegisterID dst)
    730743    {
     
    775788#endif
    776789
     790    void testw_rr(RegisterID src, RegisterID dst)
     791    {
     792        m_formatter.prefix(PRE_OPERAND_SIZE);
     793        m_formatter.oneByteOp(OP_TEST_EvGv, src, dst);
     794    }
     795   
    777796    void testb_i8r(int imm, RegisterID dst)
    778797    {
     
    16051624        }
    16061625
     1626        void immediate16(int imm)
     1627        {
     1628            m_buffer.putShortUnchecked(imm);
     1629        }
     1630
    16071631        void immediate32(int imm)
    16081632        {
  • trunk/JavaScriptCore/runtime/RegExp.cpp

    r40562 r42481  
    2121#include "config.h"
    2222#include "RegExp.h"
    23 
    24 #include "JIT.h"
    2523#include "Lexer.h"
    26 #include "WRECGenerator.h"
    27 #include <pcre/pcre.h>
    2824#include <stdio.h>
    2925#include <stdlib.h>
     
    3228#include <wtf/OwnArrayPtr.h>
    3329
     30
     31#if ENABLE(YARR)
     32
     33#include "RegexCompiler.h"
     34#if ENABLE(YARR_JIT)
     35#include "RegexJIT.h"
     36#else
     37#include "RegexInterpreter.h"
     38#endif
     39
     40#else
     41
     42#if ENABLE(WREC)
     43#include "JIT.h"
     44#include "WRECGenerator.h"
     45#endif
     46#include <pcre/pcre.h>
     47
     48#endif
     49
    3450namespace JSC {
    3551
     
    4157    : m_pattern(pattern)
    4258    , m_flagBits(0)
    43     , m_regExp(0)
    4459    , m_constructionError(0)
    4560    , m_numSubpatterns(0)
    4661{
    47 #if ENABLE(WREC)
    48     m_wrecFunction = Generator::compileRegExp(globalData, pattern, &m_numSubpatterns, &m_constructionError, m_executablePool);
    49     if (m_wrecFunction || m_constructionError)
    50         return;
    51     // Fall through to non-WREC case.
    52 #else
    53     UNUSED_PARAM(globalData);
    54 #endif
    55     m_regExp = jsRegExpCompile(reinterpret_cast<const UChar*>(pattern.data()), pattern.size(),
    56         JSRegExpDoNotIgnoreCase, JSRegExpSingleLine, &m_numSubpatterns, &m_constructionError);
    57 }
    58 
    59 PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& pattern)
    60 {
    61     return adoptRef(new RegExp(globalData, pattern));
     62    compile(globalData);
    6263}
    6364
     
    6667    , m_flags(flags)
    6768    , m_flagBits(0)
    68     , m_regExp(0)
    6969    , m_constructionError(0)
    7070    , m_numSubpatterns(0)
     
    7474    if (flags.find('g') != -1)
    7575        m_flagBits |= Global;
    76 
    77     // FIXME: Eliminate duplication by adding a way ask a JSRegExp what its flags are?
    78     JSRegExpIgnoreCaseOption ignoreCaseOption = JSRegExpDoNotIgnoreCase;
    79     if (flags.find('i') != -1) {
     76    if (flags.find('i') != -1)
    8077        m_flagBits |= IgnoreCase;
    81         ignoreCaseOption = JSRegExpIgnoreCase;
     78    if (flags.find('m') != -1)
     79        m_flagBits |= Multiline;
     80
     81    compile(globalData);
     82}
     83
     84#if !ENABLE(YARR)
     85RegExp::~RegExp()
     86{
     87    jsRegExpFree(m_regExp);
     88}
     89#endif
     90
     91PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& pattern)
     92{
     93    return adoptRef(new RegExp(globalData, pattern));
     94}
     95
     96PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& pattern, const UString& flags)
     97{
     98    return adoptRef(new RegExp(globalData, pattern, flags));
     99}
     100
     101#if ENABLE(YARR)
     102
     103void RegExp::compile(JSGlobalData* globalData)
     104{
     105#if ENABLE(YARR_JIT)
     106    Yarr::jitCompileRegex(globalData, m_regExpJITCode, m_pattern, m_numSubpatterns, m_constructionError, ignoreCase(), multiline());
     107#else
     108    UNUSED_PARAM(globalData);
     109    m_regExpBytecode.set(Yarr::byteCompileRegex(m_pattern, m_numSubpatterns, m_constructionError, ignoreCase(), multiline()));
     110#endif
     111}
     112
     113int RegExp::match(const UString& s, int startOffset, OwnArrayPtr<int>* ovector)
     114{
     115    if (startOffset < 0)
     116        startOffset = 0;
     117    if (ovector)
     118        ovector->clear();
     119
     120    if (startOffset > s.size() || s.isNull())
     121        return -1;
     122
     123#if ENABLE(YARR_JIT)
     124    if (m_regExpJITCode.m_jitCode) {
     125#else
     126    if (m_regExpBytecode) {
     127#endif
     128        int offsetVectorSize = (m_numSubpatterns + 1) * 2;
     129        int* offsetVector = new int [offsetVectorSize];
     130        ASSERT(offsetVector);
     131        for (int j = 0; j < offsetVectorSize; ++j)
     132            offsetVector[j] = -1;
     133
     134        OwnArrayPtr<int> nonReturnedOvector;
     135        if (!ovector)
     136            nonReturnedOvector.set(offsetVector);
     137        else
     138            ovector->set(offsetVector);
     139
     140#if ENABLE(YARR_JIT)
     141        int result = Yarr::executeRegex(m_regExpJITCode, s.data(), startOffset, s.size(), offsetVector);
     142#else
     143        int result = Yarr::interpretRegex(m_regExpBytecode.get(), s.data(), startOffset, s.size(), offsetVector);
     144#endif
     145
     146        if (result < 0) {
     147#ifndef NDEBUG
     148            // TODO: define up a symbol, rather than magic -1
     149            if (result != -1)
     150                fprintf(stderr, "jsRegExpExecute failed with result %d\n", result);
     151#endif
     152            if (ovector)
     153                ovector->clear();
     154        }
     155        return result;
    82156    }
    83157
    84     JSRegExpMultilineOption multilineOption = JSRegExpSingleLine;
    85     if (flags.find('m') != -1) {
    86         m_flagBits |= Multiline;
    87         multilineOption = JSRegExpMultiline;
    88     }
    89 
    90 #if ENABLE(WREC)
    91     m_wrecFunction = Generator::compileRegExp(globalData, pattern, &m_numSubpatterns, &m_constructionError, m_executablePool, (m_flagBits & IgnoreCase), (m_flagBits & Multiline));
     158    return -1;
     159}
     160
     161#else
     162
     163void RegExp::compile(JSGlobalData* globalData)
     164{
     165    m_regExp = 0;
     166#if ENABLE(WREC)
     167    m_wrecFunction = Generator::compileRegExp(globalData, m_pattern, &m_numSubpatterns, &m_constructionError, m_executablePool, ignoreCase(), multiline());
    92168    if (m_wrecFunction || m_constructionError)
    93169        return;
     
    96172    UNUSED_PARAM(globalData);
    97173#endif
    98     m_regExp = jsRegExpCompile(reinterpret_cast<const UChar*>(pattern.data()), pattern.size(),
    99         ignoreCaseOption, multilineOption, &m_numSubpatterns, &m_constructionError);
    100 }
    101 
    102 PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& pattern, const UString& flags)
    103 {
    104     return adoptRef(new RegExp(globalData, pattern, flags));
    105 }
    106 
    107 RegExp::~RegExp()
    108 {
    109     jsRegExpFree(m_regExp);
     174
     175    JSRegExpIgnoreCaseOption ignoreCaseOption = ignoreCase() ? JSRegExpIgnoreCase : JSRegExpDoNotIgnoreCase;
     176    JSRegExpMultilineOption multilineOption = multiline() ? JSRegExpMultiline : JSRegExpSingleLine;
     177    m_regExp = jsRegExpCompile(reinterpret_cast<const UChar*>(m_pattern.data()), m_pattern.size(), ignoreCaseOption, multilineOption, &m_numSubpatterns, &m_constructionError);
    110178}
    111179
     
    181249}
    182250
     251#endif
     252
    183253} // namespace JSC
  • trunk/JavaScriptCore/runtime/RegExp.h

    r39554 r42481  
    2727#include <wtf/Forward.h>
    2828#include <wtf/RefCounted.h>
     29#include "RegexJIT.h"
     30#include "RegexInterpreter.h"
    2931
    3032struct JSRegExp;
     
    3840        static PassRefPtr<RegExp> create(JSGlobalData* globalData, const UString& pattern);
    3941        static PassRefPtr<RegExp> create(JSGlobalData* globalData, const UString& pattern, const UString& flags);
     42#if !ENABLE(YARR)
    4043        ~RegExp();
     44#endif
    4145
    4246        bool global() const { return m_flagBits & Global; }
     
    5761        RegExp(JSGlobalData* globalData, const UString& pattern, const UString& flags);
    5862
    59         void compile();
     63        void compile(JSGlobalData*);
    6064
    6165        enum FlagBits { Global = 1, IgnoreCase = 2, Multiline = 4 };
     
    6468        UString m_flags; // FIXME: Just decompile m_regExp instead of storing this.
    6569        int m_flagBits;
    66         JSRegExp* m_regExp;
    6770        const char* m_constructionError;
    6871        unsigned m_numSubpatterns;
    6972
     73#if ENABLE(YARR_JIT)
     74        Yarr::RegexCodeBlock m_regExpJITCode;
     75#elif ENABLE(YARR)
     76        OwnPtr<Yarr::BytecodePattern> m_regExpBytecode;
     77#else
    7078#if ENABLE(WREC)
    7179        WREC::CompiledRegExp m_wrecFunction;
    7280        RefPtr<ExecutablePool> m_executablePool;
     81#endif
     82        JSRegExp* m_regExp;
    7383#endif
    7484    };
  • trunk/JavaScriptCore/wtf/Platform.h

    r42344 r42481  
    507507#endif
    508508
     509// Yet Another Regex Runtime.
     510#define ENABLE_YARR 0
     511#define ENABLE_YARR_JIT 0
     512#if ENABLE(YARR_JIT) && !ENABLE(YARR)
     513#error "YARR_JIT requires YARR"
     514#endif
     515
    509516#if ENABLE(JIT) || ENABLE(WREC)
    510517#define ENABLE_ASSEMBLER 1
Note: See TracChangeset for help on using the changeset viewer.