Commit bb8aa756 authored by fpizlo@apple.com's avatar fpizlo@apple.com

Move all Structure out-of-line inline methods to StructureInlines.h

https://bugs.webkit.org/show_bug.cgi?id=110024

Source/JavaScriptCore: 

Rubber stamped by Mark Hahnenberg and Sam Weinig.
        
This was supposed to be easy.
        
But, initially, there was a Structure inline method in CodeBlock.h, and moving that
into StructureInlines.h meant that Operations.h included CodeBlock.h. This would
cause WebCore build failures, because CodeBlock.h transitively included the JSC
parser (via many, many paths), and the JSC parser defines tokens using enumeration
elements that CSSGrammar.cpp (generated by bison) would #define. For example,
bison would give CSSGrammar.cpp a #define FUNCTION 123, and would do so before
including anything interesting. The JSC parser would have an enum that included
FUNCTION as an element. Hence the JSC parser included into CSSGrammar.cpp would have
a token element called FUNCTION declared in an enumeration, but FUNCTION was
#define'd to 123, leading to a parser error.
        
Wow.
        
So I removed all transitive include paths from CodeBlock.h to the JSC Parser. I
believe I was able to do so without out-of-lining anything interesting or performance
critical. This is probably a purely good thing to have done: it will be nice to be
able to make changes to the parser without having to compile the universe.
        
Of course, doing this caused a bunch of other things to not compile, since a bunch of
headers relied on things being implicitly included for them when they transitively
included the parser. I fixed a lot of that.
        
Finally, I ended up removing the method that depended on CodeBlock.h from
StructureInlines.h, and putting it in Structure.cpp. That might seem like all of this
was a waste of time, except that I suspect it was a worthwhile forcing function for
cleaning up a bunch of cruft.
        
* API/JSCallbackFunction.cpp:
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CodeBlock.h:
(JSC):
* bytecode/EvalCodeCache.h:
* bytecode/SamplingTool.h:
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedFunctionExecutable::parameterCount):
(JSC):
* bytecode/UnlinkedCodeBlock.h:
(UnlinkedFunctionExecutable):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/Label.h:
(JSC):
* dfg/DFGByteCodeParser.cpp:
* dfg/DFGByteCodeParser.h:
* dfg/DFGFPRInfo.h:
* dfg/DFGRegisterBank.h:
* heap/HandleStack.cpp:
* jit/JITWriteBarrier.h:
* parser/Nodes.h:
(JSC):
* parser/Parser.h:
* parser/ParserError.h: Added.
(JSC):
(JSC::ParserError::ParserError):
(ParserError):
(JSC::ParserError::toErrorObject):
* parser/ParserModes.h:
* parser/SourceProvider.cpp: Added.
(JSC):
(JSC::SourceProvider::SourceProvider):
(JSC::SourceProvider::~SourceProvider):
* parser/SourceProvider.h:
(JSC):
(SourceProvider):
* runtime/ArrayPrototype.cpp:
* runtime/DatePrototype.cpp:
* runtime/Executable.h:
* runtime/JSGlobalObject.cpp:
* runtime/JSGlobalObject.h:
(JSC):
* runtime/Operations.h:
* runtime/Structure.cpp:
(JSC::Structure::prototypeForLookup):
(JSC):
* runtime/Structure.h:
(JSC):
* runtime/StructureInlines.h: Added.
(JSC):
(JSC::Structure::create):
(JSC::Structure::createStructure):
(JSC::Structure::get):
(JSC::Structure::masqueradesAsUndefined):
(JSC::SlotVisitor::internalAppend):
(JSC::Structure::transitivelyTransitionedFrom):
(JSC::Structure::setEnumerationCache):
(JSC::Structure::enumerationCache):
(JSC::Structure::prototypeForLookup):
(JSC::Structure::prototypeChain):
(JSC::Structure::isValid):
* runtime/StructureRareData.cpp:

Source/WebCore: 

Rubber stamped by Sam Weinig.

No new tests because no new behavior. Just rewiring includes.

* ForwardingHeaders/parser/SourceProviderCache.h: Added.
* loader/cache/CachedScript.cpp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@143147 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bc8c2628
......@@ -29,6 +29,7 @@
#include "APIShims.h"
#include "APICast.h"
#include "CodeBlock.h"
#include "Error.h"
#include "ExceptionHelpers.h"
#include "FunctionPrototype.h"
#include "JSFunction.h"
......
......@@ -182,6 +182,7 @@ set(JavaScriptCore_SOURCES
parser/Nodes.cpp
parser/Parser.cpp
parser/ParserArena.cpp
parser/SourceProvider.cpp
parser/SourceProviderCache.cpp
profiler/ProfilerBytecode.cpp
......
2013-02-17 Filip Pizlo <fpizlo@apple.com>
Move all Structure out-of-line inline methods to StructureInlines.h
https://bugs.webkit.org/show_bug.cgi?id=110024
Rubber stamped by Mark Hahnenberg and Sam Weinig.
This was supposed to be easy.
But, initially, there was a Structure inline method in CodeBlock.h, and moving that
into StructureInlines.h meant that Operations.h included CodeBlock.h. This would
cause WebCore build failures, because CodeBlock.h transitively included the JSC
parser (via many, many paths), and the JSC parser defines tokens using enumeration
elements that CSSGrammar.cpp (generated by bison) would #define. For example,
bison would give CSSGrammar.cpp a #define FUNCTION 123, and would do so before
including anything interesting. The JSC parser would have an enum that included
FUNCTION as an element. Hence the JSC parser included into CSSGrammar.cpp would have
a token element called FUNCTION declared in an enumeration, but FUNCTION was
#define'd to 123, leading to a parser error.
Wow.
So I removed all transitive include paths from CodeBlock.h to the JSC Parser. I
believe I was able to do so without out-of-lining anything interesting or performance
critical. This is probably a purely good thing to have done: it will be nice to be
able to make changes to the parser without having to compile the universe.
Of course, doing this caused a bunch of other things to not compile, since a bunch of
headers relied on things being implicitly included for them when they transitively
included the parser. I fixed a lot of that.
Finally, I ended up removing the method that depended on CodeBlock.h from
StructureInlines.h, and putting it in Structure.cpp. That might seem like all of this
was a waste of time, except that I suspect it was a worthwhile forcing function for
cleaning up a bunch of cruft.
* API/JSCallbackFunction.cpp:
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CodeBlock.h:
(JSC):
* bytecode/EvalCodeCache.h:
* bytecode/SamplingTool.h:
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedFunctionExecutable::parameterCount):
(JSC):
* bytecode/UnlinkedCodeBlock.h:
(UnlinkedFunctionExecutable):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/Label.h:
(JSC):
* dfg/DFGByteCodeParser.cpp:
* dfg/DFGByteCodeParser.h:
* dfg/DFGFPRInfo.h:
* dfg/DFGRegisterBank.h:
* heap/HandleStack.cpp:
* jit/JITWriteBarrier.h:
* parser/Nodes.h:
(JSC):
* parser/Parser.h:
* parser/ParserError.h: Added.
(JSC):
(JSC::ParserError::ParserError):
(ParserError):
(JSC::ParserError::toErrorObject):
* parser/ParserModes.h:
* parser/SourceProvider.cpp: Added.
(JSC):
(JSC::SourceProvider::SourceProvider):
(JSC::SourceProvider::~SourceProvider):
* parser/SourceProvider.h:
(JSC):
(SourceProvider):
* runtime/ArrayPrototype.cpp:
* runtime/DatePrototype.cpp:
* runtime/Executable.h:
* runtime/JSGlobalObject.cpp:
* runtime/JSGlobalObject.h:
(JSC):
* runtime/Operations.h:
* runtime/Structure.cpp:
(JSC::Structure::prototypeForLookup):
(JSC):
* runtime/Structure.h:
(JSC):
* runtime/StructureInlines.h: Added.
(JSC):
(JSC::Structure::create):
(JSC::Structure::createStructure):
(JSC::Structure::get):
(JSC::Structure::masqueradesAsUndefined):
(JSC::SlotVisitor::internalAppend):
(JSC::Structure::transitivelyTransitionedFrom):
(JSC::Structure::setEnumerationCache):
(JSC::Structure::enumerationCache):
(JSC::Structure::prototypeForLookup):
(JSC::Structure::prototypeChain):
(JSC::Structure::isValid):
* runtime/StructureRareData.cpp:
2013-02-17 Roger Fong <roger_fong@apple.com>
Unreviewed. Windows build fix.
......
......@@ -492,12 +492,14 @@ javascriptcore_sources += \
Source/JavaScriptCore/parser/Nodes.h \
Source/JavaScriptCore/parser/ParserArena.cpp \
Source/JavaScriptCore/parser/ParserArena.h \
Source/JavaScriptCore/parser/ParserError.h \
Source/JavaScriptCore/parser/ParserTokens.h \
Source/JavaScriptCore/parser/Parser.cpp \
Source/JavaScriptCore/parser/Parser.h \
Source/JavaScriptCore/parser/ParserModes.h \
Source/JavaScriptCore/parser/ResultType.h \
Source/JavaScriptCore/parser/SourceCode.h \
Source/JavaScriptCore/parser/SourceProvider.cpp \
Source/JavaScriptCore/parser/SourceProvider.h \
Source/JavaScriptCore/parser/SourceProviderCache.cpp \
Source/JavaScriptCore/parser/SourceProviderCache.h \
......@@ -759,6 +761,7 @@ javascriptcore_sources += \
Source/JavaScriptCore/runtime/StructureChain.h \
Source/JavaScriptCore/runtime/Structure.cpp \
Source/JavaScriptCore/runtime/Structure.h \
Source/JavaScriptCore/runtime/StructureInlines.h \
Source/JavaScriptCore/runtime/StructureRareData.cpp \
Source/JavaScriptCore/runtime/StructureRareData.h \
Source/JavaScriptCore/runtime/StructureRareDataInlines.h \
......
......@@ -1337,6 +1337,10 @@
RelativePath="..\..\runtime\StructureChain.h"
>
</File>
<File
RelativePath="..\..\runtime\StructureInlines.h"
>
</File>
<File
RelativePath="..\..\runtime\StructureRareData.cpp"
>
......@@ -2465,6 +2469,10 @@
RelativePath="..\..\parser\ParserArena.h"
>
</File>
<File
RelativePath="..\..\parser\ParserError.h"
>
</File>
<File
RelativePath="..\..\parser\ParserModes.h"
>
......@@ -2477,6 +2485,10 @@
RelativePath="..\..\parser\SourceCode.h"
>
</File>
<File
RelativePath="..\..\parser\SourceProvider.cpp"
>
</File>
<File
RelativePath="..\..\parser\SourceProvider.h"
>
......
......@@ -193,6 +193,7 @@ SOURCES += \
parser/Nodes.cpp \
parser/ParserArena.cpp \
parser/Parser.cpp \
parser/SourceProvider.cpp \
parser/SourceProviderCache.cpp \
profiler/ProfilerBytecode.cpp \
profiler/ProfilerBytecode.h \
......
......@@ -61,7 +61,6 @@
#include "LLIntCallLinkInfo.h"
#include "LazyOperandValueProfile.h"
#include "LineInfo.h"
#include "Nodes.h"
#include "ProfilerCompilation.h"
#include "RegExpObject.h"
#include "ResolveOperation.h"
......@@ -1461,11 +1460,6 @@ namespace JSC {
}
#endif
inline JSValue Structure::prototypeForLookup(CodeBlock* codeBlock) const
{
return prototypeForLookup(codeBlock->globalObject());
}
} // namespace JSC
#endif // CodeBlock_h
......@@ -31,8 +31,6 @@
#include "Executable.h"
#include "JSGlobalObject.h"
#include "Nodes.h"
#include "Parser.h"
#include "SourceCode.h"
#include <wtf/HashMap.h>
#include <wtf/RefPtr.h>
......
/*
* Copyright (C) 2008 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -30,7 +30,6 @@
#define SamplingTool_h
#include "Strong.h"
#include "Nodes.h"
#include "Opcode.h"
#include "SamplingCounter.h"
#include <wtf/Assertions.h>
......
......@@ -33,6 +33,7 @@
#include "Executable.h"
#include "JSString.h"
#include "Operations.h"
#include "Parser.h"
#include "SourceProvider.h"
#include "Structure.h"
#include "SymbolTable.h"
......@@ -98,6 +99,11 @@ UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(JSGlobalData* globalData,
{
}
size_t UnlinkedFunctionExecutable::parameterCount() const
{
return m_parameters->size();
}
void UnlinkedFunctionExecutable::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
UnlinkedFunctionExecutable* thisObject = jsCast<UnlinkedFunctionExecutable*>(cell);
......
/*
* Copyright (C) 2012 Apple Inc. All Rights Reserved.
* Copyright (C) 2012, 2013 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -32,10 +32,12 @@
#include "ExpressionRangeInfo.h"
#include "Identifier.h"
#include "JSCell.h"
#include "JSString.h"
#include "LineInfo.h"
#include "Nodes.h"
#include "ParserModes.h"
#include "RegExp.h"
#include "SpecialPointer.h"
#include "SymbolTable.h"
#include "Weak.h"
#include <wtf/RefCountedArray.h>
......@@ -93,7 +95,7 @@ public:
{
return (kind == CodeForCall) ? m_symbolTableForCall.get() : m_symbolTableForConstruct.get();
}
size_t parameterCount() const { return m_parameters->size(); }
size_t parameterCount() const;
bool isInStrictContext() const { return m_isInStrictContext; }
FunctionNameIsInScopeToggle functionNameIsInScopeToggle() const { return m_functionNameIsInScopeToggle; }
......
......@@ -37,6 +37,7 @@
#include "Label.h"
#include "LabelScope.h"
#include "Interpreter.h"
#include "ParserError.h"
#include "RegisterID.h"
#include "SymbolTable.h"
#include "Debugger.h"
......
......@@ -37,6 +37,8 @@
namespace JSC {
class BytecodeGenerator;
class Label {
public:
explicit Label(BytecodeGenerator* generator)
......
......@@ -35,7 +35,7 @@
#include "DFGArrayMode.h"
#include "DFGCapabilities.h"
#include "GetByIdStatus.h"
#include "JSCJSValueInlines.h"
#include "Operations.h"
#include "PreciseJumpTargets.h"
#include "PutByIdStatus.h"
#include "ResolveGlobalStatus.h"
......
......@@ -28,7 +28,7 @@
#if ENABLE(DFG_JIT)
#include <dfg/DFGGraph.h>
#include "DFGGraph.h"
namespace JSC {
......
......@@ -28,8 +28,8 @@
#if ENABLE(DFG_JIT)
#include <assembler/MacroAssembler.h>
#include <dfg/DFGRegisterBank.h>
#include "DFGRegisterBank.h"
#include "MacroAssembler.h"
namespace JSC { namespace DFG {
......
......@@ -28,7 +28,7 @@
#if ENABLE(DFG_JIT)
#include <dfg/DFGCommon.h>
#include "DFGCommon.h"
namespace JSC { namespace DFG {
......
......@@ -27,8 +27,8 @@
#include "HandleStack.h"
#include "HeapRootVisitor.h"
#include "JSCJSValueInlines.h"
#include "JSObject.h"
#include "Operations.h"
namespace JSC {
......
......@@ -30,8 +30,8 @@
#include "MacroAssembler.h"
#include "SlotVisitor.h"
#include "UnusedPointer.h"
#include "WriteBarrier.h"
#include "jit/UnusedPointer.h"
namespace JSC {
......
......@@ -30,6 +30,7 @@
#include "JITCode.h"
#include "Opcode.h"
#include "ParserArena.h"
#include "ParserTokens.h"
#include "ResultType.h"
#include "SourceCode.h"
#include "SymbolTable.h"
......@@ -47,19 +48,6 @@ namespace JSC {
class JSScope;
class ScopeNode;
typedef unsigned CodeFeatures;
const CodeFeatures NoFeatures = 0;
const CodeFeatures EvalFeature = 1 << 0;
const CodeFeatures ArgumentsFeature = 1 << 1;
const CodeFeatures WithFeature = 1 << 2;
const CodeFeatures CatchFeature = 1 << 3;
const CodeFeatures ThisFeature = 1 << 4;
const CodeFeatures StrictModeFeature = 1 << 5;
const CodeFeatures ShadowsArgumentsFeature = 1 << 6;
const CodeFeatures AllFeatures = EvalFeature | ArgumentsFeature | WithFeature | CatchFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature;
enum Operator {
OpEqual,
OpPlusEq,
......@@ -1412,7 +1400,6 @@ namespace JSC {
void* m_storage;
};
enum FunctionNameIsInScopeToggle { FunctionNameIsNotInScope, FunctionNameIsInScope };
class FunctionBodyNode : public ScopeNode {
public:
static const bool isFunctionNode = true;
......
......@@ -30,8 +30,10 @@
#include "Lexer.h"
#include "Nodes.h"
#include "ParserArena.h"
#include "ParserError.h"
#include "ParserTokens.h"
#include "SourceProvider.h"
#include "SourceProviderCache.h"
#include "SourceProviderCacheItem.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
......@@ -76,49 +78,6 @@ COMPILE_ASSERT(LastUntaggedToken < 64, LessThan64UntaggedTokens);
enum SourceElementsMode { CheckForStrictMode, DontCheckForStrictMode };
enum FunctionRequirements { FunctionNoRequirements, FunctionNeedsName };
struct ParserError {
enum ErrorType { ErrorNone, StackOverflow, SyntaxError, EvalError, OutOfMemory } m_type;
String m_message;
int m_line;
ParserError()
: m_type(ErrorNone)
, m_line(-1)
{
}
ParserError(ErrorType type)
: m_type(type)
, m_line(-1)
{
}
ParserError(ErrorType type, String msg, int line)
: m_type(type)
, m_message(msg)
, m_line(line)
{
}
JSObject* toErrorObject(JSGlobalObject* globalObject, const SourceCode& source)
{
switch (m_type) {
case ErrorNone:
return 0;
case SyntaxError:
return addErrorInfo(globalObject->globalExec(), createSyntaxError(globalObject, m_message), m_line, source);
case EvalError:
return createSyntaxError(globalObject, m_message);
case StackOverflow:
return createStackOverflowError(globalObject);
case OutOfMemory:
return createOutOfMemoryError(globalObject);
}
CRASH();
return createOutOfMemoryError(globalObject); // Appease Qt bot
}
};
template <typename T> inline bool isEvalNode() { return false; }
template <> inline bool isEvalNode<EvalNode>() { return true; }
......
/*
* Copyright (C) 2013 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ParserError_h
#define ParserError_h
#include "Error.h"
#include "ExceptionHelpers.h"
#include <wtf/text/WTFString.h>
namespace JSC {
struct ParserError {
enum ErrorType { ErrorNone, StackOverflow, SyntaxError, EvalError, OutOfMemory } m_type;
String m_message;
int m_line;
ParserError()
: m_type(ErrorNone)
, m_line(-1)
{
}
ParserError(ErrorType type)
: m_type(type)
, m_line(-1)
{
}
ParserError(ErrorType type, String msg, int line)
: m_type(type)
, m_message(msg)
, m_line(line)
{
}
JSObject* toErrorObject(JSGlobalObject* globalObject, const SourceCode& source)
{
switch (m_type) {
case ErrorNone:
return 0;
case SyntaxError:
return addErrorInfo(globalObject->globalExec(), createSyntaxError(globalObject, m_message), m_line, source);
case EvalError:
return createSyntaxError(globalObject, m_message);
case StackOverflow:
return createStackOverflowError(globalObject);
case OutOfMemory:
return createOutOfMemoryError(globalObject);
}
CRASH();
return createOutOfMemoryError(globalObject); // Appease Qt bot
}
};
} // namespace JSC
#endif // ParserError_h
/*
* Copyright (C) 2012 Apple Inc. All rights reserved.
* Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -35,6 +35,21 @@ enum JSParserMode { JSParseProgramCode, JSParseFunctionCode };
enum ProfilerMode { ProfilerOff, ProfilerOn };
enum DebuggerMode { DebuggerOff, DebuggerOn };
}
enum FunctionNameIsInScopeToggle { FunctionNameIsNotInScope, FunctionNameIsInScope };
#endif
typedef unsigned CodeFeatures;
const CodeFeatures NoFeatures = 0;
const CodeFeatures EvalFeature = 1 << 0;
const CodeFeatures ArgumentsFeature = 1 << 1;
const CodeFeatures WithFeature = 1 << 2;
const CodeFeatures CatchFeature = 1 << 3;
const CodeFeatures ThisFeature = 1 << 4;
const CodeFeatures StrictModeFeature = 1 << 5;
const CodeFeatures ShadowsArgumentsFeature = 1 << 6;
const CodeFeatures AllFeatures = EvalFeature | ArgumentsFeature | WithFeature | CatchFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature;
} // namespace JSC
#endif // ParserModes_h
/*
* Copyright (C) 2013 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "SourceProvider.h"
#include "SourceProviderCache.h"
namespace JSC {
SourceProvider::SourceProvider(const String& url, const TextPosition& startPosition, SourceProviderCache* cache)
: m_url(url)
, m_startPosition(startPosition)
, m_validated(false)
, m_cache(cache ? cache : new SourceProviderCache)
, m_cacheOwned(!cache)
{
}
SourceProvider::~SourceProvider()
{
if (m_cacheOwned)
delete m_cache;
}
} // namespace JSC
/*
* Copyright (C) 2008, 2009, 2012 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009, 2012, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -29,32 +29,23 @@
#ifndef SourceProvider_h
#define SourceProvider_h