summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/bytecode/CodeBlock.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-01-11 10:03:25 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-01-11 10:03:25 +0100
commitd11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (patch)
treeb318cf594dc1da2fa48224005945c9157f35bb41 /Source/JavaScriptCore/bytecode/CodeBlock.h
parent6300a96eca9f152b379f1bcf3d9efdc5572d989a (diff)
downloadqtwebkit-d11f84f5b5cdc0d92a08af01b13472fdd5f9acb9.tar.gz
Imported WebKit commit 75bb2fc5882d2e1b3d5572c2961507996cbca5e3 (http://svn.webkit.org/repository/webkit/trunk@104681)
Diffstat (limited to 'Source/JavaScriptCore/bytecode/CodeBlock.h')
-rw-r--r--Source/JavaScriptCore/bytecode/CodeBlock.h207
1 files changed, 20 insertions, 187 deletions
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h
index 159cb65de..c440c72e1 100644
--- a/Source/JavaScriptCore/bytecode/CodeBlock.h
+++ b/Source/JavaScriptCore/bytecode/CodeBlock.h
@@ -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();
- }
-
- 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;
- }
- };
-
- struct MethodCallLinkInfo {
- MethodCallLinkInfo()
- : seen(false)
- {
- }
-
- bool seenOnce()
- {
- return seen;
- }
-
- void setSeen()
- {
- seen = true;
- }
-
- void reset(RepatchBuffer&, JITCode::JITType);
-
- unsigned bytecodeIndex;
- CodeLocationCall callReturnLocation;
- JITWriteBarrier<Structure> cachedStructure;
- JITWriteBarrier<Structure> cachedPrototypeStructure;
- // We'd like this to actually be JSFunction, but InternalFunction and JSFunction
- // don't have a common parent class and we allow specialisation on both
- JITWriteBarrier<JSObject> cachedFunction;
- JITWriteBarrier<JSObject> cachedPrototype;
- bool seen;
- };
-
- struct GlobalResolveInfo {
- GlobalResolveInfo(unsigned bytecodeOffset)
- : offset(0)
- , bytecodeOffset(bytecodeOffset)
- {
- }
-
- WriteBarrier<Structure> structure;
- unsigned offset;
- unsigned bytecodeOffset;
- };
-
- // 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;
- };
-
- // valueAtPosition helpers for the binarySearch algorithm.
-
- inline void* getStructureStubInfoReturnLocation(StructureStubInfo* structureStubInfo)
- {
- return structureStubInfo->callReturnLocation.executableAddress();
- }
-
- inline unsigned getStructureStubInfoBytecodeIndex(StructureStubInfo* structureStubInfo)
- {
- return structureStubInfo->bytecodeIndex;
- }
-
- inline void* getCallLinkInfoReturnLocation(CallLinkInfo* callLinkInfo)
- {
- return callLinkInfo->callReturnLocation.executableAddress();
- }
-
- inline unsigned getCallLinkInfoBytecodeIndex(CallLinkInfo* callLinkInfo)
- {
- return callLinkInfo->bytecodeIndex;
- }
-
- inline void* getMethodCallLinkInfoReturnLocation(MethodCallLinkInfo* methodCallLinkInfo)
- {
- return methodCallLinkInfo->callReturnLocation.executableAddress();
- }
-
- inline unsigned getMethodCallLinkInfoBytecodeIndex(MethodCallLinkInfo* methodCallLinkInfo)
- {
- return methodCallLinkInfo->bytecodeIndex;
- }
-
- inline unsigned getCallReturnOffset(CallReturnOffsetToBytecodeOffset* pc)
- {
- return pc->callReturnOffset;
- }
-#endif
-
class CodeBlock : public UnconditionalFinalizer, public WeakReferenceHarvester {
WTF_MAKE_FAST_ALLOCATED;
friend class JIT;
@@ -268,6 +95,13 @@ namespace JSC {
public:
virtual ~CodeBlock();
+
+ int numParameters() const { return m_numParameters; }
+ void setNumParameters(int newValue);
+ void addParameter();
+
+ int* addressOfNumParameters() { return &m_numParameters; }
+ static ptrdiff_t offsetOfNumParameters() { return OBJECT_OFFSETOF(CodeBlock, m_numParameters); }
CodeBlock* alternative() { return m_alternative.get(); }
PassOwnPtr<CodeBlock> releaseAlternative() { return m_alternative.release(); }
@@ -657,12 +491,10 @@ namespace JSC {
#endif
#if ENABLE(VALUE_PROFILER)
- void setArgumentValueProfileSize(unsigned size)
- {
- m_argumentValueProfiles.resize(size);
- }
unsigned numberOfArgumentValueProfiles()
{
+ ASSERT(m_numParameters >= 0);
+ ASSERT(m_argumentValueProfiles.size() == static_cast<unsigned>(m_numParameters));
return m_argumentValueProfiles.size();
}
ValueProfile* valueProfileForArgument(unsigned argumentIndex)
@@ -1131,7 +963,6 @@ namespace JSC {
int m_numCalleeRegisters;
int m_numVars;
int m_numCapturedVars;
- int m_numParameters;
bool m_isConstructor;
// This is public because otherwise we would have many friends.
@@ -1195,6 +1026,8 @@ namespace JSC {
m_rareData = adoptPtr(new RareData);
}
+ int m_numParameters;
+
WriteBarrier<ScriptExecutable> m_ownerExecutable;
JSGlobalData* m_globalData;