Ignore:
Timestamp:
Jun 18, 2011, 1:47:10 AM (14 years ago)
Author:
[email protected]
Message:

2011-06-18 Sheriff Bot <[email protected]>

Unreviewed, rolling out r89184.
http://trac.webkit.org/changeset/89184
https://bugs.webkit.org/show_bug.cgi?id=62927

It broke 22 tests on all bot (Requested by Ossy_weekend on
#webkit).

  • API/JSValueRef.cpp: (JSValueMakeFromJSONString):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::callEval): (JSC::Interpreter::execute):
  • parser/Lexer.cpp:
  • parser/Lexer.h:
  • runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncEval):
  • runtime/JSONObject.cpp: (JSC::JSONProtoFuncParse):
  • runtime/LiteralParser.cpp: (JSC::LiteralParser::Lexer::lex): (JSC::isSafeStringCharacter): (JSC::LiteralParser::Lexer::lexString): (JSC::LiteralParser::Lexer::lexNumber): (JSC::LiteralParser::parse):
  • runtime/LiteralParser.h: (JSC::LiteralParser::LiteralParser): (JSC::LiteralParser::tryLiteralParse): (JSC::LiteralParser::Lexer::Lexer): (JSC::LiteralParser::Lexer::next):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/LiteralParser.h

    r89184 r89192  
    2727#define LiteralParser_h
    2828
    29 #include "Identifier.h"
    3029#include "JSGlobalObjectFunctions.h"
    3130#include "JSValue.h"
     
    3635    class LiteralParser {
    3736    public:
    38         typedef enum { StrictJSON, NonStrictJSON, JSONP } ParserMode;
    39         LiteralParser(ExecState* exec, const UChar* characters, unsigned length, ParserMode mode)
     37        typedef enum { StrictJSON, NonStrictJSON } ParserMode;
     38        LiteralParser(ExecState* exec, const UString& s, ParserMode mode)
    4039            : m_exec(exec)
    41             , m_lexer(characters, length, mode)
     40            , m_lexer(s, mode)
    4241            , m_mode(mode)
    4342        {
     
    4847            m_lexer.next();
    4948            JSValue result = parse(m_mode == StrictJSON ? StartParseExpression : StartParseStatement);
    50             if (m_lexer.currentToken().type == TokSemi)
    51                 m_lexer.next();
    5249            if (m_lexer.currentToken().type != TokEnd)
    5350                return JSValue();
    5451            return result;
    5552        }
    56        
    57         enum JSONPPathEntryType {
    58             JSONPPathEntryTypeDeclare, // var pathEntryName = JSON
    59             JSONPPathEntryTypeDot, // <prior entries>.pathEntryName = JSON
    60             JSONPPathEntryTypeLookup // <prior entries>[pathIndex] = JSON
    61         };
    62 
    63         struct JSONPPathEntry {
    64             JSONPPathEntryType m_type;
    65             Identifier m_pathEntryName;
    66             int m_pathIndex;
    67         };
    68 
    69         struct JSONPData {
    70             Vector<JSONPPathEntry> m_path;
    71             Strong<Unknown> m_value;
    72         };
    73 
    74         bool tryJSONPParse(Vector<JSONPData>&);
    75 
    7653    private:
    7754        enum ParserState { StartParseObject, StartParseArray, StartParseExpression,
     
    8259                         TokString, TokIdentifier, TokNumber, TokColon,
    8360                         TokLParen, TokRParen, TokComma, TokTrue, TokFalse,
    84                          TokNull, TokEnd, TokDot, TokAssign, TokSemi, TokError };
    85        
     61                         TokNull, TokEnd, TokError };
     62
    8663        class Lexer {
    8764        public:
     
    9067                const UChar* start;
    9168                const UChar* end;
    92                 UString stringBuffer;
    93                 union {
    94                     double numberToken;
    95                     struct {
    96                         const UChar* stringToken;
    97                         int stringLength;
    98                     };
    99                 };
     69                UString stringToken;
     70                double numberToken;
    10071            };
    101             Lexer(const UChar* characters, unsigned length, ParserMode mode)
    102                 : m_mode(mode)
    103                 , m_ptr(characters)
    104                 , m_end(characters + length)
     72            Lexer(const UString& s, ParserMode mode)
     73                : m_string(s)
     74                , m_mode(mode)
     75                , m_ptr(s.characters())
     76                , m_end(s.characters() + s.length())
    10577            {
    10678            }
    10779           
    108             TokenType next();
     80            TokenType next()
     81            {
     82                return lex(m_currentToken);
     83            }
    10984           
    11085            const LiteralParserToken& currentToken()
     
    11489           
    11590        private:
    116             template <ParserMode mode> TokenType lex(LiteralParserToken&);
    117             template <ParserMode mode, UChar terminator> ALWAYS_INLINE TokenType lexString(LiteralParserToken&);
    118             ALWAYS_INLINE TokenType lexNumber(LiteralParserToken&);
     91            TokenType lex(LiteralParserToken&);
     92            template <ParserMode mode> TokenType lexString(LiteralParserToken&);
     93            TokenType lexNumber(LiteralParserToken&);
    11994            LiteralParserToken m_currentToken;
    12095            UString m_string;
     
    130105        LiteralParser::Lexer m_lexer;
    131106        ParserMode m_mode;
    132         static unsigned const MaximumCachableCharacter = 128;
    133         FixedArray<Identifier, MaximumCachableCharacter> m_shortIdentifiers;
    134         FixedArray<Identifier, MaximumCachableCharacter> m_recentIdentifiers;
    135         ALWAYS_INLINE const Identifier makeIdentifier(const UChar* characters, size_t length);
    136107    };
    137 
    138108}
    139109
Note: See TracChangeset for help on using the changeset viewer.