Ignore:
Timestamp:
Dec 5, 2016, 2:46:06 PM (9 years ago)
Author:
[email protected]
Message:

ScriptExecutable should not contain a copy of firstLine and startColumn
https://bugs.webkit.org/show_bug.cgi?id=165415

Reviewed by Keith Miller.

We already have this data in SourceCode.

It's super confusing to have two copies of this data, where one is
allowed to mutate. In reality, your line and column number never change.

  • bytecode/UnlinkedFunctionExecutable.cpp:

(JSC::UnlinkedFunctionExecutable::link):

  • runtime/CodeCache.cpp:

(JSC::CodeCache::getUnlinkedGlobalCodeBlock):

  • runtime/CodeCache.h:

(JSC::generateUnlinkedCodeBlock):

  • runtime/FunctionExecutable.cpp:

(JSC::FunctionExecutable::FunctionExecutable):

  • runtime/FunctionExecutable.h:
  • runtime/ScriptExecutable.cpp:

(JSC::ScriptExecutable::ScriptExecutable):
(JSC::ScriptExecutable::newCodeBlockFor):

  • runtime/ScriptExecutable.h:

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

File:
1 edited

Legend:

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

    r208950 r209353  
    5858    , m_evalContextType(static_cast<unsigned>(evalContextType))
    5959    , m_overrideLineNumber(-1)
    60     , m_firstLine(-1)
    6160    , m_lastLine(-1)
    62     , m_startColumn(UINT_MAX)
    6361    , m_endColumn(UINT_MAX)
    6462    , m_typeProfilingStartOffset(UINT_MAX)
     
    179177
    180178    ASSERT(vm->heap.isDeferred());
    181     ASSERT(startColumn() != UINT_MAX);
    182179    ASSERT(endColumn() != UINT_MAX);
    183180
     
    199196        return ProgramCodeBlock::create(vm,
    200197            executable, executable->m_unlinkedProgramCodeBlock.get(), scope,
    201             executable->source().provider(), executable->source().startColumn());
     198            executable->source().provider(), startColumn());
    202199    }
    203200
     
    209206        return ModuleProgramCodeBlock::create(vm,
    210207            executable, executable->m_unlinkedModuleProgramCodeBlock.get(), scope,
    211             executable->source().provider(), executable->source().startColumn());
     208            executable->source().provider(), startColumn());
    212209    }
    213210
     
    225222    recordParse(
    226223        executable->m_unlinkedExecutable->features(),
    227         executable->m_unlinkedExecutable->hasCapturedVariables(), firstLine(),
    228         lastLine(), startColumn(), endColumn());
     224        executable->m_unlinkedExecutable->hasCapturedVariables(),
     225        lastLine(), endColumn());
    229226    if (!unlinkedCodeBlock) {
    230227        exception = throwException(
     
    234231    }
    235232
    236     SourceProvider* provider = executable->source().provider();
    237     unsigned sourceOffset = executable->source().startOffset();
    238     unsigned startColumn = executable->source().startColumn();
    239 
    240     return FunctionCodeBlock::create(vm,
    241         executable, unlinkedCodeBlock, scope, provider, sourceOffset, startColumn);
     233    return FunctionCodeBlock::create(vm, executable, unlinkedCodeBlock, scope,
     234        source().provider(), source().startOffset(), startColumn());
    242235}
    243236
Note: See TracChangeset for help on using the changeset viewer.