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

CodeBlock.h declares too many things

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

Rubber stamped by Gavin Barraclough.
        
Removed all non-CodeBlock type declarations from CodeBlock.h, and put them
into separate header files. Also removed all non-CodeBlock method implementations
from CodeBlock.cpp and put them into corresponding cpp files.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* assembler/RepatchBuffer.h:
* bytecode/CallLinkInfo.cpp: Added.
(JSC::CallLinkInfo::unlink):
* bytecode/CallLinkInfo.h: Added.
(JSC::CallLinkInfo::callTypeFor):
(JSC::CallLinkInfo::CallLinkInfo):
(JSC::CallLinkInfo::~CallLinkInfo):
(JSC::CallLinkInfo::isLinked):
(JSC::CallLinkInfo::seenOnce):
(JSC::CallLinkInfo::setSeen):
(JSC::getCallLinkInfoReturnLocation):
(JSC::getCallLinkInfoBytecodeIndex):
* bytecode/CallReturnOffsetToBytecodeOffset.h: Added.
(JSC::CallReturnOffsetToBytecodeOffset::CallReturnOffsetToBytecodeOffset):
(JSC::getCallReturnOffset):
* bytecode/CodeBlock.cpp:
* bytecode/CodeBlock.h:
* bytecode/CodeType.h: Added.
* bytecode/ExpressionRangeInfo.h: Added.
* bytecode/GlobalResolveInfo.h: Added.
(JSC::GlobalResolveInfo::GlobalResolveInfo):
* bytecode/HandlerInfo.h: Added.
* bytecode/LineInfo.h: Added.
* bytecode/MethodCallLinkInfo.cpp: Added.
(JSC::MethodCallLinkInfo::reset):
* bytecode/MethodCallLinkInfo.h: Added.
(JSC::MethodCallLinkInfo::MethodCallLinkInfo):
(JSC::MethodCallLinkInfo::seenOnce):
(JSC::MethodCallLinkInfo::setSeen):
(JSC::getMethodCallLinkInfoReturnLocation):
(JSC::getMethodCallLinkInfoBytecodeIndex):
* bytecode/StructureStubInfo.h:
(JSC::getStructureStubInfoReturnLocation):
(JSC::getStructureStubInfoBytecodeIndex):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104646 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent af5a9e6b
......@@ -34,9 +34,11 @@ SET(JavaScriptCore_SOURCES
API/JSWeakObjectMapRefPrivate.cpp
API/OpaqueJSString.cpp
bytecode/CallLinkInfo.cpp
bytecode/CodeBlock.cpp
bytecode/DFGExitProfile.cpp
bytecode/JumpTable.cpp
bytecode/MethodCallLinkInfo.cpp
bytecode/Opcode.cpp
bytecode/PredictedType.cpp
bytecode/SamplingTool.cpp
......
2012-01-10 Filip Pizlo <fpizlo@apple.com>
CodeBlock.h declares too many things
https://bugs.webkit.org/show_bug.cgi?id=76001
Rubber stamped by Gavin Barraclough.
Removed all non-CodeBlock type declarations from CodeBlock.h, and put them
into separate header files. Also removed all non-CodeBlock method implementations
from CodeBlock.cpp and put them into corresponding cpp files.
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* assembler/RepatchBuffer.h:
* bytecode/CallLinkInfo.cpp: Added.
(JSC::CallLinkInfo::unlink):
* bytecode/CallLinkInfo.h: Added.
(JSC::CallLinkInfo::callTypeFor):
(JSC::CallLinkInfo::CallLinkInfo):
(JSC::CallLinkInfo::~CallLinkInfo):
(JSC::CallLinkInfo::isLinked):
(JSC::CallLinkInfo::seenOnce):
(JSC::CallLinkInfo::setSeen):
(JSC::getCallLinkInfoReturnLocation):
(JSC::getCallLinkInfoBytecodeIndex):
* bytecode/CallReturnOffsetToBytecodeOffset.h: Added.
(JSC::CallReturnOffsetToBytecodeOffset::CallReturnOffsetToBytecodeOffset):
(JSC::getCallReturnOffset):
* bytecode/CodeBlock.cpp:
* bytecode/CodeBlock.h:
* bytecode/CodeType.h: Added.
* bytecode/ExpressionRangeInfo.h: Added.
* bytecode/GlobalResolveInfo.h: Added.
(JSC::GlobalResolveInfo::GlobalResolveInfo):
* bytecode/HandlerInfo.h: Added.
* bytecode/LineInfo.h: Added.
* bytecode/MethodCallLinkInfo.cpp: Added.
(JSC::MethodCallLinkInfo::reset):
* bytecode/MethodCallLinkInfo.h: Added.
(JSC::MethodCallLinkInfo::MethodCallLinkInfo):
(JSC::MethodCallLinkInfo::seenOnce):
(JSC::MethodCallLinkInfo::setSeen):
(JSC::getMethodCallLinkInfoReturnLocation):
(JSC::getMethodCallLinkInfoBytecodeIndex):
* bytecode/StructureStubInfo.h:
(JSC::getStructureStubInfoReturnLocation):
(JSC::getStructureStubInfoBytecodeIndex):
2012-01-10 Anders Carlsson <andersca@apple.com>
Hang opening movie that requires authentication
......@@ -81,6 +81,10 @@ javascriptcore_sources += \
Source/JavaScriptCore/assembler/RepatchBuffer.h \
Source/JavaScriptCore/assembler/SH4Assembler.h \
Source/JavaScriptCore/assembler/X86Assembler.h \
Source/JavaScriptCore/bytecode/CallLinkInfo.cpp \
Source/JavaScriptCore/bytecode/CallLinkInfo.h \
Source/JavaScriptCore/bytecode/CallReturnOffsetToBytecodeOffset.h \
Source/JavaScriptCore/bytecode/CodeType.h \
Source/JavaScriptCore/bytecode/CodeBlock.cpp \
Source/JavaScriptCore/bytecode/CodeBlock.h \
Source/JavaScriptCore/bytecode/CodeOrigin.h \
......@@ -88,9 +92,15 @@ javascriptcore_sources += \
Source/JavaScriptCore/bytecode/DFGExitProfile.cpp \
Source/JavaScriptCore/bytecode/DFGExitProfile.h \
Source/JavaScriptCore/bytecode/EvalCodeCache.h \
Source/JavaScriptCore/bytecode/ExpressionRangeInfo.h \
Source/JavaScriptCore/bytecode/GlobalResolveInfo.h \
Source/JavaScriptCore/bytecode/HandelerInfo.h \
Source/JavaScriptCore/bytecode/Instruction.h \
Source/JavaScriptCore/bytecode/JumpTable.cpp \
Source/JavaScriptCore/bytecode/JumpTable.h \
Source/JavaScriptCore/bytecode/LineInfo.h \
Source/JavaScriptCore/bytecode/MethodCallLinkInfo.cpp \
Source/JavaScriptCore/bytecode/MethodCallLinkInfo.h \
Source/JavaScriptCore/bytecode/Opcode.cpp \
Source/JavaScriptCore/bytecode/Opcode.h \
Source/JavaScriptCore/bytecode/PredictedType.cpp \
......
......@@ -1449,6 +1449,46 @@
<Filter
Name="bytecode"
>
<File
RelativePath="..\..\bytecode\HandlerInfo.h"
>
</File>
<File
RelativePath="..\..\bytecode\CallLinkInfo.cpp"
>
</File>
<File
RelativePath="..\..\bytecode\LineInfo.h"
>
</File>
<File
RelativePath="..\..\bytecode\MethodCallLinkInfo.h"
>
</File>
<File
RelativePath="..\..\bytecode\CallReturnOffsetToBytecodeOffset.h"
>
</File>
<File
RelativePath="..\..\bytecode\CodeType.h"
>
</File>
<File
RelativePath="..\..\bytecode\ExpressionRangeInfo.h"
>
</File>
<File
RelativePath="..\..\bytecode\MethodCallLinkInfo.cpp"
>
</File>
<File
RelativePath="..\..\bytecode\CallLinkInfo.h"
>
</File>
<File
RelativePath="..\..\bytecode\GlobalResolveInfo.h"
>
</File>
<File
RelativePath="..\..\bytecode\CodeBlock.cpp"
>
......
......@@ -48,6 +48,16 @@
0BAC94A01338728400CF135B /* ThreadRestrictionVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BAC949E1338728400CF135B /* ThreadRestrictionVerifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
0BCD83571485845200EA2003 /* TemporaryChange.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BCD83541485841200EA2003 /* TemporaryChange.h */; settings = {ATTRIBUTES = (Private, ); }; };
0BF28A2911A33DC300638F84 /* SizeLimits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0BF28A2811A33DC300638F84 /* SizeLimits.cpp */; };
0F0B83A714BCF50700885B4F /* CodeType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83A514BCF50400885B4F /* CodeType.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F0B83A914BCF56200885B4F /* HandlerInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83A814BCF55E00885B4F /* HandlerInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F0B83AB14BCF5BB00885B4F /* ExpressionRangeInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83AA14BCF5B900885B4F /* ExpressionRangeInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F0B83AD14BCF60400885B4F /* LineInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83AC14BCF60200885B4F /* LineInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F0B83B014BCF71600885B4F /* CallLinkInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0B83AE14BCF71400885B4F /* CallLinkInfo.cpp */; };
0F0B83B114BCF71800885B4F /* CallLinkInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83AF14BCF71400885B4F /* CallLinkInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F0B83B414BCF86000885B4F /* MethodCallLinkInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0B83B214BCF85E00885B4F /* MethodCallLinkInfo.cpp */; };
0F0B83B514BCF86200885B4F /* MethodCallLinkInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83B314BCF85E00885B4F /* MethodCallLinkInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F0B83B714BCF8E100885B4F /* GlobalResolveInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83B614BCF8DF00885B4F /* GlobalResolveInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F0B83B914BCF95F00885B4F /* CallReturnOffsetToBytecodeOffset.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83B814BCF95B00885B4F /* CallReturnOffsetToBytecodeOffset.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F15F15F14B7A73E005DE37D /* CommonSlowPaths.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F15F15D14B7A73A005DE37D /* CommonSlowPaths.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F16D726142C39C000CF784A /* BitVector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F16D724142C39A200CF784A /* BitVector.cpp */; };
0F242DA713F3B1E8007ADD4C /* WeakReferenceHarvester.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F242DA513F3B1BB007ADD4C /* WeakReferenceHarvester.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -805,6 +815,16 @@
0BAC949E1338728400CF135B /* ThreadRestrictionVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadRestrictionVerifier.h; sourceTree = "<group>"; };
0BCD83541485841200EA2003 /* TemporaryChange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemporaryChange.h; sourceTree = "<group>"; };
0BF28A2811A33DC300638F84 /* SizeLimits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SizeLimits.cpp; sourceTree = "<group>"; };
0F0B83A514BCF50400885B4F /* CodeType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeType.h; sourceTree = "<group>"; };
0F0B83A814BCF55E00885B4F /* HandlerInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HandlerInfo.h; sourceTree = "<group>"; };
0F0B83AA14BCF5B900885B4F /* ExpressionRangeInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExpressionRangeInfo.h; sourceTree = "<group>"; };
0F0B83AC14BCF60200885B4F /* LineInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineInfo.h; sourceTree = "<group>"; };
0F0B83AE14BCF71400885B4F /* CallLinkInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallLinkInfo.cpp; sourceTree = "<group>"; };
0F0B83AF14BCF71400885B4F /* CallLinkInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallLinkInfo.h; sourceTree = "<group>"; };
0F0B83B214BCF85E00885B4F /* MethodCallLinkInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MethodCallLinkInfo.cpp; sourceTree = "<group>"; };
0F0B83B314BCF85E00885B4F /* MethodCallLinkInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MethodCallLinkInfo.h; sourceTree = "<group>"; };
0F0B83B614BCF8DF00885B4F /* GlobalResolveInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlobalResolveInfo.h; sourceTree = "<group>"; };
0F0B83B814BCF95B00885B4F /* CallReturnOffsetToBytecodeOffset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallReturnOffsetToBytecodeOffset.h; sourceTree = "<group>"; };
0F15F15D14B7A73A005DE37D /* CommonSlowPaths.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonSlowPaths.h; sourceTree = "<group>"; };
0F16D724142C39A200CF784A /* BitVector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BitVector.cpp; sourceTree = "<group>"; };
0F242DA513F3B1BB007ADD4C /* WeakReferenceHarvester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakReferenceHarvester.h; sourceTree = "<group>"; };
......@@ -2454,6 +2474,16 @@
969A078F0ED1D3AE00F1F681 /* bytecode */ = {
isa = PBXGroup;
children = (
0F0B83B814BCF95B00885B4F /* CallReturnOffsetToBytecodeOffset.h */,
0F0B83B614BCF8DF00885B4F /* GlobalResolveInfo.h */,
0F0B83B214BCF85E00885B4F /* MethodCallLinkInfo.cpp */,
0F0B83B314BCF85E00885B4F /* MethodCallLinkInfo.h */,
0F0B83AE14BCF71400885B4F /* CallLinkInfo.cpp */,
0F0B83AF14BCF71400885B4F /* CallLinkInfo.h */,
0F0B83AC14BCF60200885B4F /* LineInfo.h */,
0F0B83AA14BCF5B900885B4F /* ExpressionRangeInfo.h */,
0F0B83A814BCF55E00885B4F /* HandlerInfo.h */,
0F0B83A514BCF50400885B4F /* CodeType.h */,
969A07900ED1D3AE00F1F681 /* CodeBlock.cpp */,
969A07910ED1D3AE00F1F681 /* CodeBlock.h */,
0FBD7E671447998F00481315 /* CodeOrigin.h */,
......@@ -2983,6 +3013,14 @@
86704B4312DB8A8100A9FE7B /* YarrSyntaxChecker.h in Headers */,
0F15F15F14B7A73E005DE37D /* CommonSlowPaths.h in Headers */,
0F46808214BA572D00BFE272 /* JITExceptions.h in Headers */,
0F0B83A714BCF50700885B4F /* CodeType.h in Headers */,
0F0B83A914BCF56200885B4F /* HandlerInfo.h in Headers */,
0F0B83AB14BCF5BB00885B4F /* ExpressionRangeInfo.h in Headers */,
0F0B83AD14BCF60400885B4F /* LineInfo.h in Headers */,
0F0B83B114BCF71800885B4F /* CallLinkInfo.h in Headers */,
0F0B83B514BCF86200885B4F /* MethodCallLinkInfo.h in Headers */,
0F0B83B714BCF8E100885B4F /* GlobalResolveInfo.h in Headers */,
0F0B83B914BCF95F00885B4F /* CallReturnOffsetToBytecodeOffset.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -3518,6 +3556,8 @@
86704B8912DBA33700A9FE7B /* YarrPattern.cpp in Sources */,
86704B4212DB8A8100A9FE7B /* YarrSyntaxChecker.cpp in Sources */,
0F46808314BA573100BFE272 /* JITExceptions.cpp in Sources */,
0F0B83B014BCF71600885B4F /* CallLinkInfo.cpp in Sources */,
0F0B83B414BCF86000885B4F /* MethodCallLinkInfo.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -49,9 +49,11 @@ SOURCES += \
assembler/ARMv7Assembler.cpp \
assembler/MacroAssemblerARM.cpp \
assembler/MacroAssemblerSH4.cpp \
bytecode/CallLinkInfo.cpp \
bytecode/CodeBlock.cpp \
bytecode/DFGExitProfile.cpp \
bytecode/JumpTable.cpp \
bytecode/MethodCallLinkInfo.cpp \
bytecode/Opcode.cpp \
bytecode/PredictedType.cpp \
bytecode/SamplingTool.cpp \
......
......@@ -28,6 +28,7 @@
#if ENABLE(ASSEMBLER)
#include "CodeBlock.h"
#include <MacroAssembler.h>
#include <wtf/Noncopyable.h>
......
/*
* Copyright (C) 2012 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 "CallLinkInfo.h"
#include "DFGOperations.h"
#include "RepatchBuffer.h"
#if ENABLE(JIT)
namespace JSC {
void CallLinkInfo::unlink(JSGlobalData& globalData, RepatchBuffer& repatchBuffer)
{
ASSERT(isLinked());
if (isDFG) {
#if ENABLE(DFG_JIT)
repatchBuffer.relink(CodeLocationCall(callReturnLocation), callType == Construct ? DFG::operationLinkConstruct : DFG::operationLinkCall);
#else
ASSERT_NOT_REACHED();
#endif
} else
repatchBuffer.relink(CodeLocationNearCall(callReturnLocation), callType == Construct ? globalData.jitStubs->ctiVirtualConstructLink() : globalData.jitStubs->ctiVirtualCallLink());
hasSeenShouldRepatch = false;
callee.clear();
// It will be on a list if the callee has a code block.
if (isOnList())
remove();
}
} // namespace JSC
#endif // ENABLE(JIT)
/*
* Copyright (C) 2012 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 CallLinkInfo_h
#define CallLinkInfo_h
#include "CodeLocation.h"
#include "JITWriteBarrier.h"
#include "JSFunction.h"
#include "Opcode.h"
#include "WriteBarrier.h"
#include <wtf/Platform.h>
#include <wtf/SentinelLinkedList.h>
namespace JSC {
#if ENABLE(JIT)
class RepatchBuffer;
struct CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> {
enum CallType { None, Call, CallVarargs, Construct };
static CallType callTypeFor(OpcodeID opcodeID)
{
if (opcodeID == op_call || opcodeID == op_call_eval)
return Call;
if (opcodeID == op_construct)
return Construct;
ASSERT(opcodeID == op_call_varargs);
return CallVarargs;
}
CallLinkInfo()
: hasSeenShouldRepatch(false)
, isDFG(false)
, callType(None)
{
}
~CallLinkInfo()
{
if (isOnList())
remove();
}
CodeLocationLabel callReturnLocation; // it's a near call in the old JIT, or a normal call in DFG
CodeLocationDataLabelPtr hotPathBegin;
CodeLocationNearCall hotPathOther;
JITWriteBarrier<JSFunction> callee;
WriteBarrier<JSFunction> lastSeenCallee;
bool hasSeenShouldRepatch : 1;
bool isDFG : 1;
CallType callType : 2;
unsigned bytecodeIndex;
bool isLinked() { return callee; }
void unlink(JSGlobalData&, RepatchBuffer&);
bool seenOnce()
{
return hasSeenShouldRepatch;
}
void setSeen()
{
hasSeenShouldRepatch = true;
}
};
inline void* getCallLinkInfoReturnLocation(CallLinkInfo* callLinkInfo)
{
return callLinkInfo->callReturnLocation.executableAddress();
}
inline unsigned getCallLinkInfoBytecodeIndex(CallLinkInfo* callLinkInfo)
{
return callLinkInfo->bytecodeIndex;
}
#endif // ENABLE(JIT)
} // namespace JSC
#endif // CallLinkInfo_h
/*
* Copyright (C) 2012 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 CallReturnOffsetToBytecodeOffset_h
#define CallReturnOffsetToBytecodeOffset_h
#include <wtf/Platform.h>
namespace JSC {
#if ENABLE(JIT)
// This structure is used to map from a call return location
// (given as an offset in bytes into the JIT code) back to
// the bytecode index of the corresponding bytecode operation.
// This is then used to look up the corresponding handler.
// FIXME: This should be made inlining aware! Currently it isn't
// because we never inline code that has exception handlers.
struct CallReturnOffsetToBytecodeOffset {
CallReturnOffsetToBytecodeOffset(unsigned callReturnOffset, unsigned bytecodeOffset)
: callReturnOffset(callReturnOffset)
, bytecodeOffset(bytecodeOffset)
{
}
unsigned callReturnOffset;
unsigned bytecodeOffset;
};
inline unsigned getCallReturnOffset(CallReturnOffsetToBytecodeOffset* pc)
{
return pc->callReturnOffset;
}
#endif
} // namespace JSC
#endif // CallReturnOffsetToBytecodeOffset_h
......@@ -2056,38 +2056,6 @@ void CodeBlock::createActivation(CallFrame* callFrame)
}
#if ENABLE(JIT)
void CallLinkInfo::unlink(JSGlobalData& globalData, RepatchBuffer& repatchBuffer)
{
ASSERT(isLinked());
if (isDFG) {
#if ENABLE(DFG_JIT)
repatchBuffer.relink(CodeLocationCall(callReturnLocation), callType == Construct ? operationLinkConstruct : operationLinkCall);
#else
ASSERT_NOT_REACHED();
#endif
} else
repatchBuffer.relink(CodeLocationNearCall(callReturnLocation), callType == Construct ? globalData.jitStubs->ctiVirtualConstructLink() : globalData.jitStubs->ctiVirtualCallLink());
hasSeenShouldRepatch = false;
callee.clear();
// It will be on a list if the callee has a code block.
if (isOnList())
remove();
}
void MethodCallLinkInfo::reset(RepatchBuffer& repatchBuffer, JITCode::JITType jitType)
{
cachedStructure.clearToMaxUnsigned();
cachedPrototype.clear();
cachedPrototypeStructure.clearToMaxUnsigned();
cachedFunction.clear();
ASSERT_UNUSED(jitType, jitType == JITCode::BaselineJIT);
repatchBuffer.relink(callReturnLocation, cti_op_get_by_id_method_check);
}
void CodeBlock::unlinkCalls()
{
if (!!m_alternative)
......
......@@ -30,22 +30,31 @@
#ifndef CodeBlock_h
#define CodeBlock_h
#include "CallLinkInfo.h"
#include "CallReturnOffsetToBytecodeOffset.h"
#include "CodeOrigin.h"
#include "CodeType.h"
#include "CompactJITCodeMap.h"
#include "DFGCodeBlocks.h"
#include "DFGExitProfile.h"
#include "DFGOSREntry.h"
#include "DFGOSRExit.h"
#include "EvalCodeCache.h"
#include "ExpressionRangeInfo.h"
#include "GlobalResolveInfo.h"
#include "HandlerInfo.h"
#include "MethodCallLinkInfo.h"
#include "Options.h"
#include "Instruction.h"
#include "JITCode.h"
#include "JITWriteBarrier.h"
#include "JSGlobalObject.h"
#include "JumpTable.h"
#include "LineInfo.h"
#include "Nodes.h"
#include "PredictionTracker.h"
#include "RegExpObject.h"
#include "StructureStubInfo.h"
#include "UString.h"
#include "UnconditionalFinalizer.h"
#include "ValueProfile.h"
......@@ -53,12 +62,8 @@
#include <wtf/PassOwnPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/SegmentedVector.h>
#include <wtf/SentinelLinkedList.h>
#include <wtf/Vector.h>
#if ENABLE(JIT)
#include "StructureStubInfo.h"
#endif
// Register numbers used in bytecode operations have different meaning according to their ranges:
// 0x80000000-0xFFFFFFFF Negative indices from the CallFrame pointer are entries in the call frame, see RegisterFile.h.
......@@ -68,191 +73,13 @@ static const int FirstConstantRegisterIndex = 0x40000000;
namespace JSC {
enum HasSeenShouldRepatch {
hasSeenShouldRepatch
};
class ExecState;
class DFGCodeBlocks;
enum CodeType { GlobalCode, EvalCode, FunctionCode };
inline int unmodifiedArgumentsRegister(int argumentsRegister) { return argumentsRegister - 1; }
static ALWAYS_INLINE int missingThisObjectMarker() { return std::numeric_limits<int>::max(); }
struct HandlerInfo {
uint32_t start;
uint32_t end;
uint32_t target;
uint32_t scopeDepth;
#if ENABLE(JIT)
CodeLocationLabel nativeCode;
#endif
};
struct ExpressionRangeInfo {
enum {
MaxOffset = (1 << 7) - 1,
MaxDivot = (1 << 25) - 1
};
uint32_t instructionOffset : 25;
uint32_t divotPoint : 25;
uint32_t startOffset : 7;
uint32_t endOffset : 7;
};
struct LineInfo {
uint32_t instructionOffset;
int32_t lineNumber;
};
#if ENABLE(JIT)
struct CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> {
enum CallType { None, Call, CallVarargs, Construct };
static CallType callTypeFor(OpcodeID opcodeID)
{
if (opcodeID == op_call || opcodeID == op_call_eval)
return Call;
if (opcodeID == op_construct)
return Construct;
ASSERT(opcodeID == op_call_varargs);
return CallVarargs;
}
CallLinkInfo()
: hasSeenShouldRepatch(false)
, isDFG(false)
, callType(None)
{
}
~CallLinkInfo()
{
if (isOnList())
remove();