Ignore:
Timestamp:
May 13, 2009, 2:53:59 PM (16 years ago)
Author:
Darin Adler
Message:

JavaScriptCore:

2009-05-13 Darin Adler <Darin Adler>

Revert the parser arena change. It was a slowdown, not a speedup.
Better luck next time (I'll break it up into pieces).

WebCore:

2009-05-13 Darin Adler <Darin Adler>

Revert the parser arena change. It was a slowdown, not a speedup.
Better luck next time (I'll break it up into pieces).

WebKit/mac:

2009-05-13 Darin Adler <Darin Adler>

Revert the parser arena change. It was a slowdown, not a speedup.
Better luck next time (I'll break it up into pieces).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/parser/Lexer.cpp

    r43642 r43661  
    142142}
    143143
    144 void Lexer::setCode(const SourceCode& source, ParserArena& arena)
    145 {
    146     m_arena = &arena.identifierArena();
    147 
     144void Lexer::setCode(const SourceCode& source)
     145{
    148146    m_lineNumber = source.firstLine();
    149147    m_delimited = false;
     
    207205}
    208206
    209 ALWAYS_INLINE const Identifier* Lexer::makeIdentifier(const UChar* characters, size_t length)
    210 {
    211     return &JSC::makeIdentifier(*m_arena, m_globalData, characters, length);
     207ALWAYS_INLINE Identifier* Lexer::makeIdentifier(const UChar* characters, size_t length)
     208{
     209    m_identifiers.append(Identifier(m_globalData, characters, length));
     210    return &m_identifiers.last();
    212211}
    213212
     
    910909}
    911910
    912 bool Lexer::scanRegExp(const Identifier*& pattern, const Identifier*& flags, UChar prefix)
     911bool Lexer::scanRegExp()
    913912{
    914913    ASSERT(m_buffer16.isEmpty());
    915914
    916     bool lastWasEscape = false;
    917     bool inBrackets = false;
    918 
    919     if (prefix)
    920         record16(prefix);
    921 
    922     while (true) {
    923         if (isLineTerminator(m_current) || m_current == -1) {
    924             m_buffer16.resize(0);
    925             return false;
    926         }
    927         if (m_current != '/' || lastWasEscape || inBrackets) {
    928             // keep track of '[' and ']'
    929             if (!lastWasEscape) {
    930                 if (m_current == '[' && !inBrackets)
    931                     inBrackets = true;
    932                 if (m_current == ']' && inBrackets)
    933                     inBrackets = false;
    934             }
    935             record16(m_current);
    936             lastWasEscape = !lastWasEscape && m_current == '\\';
    937         } else { // end of regexp
    938             pattern = makeIdentifier(m_buffer16.data(), m_buffer16.size());
    939             m_buffer16.resize(0);
    940             shift1();
    941             break;
    942         }
    943         shift1();
    944     }
    945 
    946     while (isIdentPart(m_current)) {
    947         record16(m_current);
    948         shift1();
    949     }
    950     flags = makeIdentifier(m_buffer16.data(), m_buffer16.size());
    951     m_buffer16.resize(0);
    952 
    953     return true;
    954 }
    955 
    956 bool Lexer::skipRegExp()
    957 {
    958915    bool lastWasEscape = false;
    959916    bool inBrackets = false;
     
    970927                    inBrackets = false;
    971928            }
     929            record16(m_current);
    972930            lastWasEscape = !lastWasEscape && m_current == '\\';
    973931        } else { // end of regexp
    974             shift1();
    975             break;
    976         }
    977         shift1();
    978     }
    979 
    980     while (isIdentPart(m_current))
    981         shift1();
     932            m_pattern = UString(m_buffer16);
     933            m_buffer16.resize(0);
     934            shift1();
     935            break;
     936        }
     937        shift1();
     938    }
     939
     940    while (isIdentPart(m_current)) {
     941        record16(m_current);
     942        shift1();
     943    }
     944    m_flags = UString(m_buffer16);
     945    m_buffer16.resize(0);
    982946
    983947    return true;
     
    986950void Lexer::clear()
    987951{
    988     m_arena = 0;
     952    m_identifiers.clear();
    989953    m_codeWithoutBOMs.clear();
    990954
     
    998962
    999963    m_isReparsing = false;
     964
     965    m_pattern = UString();
     966    m_flags = UString();
    1000967}
    1001968
Note: See TracChangeset for help on using the changeset viewer.