Ignore:
Timestamp:
Dec 9, 2016, 2:59:52 PM (9 years ago)
Author:
[email protected]
Message:

Deploy OrdinalNumber in JSC::SourceCode
https://bugs.webkit.org/show_bug.cgi?id=165687

Reviewed by Michael Saboff.

Source/JavaScriptCore:

We have a lot of confusion between 1-based and 0-based counting in line
and column numbers. Let's use OrdinalNumber to clear up the confusion.

  • bytecode/UnlinkedFunctionExecutable.cpp:

(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
(JSC::UnlinkedFunctionExecutable::link):

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::emitExpressionInfo):

  • inspector/JSInjectedScriptHost.cpp:

(Inspector::JSInjectedScriptHost::functionDetails):

  • parser/Lexer.cpp:

(JSC::Lexer<T>::setCode):

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::Parser):

  • parser/Parser.h:

(JSC::Parser<LexerType>::parse):

  • parser/SourceCode.h:

(JSC::SourceCode::SourceCode):
(JSC::SourceCode::firstLine):
(JSC::SourceCode::startColumn):

  • runtime/CodeCache.cpp:

(JSC::CodeCache::getUnlinkedGlobalCodeBlock):

  • runtime/ScriptExecutable.h:

(JSC::ScriptExecutable::firstLine):
(JSC::ScriptExecutable::startColumn):

  • tools/CodeProfile.h:

(JSC::CodeProfile::CodeProfile):

Source/WebCore:

Updated for interface changes.

  • bindings/js/ScriptController.cpp:

(WebCore::ScriptController::evaluateModule):

  • bindings/js/ScriptSourceCode.h:

(WebCore::ScriptSourceCode::startLine):

Source/WTF:

  • wtf/text/OrdinalNumber.h:

(WTF::OrdinalNumber::operator>): Added a >.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/CodeCache.cpp

    r209353 r209632  
    6363        UnlinkedCodeBlockType* unlinkedCodeBlock = jsCast<UnlinkedCodeBlockType*>(cache->cell.get());
    6464        unsigned lineCount = unlinkedCodeBlock->lineCount();
    65         unsigned startColumn = unlinkedCodeBlock->startColumn() + source.startColumn();
     65        unsigned startColumn = unlinkedCodeBlock->startColumn() + source.startColumn().oneBasedInt();
    6666        bool endColumnIsOnStartLine = !lineCount;
    6767        unsigned endColumn = unlinkedCodeBlock->endColumn() + (endColumnIsOnStartLine ? startColumn : 1);
    68         executable->recordParse(unlinkedCodeBlock->codeFeatures(), unlinkedCodeBlock->hasCapturedVariables(), source.firstLine() + lineCount, endColumn);
     68        executable->recordParse(unlinkedCodeBlock->codeFeatures(), unlinkedCodeBlock->hasCapturedVariables(), source.firstLine().oneBasedInt() + lineCount, endColumn);
    6969        source.provider()->setSourceURLDirective(unlinkedCodeBlock->sourceURLDirective());
    7070        source.provider()->setSourceMappingURLDirective(unlinkedCodeBlock->sourceMappingURLDirective());
Note: See TracChangeset for help on using the changeset viewer.