Ignore:
Timestamp:
Nov 8, 2011, 2:49:27 PM (14 years ago)
Author:
[email protected]
Message:

Towards 8 Bit Strings: Templatize JSC::Parser class by Lexer type
https://bugs.webkit.org/show_bug.cgi?id=71761

Source/JavaScriptCore:

Templatized Parser based on Lexer<T>. Moved two enums,
SourceElementsMode and FunctionRequirements out of Parser definition
to work around a clang compiler defect.

Cleaned up SourceCode data() to return StringImpl* and eliminated
the recently added stringData() virtual method.

To keep code in Parser.cpp and keep Parser.h small, the two flavors
of Parser are explicitly instantiated at the end of Parser.cpp.

Reviewed by Gavin Barraclough.

  • interpreter/Interpreter.cpp:

(JSC::appendSourceToError):

  • parser/Lexer.cpp:

(JSC::::setCode):
(JSC::::sourceCode):

  • parser/Parser.cpp:

(JSC::::Parser):
(JSC::::~Parser):
(JSC::::parseInner):
(JSC::::didFinishParsing):
(JSC::::allowAutomaticSemicolon):
(JSC::::parseSourceElements):
(JSC::::parseVarDeclaration):
(JSC::::parseConstDeclaration):
(JSC::::parseDoWhileStatement):
(JSC::::parseWhileStatement):
(JSC::::parseVarDeclarationList):
(JSC::::parseConstDeclarationList):
(JSC::::parseForStatement):
(JSC::::parseBreakStatement):
(JSC::::parseContinueStatement):
(JSC::::parseReturnStatement):
(JSC::::parseThrowStatement):
(JSC::::parseWithStatement):
(JSC::::parseSwitchStatement):
(JSC::::parseSwitchClauses):
(JSC::::parseSwitchDefaultClause):
(JSC::::parseTryStatement):
(JSC::::parseDebuggerStatement):
(JSC::::parseBlockStatement):
(JSC::::parseStatement):
(JSC::::parseFormalParameters):
(JSC::::parseFunctionBody):
(JSC::::parseFunctionInfo):
(JSC::::parseFunctionDeclaration):
(JSC::::parseExpressionOrLabelStatement):
(JSC::::parseExpressionStatement):
(JSC::::parseIfStatement):
(JSC::::parseExpression):
(JSC::::parseAssignmentExpression):
(JSC::::parseConditionalExpression):
(JSC::::isBinaryOperator):
(JSC::::parseBinaryExpression):
(JSC::::parseProperty):
(JSC::::parseObjectLiteral):
(JSC::::parseStrictObjectLiteral):
(JSC::::parseArrayLiteral):
(JSC::::parsePrimaryExpression):
(JSC::::parseArguments):
(JSC::::parseMemberExpression):
(JSC::::parseUnaryExpression):

  • parser/Parser.h:

(JSC::::parse):
(JSC::parse):

  • parser/SourceCode.h:

(JSC::SourceCode::data):
(JSC::SourceCode::subExpression):

  • parser/SourceProvider.h:

(JSC::UStringSourceProvider::data):

Source/WebCore:

Cleaned up SourceCode data() to return StringImpl* and eliminated
the recently added stringData() virtual method.

No tests added - refactored base class SourceCode and its subclasses.

  • bindings/js/CachedScriptSourceProvider.h:

(WebCore::CachedScriptSourceProvider::data):

  • bindings/js/ScriptDebugServer.cpp:

(WebCore::ScriptDebugServer::dispatchDidParseSource):
(WebCore::ScriptDebugServer::dispatchFailedToParseSource):

  • bindings/js/StringSourceProvider.h:

(WebCore::StringSourceProvider::data):

Source/WebKit/mac:

Changed WKPCEvaluate() to use emptyString() when the source is
zero length.

Reviewed by Gavin Barraclough.

  • Plugins/Hosted/NetscapePluginHostProxy.mm:

(WKPCEvaluate):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/SourceCode.h

    r99436 r99618  
    7373        int startOffset() const { return m_startChar; }
    7474        int endOffset() const { return m_endChar; }
    75         const UChar* data() const { return m_provider->data() + m_startChar; }
     75        const UChar* data() const
     76        {
     77            ASSERT(m_provider->data());
     78            return m_provider->data()->characters16() + m_startChar;
     79        }
    7680        int length() const { return m_endChar - m_startChar; }
    7781       
     
    9296    inline SourceCode SourceCode::subExpression(unsigned openBrace, unsigned closeBrace, int firstLine)
    9397    {
    94         ASSERT(provider()->data()[openBrace] == '{');
    95         ASSERT(provider()->data()[closeBrace] == '}');
     98        ASSERT((*provider()->data())[openBrace] == '{');
     99        ASSERT((*provider()->data())[closeBrace] == '}');
    96100        return SourceCode(provider(), openBrace, closeBrace + 1, firstLine);
    97101    }
Note: See TracChangeset for help on using the changeset viewer.