Ignore:
Timestamp:
Dec 1, 2016, 4:24:17 PM (8 years ago)
Author:
[email protected]
Message:

SourceCodeKey should use unlinked source code
https://bugs.webkit.org/show_bug.cgi?id=165286

Reviewed by Saam Barati.

This patch splits out UnlinkedSourceCode from SourceCode, and deploys
UnlinkedSourceCode in SourceCodeKey.

It's misleading to store SourceCode in SourceCodeKey because SourceCode
has an absolute location whereas unlinked cached code has no location.

I plan to deploy UnlinkedSourceCode in more places, to indicate code
that has no absolute location.

(JSC::UnlinkedSourceCode::toUTF8):
(JSC::SourceCode::toUTF8): Deleted.

  • parser/SourceCode.h:

(JSC::SourceCode::SourceCode):
(JSC::SourceCode::startColumn):
(JSC::SourceCode::isHashTableDeletedValue): Deleted.
(JSC::SourceCode::hash): Deleted.
(JSC::SourceCode::view): Deleted.
(JSC::SourceCode::providerID): Deleted.
(JSC::SourceCode::isNull): Deleted.
(JSC::SourceCode::provider): Deleted.
(JSC::SourceCode::startOffset): Deleted.
(JSC::SourceCode::endOffset): Deleted.
(JSC::SourceCode::length): Deleted. Move a bunch of stuff in to a new
base class, UnlinkedSourceCode.

  • parser/SourceCodeKey.h:

(JSC::SourceCodeKey::SourceCodeKey): Use UnlinkedSourceCode since code
in the cache has no location.

  • parser/UnlinkedSourceCode.h: Copied from Source/JavaScriptCore/parser/SourceCode.h.

(JSC::UnlinkedSourceCode::UnlinkedSourceCode):
(JSC::UnlinkedSourceCode::provider):
(JSC::SourceCode::SourceCode): Deleted.
(JSC::SourceCode::isHashTableDeletedValue): Deleted.
(JSC::SourceCode::hash): Deleted.
(JSC::SourceCode::view): Deleted.
(JSC::SourceCode::providerID): Deleted.
(JSC::SourceCode::isNull): Deleted.
(JSC::SourceCode::provider): Deleted.
(JSC::SourceCode::firstLine): Deleted.
(JSC::SourceCode::startColumn): Deleted.
(JSC::SourceCode::startOffset): Deleted.
(JSC::SourceCode::endOffset): Deleted.
(JSC::SourceCode::length): Deleted.
(JSC::makeSource): Deleted.
(JSC::SourceCode::subExpression): Deleted.

  • runtime/CodeCache.h: Use UnlinkedSourceCode in the cache.
File:
1 edited

Legend:

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

    r208768 r209220  
    2828
    2929#include "ParserModes.h"
    30 #include "SourceCode.h"
     30#include "UnlinkedSourceCode.h"
    3131#include <wtf/HashTraits.h>
    3232
     
    7777
    7878    SourceCodeKey(
    79         const SourceCode& sourceCode, const String& name, SourceCodeType codeType, JSParserStrictMode strictMode,
     79        const UnlinkedSourceCode& sourceCode, const String& name, SourceCodeType codeType, JSParserStrictMode strictMode,
    8080        JSParserScriptMode scriptMode, DerivedContextType derivedContextType, EvalContextType evalContextType, bool isArrowFunctionContext,
    8181        DebuggerMode debuggerMode, TypeProfilerEnabled typeProfilerEnabled, ControlFlowProfilerEnabled controlFlowProfilerEnabled)
     
    125125
    126126private:
    127     SourceCode m_sourceCode;
     127    UnlinkedSourceCode m_sourceCode;
    128128    String m_name;
    129129    SourceCodeFlags m_flags;
Note: See TracChangeset for help on using the changeset viewer.