Changeset 128542 in webkit for trunk/Source/JavaScriptCore/parser
- Timestamp:
- Sep 13, 2012, 6:50:17 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore/parser
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/Lexer.cpp
r127191 r128542 406 406 m_lastToken = -1; 407 407 408 const String Impl* sourceString = source.provider()->data();409 410 if ( sourceString)411 setCodeStart(sourceString );408 const String& sourceString = source.provider()->source(); 409 410 if (!sourceString.isNull()) 411 setCodeStart(sourceString.impl()); 412 412 else 413 413 m_codeStart = 0; … … 1690 1690 SourceCode Lexer<T>::sourceCode(int openBrace, int closeBrace, int firstLine) 1691 1691 { 1692 ASSERT( (*m_source->provider()->data())[openBrace] == '{');1693 ASSERT( (*m_source->provider()->data())[closeBrace] == '}');1692 ASSERT(m_source->provider()->source()[openBrace] == '{'); 1693 ASSERT(m_source->provider()->source()[closeBrace] == '}'); 1694 1694 return SourceCode(m_source->provider(), openBrace, closeBrace + 1, firstLine); 1695 1695 } -
trunk/Source/JavaScriptCore/parser/Parser.h
r127958 r128542 1030 1030 SamplingRegion samplingRegion("Parsing"); 1031 1031 1032 ASSERT( source.provider()->data());1033 1034 if (source.provider()-> data()->is8Bit()) {1032 ASSERT(!source.provider()->source().isNull()); 1033 1034 if (source.provider()->source().is8Bit()) { 1035 1035 Parser< Lexer<LChar> > parser(globalData, source, parameters, name, strictness, parserMode); 1036 1036 return parser.parse<ParsedNode>(lexicalGlobalObject, debugger, execState, exception); -
trunk/Source/JavaScriptCore/parser/SourceCode.h
r127191 r128542 48 48 : m_provider(provider) 49 49 , m_startChar(0) 50 , m_endChar(m_provider-> length())50 , m_endChar(m_provider->source().length()) 51 51 , m_firstLine(std::max(firstLine, 1)) 52 52 { … … 98 98 inline SourceCode SourceCode::subExpression(unsigned openBrace, unsigned closeBrace, int firstLine) 99 99 { 100 ASSERT( (*provider()->data())[openBrace] == '{');101 ASSERT( (*provider()->data())[closeBrace] == '}');100 ASSERT(provider()->source()[openBrace] == '{'); 101 ASSERT(provider()->source()[closeBrace] == '}'); 102 102 return SourceCode(provider(), openBrace, closeBrace + 1, firstLine); 103 103 } -
trunk/Source/JavaScriptCore/parser/SourceProvider.h
r127191 r128542 1 1 /* 2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.2 * Copyright (C) 2008, 2009, 2012 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 57 57 } 58 58 59 virtual String getRange(int start, int end) const = 0; 60 virtual const StringImpl* data() const = 0; 61 virtual int length() const = 0; 62 59 virtual const String& source() const = 0; 60 String getRange(int start, int end) const 61 { 62 return source().substringSharingImpl(start, end - start); 63 } 64 63 65 const String& url() { return m_url; } 64 66 TextPosition startPosition() const { return m_startPosition; } … … 94 96 } 95 97 96 virtual String getRange(int start, int end) const OVERRIDE98 virtual const String& source() const OVERRIDE 97 99 { 98 return m_source .substringSharingImpl(start, end - start);100 return m_source; 99 101 } 100 const StringImpl* data() const { return m_source.impl(); }101 int length() const { return m_source.length(); }102 102 103 103 private:
Note:
See TracChangeset
for help on using the changeset viewer.