summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/JavaScriptCore/bytecode
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/bytecode')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp33
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h48
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.h12
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.h6
5 files changed, 69 insertions, 34 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp
index d2b122a..d777f73 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -1265,6 +1265,28 @@ void CodeBlock::dumpStatistics()
#endif
}
+CodeBlock::CodeBlock(ScopeNode* ownerNode)
+ : m_numCalleeRegisters(0)
+ , m_numConstants(0)
+ , m_numVars(0)
+ , m_numParameters(0)
+ , m_ownerNode(ownerNode)
+ , m_globalData(0)
+#ifndef NDEBUG
+ , m_instructionCount(0)
+#endif
+ , m_needsFullScopeChain(false)
+ , m_usesEval(false)
+ , m_isNumericCompareFunction(false)
+ , m_codeType(NativeCode)
+ , m_source(0)
+ , m_sourceOffset(0)
+ , m_exceptionInfo(0)
+{
+#if DUMP_CODE_BLOCK_STATISTICS
+ liveCodeBlockSet.add(this);
+#endif
+}
CodeBlock::CodeBlock(ScopeNode* ownerNode, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
: m_numCalleeRegisters(0)
@@ -1342,6 +1364,7 @@ void CodeBlock::unlinkCallers()
void CodeBlock::derefStructures(Instruction* vPC) const
{
+ ASSERT(m_codeType != NativeCode);
Interpreter* interpreter = m_globalData->interpreter;
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) {
@@ -1387,6 +1410,7 @@ void CodeBlock::derefStructures(Instruction* vPC) const
void CodeBlock::refStructures(Instruction* vPC) const
{
+ ASSERT(m_codeType != NativeCode);
Interpreter* interpreter = m_globalData->interpreter;
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) {
@@ -1441,6 +1465,7 @@ void CodeBlock::mark()
void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame)
{
+ ASSERT(m_codeType != NativeCode);
if (m_exceptionInfo)
return;
@@ -1511,6 +1536,7 @@ void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame)
HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset)
{
+ ASSERT(m_codeType != NativeCode);
ASSERT(bytecodeOffset < m_instructionCount);
if (!m_rareData)
@@ -1529,6 +1555,7 @@ HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset)
int CodeBlock::lineNumberForBytecodeOffset(CallFrame* callFrame, unsigned bytecodeOffset)
{
+ ASSERT(m_codeType != NativeCode);
ASSERT(bytecodeOffset < m_instructionCount);
reparseForExceptionInfoIfNecessary(callFrame);
@@ -1554,6 +1581,7 @@ int CodeBlock::lineNumberForBytecodeOffset(CallFrame* callFrame, unsigned byteco
int CodeBlock::expressionRangeForBytecodeOffset(CallFrame* callFrame, unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset)
{
+ ASSERT(m_codeType != NativeCode);
ASSERT(bytecodeOffset < m_instructionCount);
reparseForExceptionInfoIfNecessary(callFrame);
@@ -1593,6 +1621,7 @@ int CodeBlock::expressionRangeForBytecodeOffset(CallFrame* callFrame, unsigned b
bool CodeBlock::getByIdExceptionInfoForBytecodeOffset(CallFrame* callFrame, unsigned bytecodeOffset, OpcodeID& opcodeID)
{
+ ASSERT(m_codeType != NativeCode);
ASSERT(bytecodeOffset < m_instructionCount);
reparseForExceptionInfoIfNecessary(callFrame);
@@ -1621,6 +1650,7 @@ bool CodeBlock::getByIdExceptionInfoForBytecodeOffset(CallFrame* callFrame, unsi
#if ENABLE(JIT)
bool CodeBlock::functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex)
{
+ ASSERT(m_codeType != NativeCode);
ASSERT(bytecodeOffset < m_instructionCount);
if (!m_rareData || !m_rareData->m_functionRegisterInfos.size())
@@ -1647,6 +1677,7 @@ bool CodeBlock::functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int&
#if !ENABLE(JIT)
bool CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOffset)
{
+ ASSERT(m_codeType != NativeCode);
if (m_globalResolveInstructions.isEmpty())
return false;
@@ -1667,6 +1698,7 @@ bool CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOff
#else
bool CodeBlock::hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset)
{
+ ASSERT(m_codeType != NativeCode);
if (m_globalResolveInfos.isEmpty())
return false;
@@ -1689,6 +1721,7 @@ bool CodeBlock::hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset)
#if ENABLE(JIT)
void CodeBlock::setJITCode(JITCode jitCode)
{
+ ASSERT(m_codeType != NativeCode);
ownerNode()->setJITCode(jitCode);
#if !ENABLE(OPCODE_SAMPLING)
if (!BytecodeGenerator::dumpsGeneratedCode())
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h
index ac29c6c..afd32f0 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h
+++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h
@@ -38,6 +38,7 @@
#include "Nodes.h"
#include "RegExp.h"
#include "UString.h"
+#include <wtf/FastAllocBase.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
@@ -49,7 +50,7 @@ namespace JSC {
class ExecState;
- enum CodeType { GlobalCode, EvalCode, FunctionCode };
+ enum CodeType { GlobalCode, EvalCode, FunctionCode, NativeCode };
static ALWAYS_INLINE int missingThisObjectMarker() { return std::numeric_limits<int>::max(); }
@@ -59,7 +60,7 @@ namespace JSC {
uint32_t target;
uint32_t scopeDepth;
#if ENABLE(JIT)
- MacroAssembler::CodeLocationLabel nativeCode;
+ CodeLocationLabel nativeCode;
#endif
};
@@ -95,10 +96,9 @@ namespace JSC {
}
unsigned bytecodeIndex;
- MacroAssembler::CodeLocationNearCall callReturnLocation;
- MacroAssembler::CodeLocationDataLabelPtr hotPathBegin;
- MacroAssembler::CodeLocationNearCall hotPathOther;
- MacroAssembler::CodeLocationLabel coldPathOther;
+ CodeLocationNearCall callReturnLocation;
+ CodeLocationDataLabelPtr hotPathBegin;
+ CodeLocationNearCall hotPathOther;
CodeBlock* callee;
unsigned position;
@@ -112,8 +112,8 @@ namespace JSC {
{
}
- MacroAssembler::CodeLocationCall callReturnLocation;
- MacroAssembler::CodeLocationDataLabelPtr structureLabel;
+ CodeLocationCall callReturnLocation;
+ CodeLocationDataLabelPtr structureLabel;
Structure* cachedStructure;
};
@@ -160,17 +160,17 @@ namespace JSC {
inline void* getStructureStubInfoReturnLocation(StructureStubInfo* structureStubInfo)
{
- return structureStubInfo->callReturnLocation.calleeReturnAddressValue();
+ return structureStubInfo->callReturnLocation.executableAddress();
}
inline void* getCallLinkInfoReturnLocation(CallLinkInfo* callLinkInfo)
{
- return callLinkInfo->callReturnLocation.calleeReturnAddressValue();
+ return callLinkInfo->callReturnLocation.executableAddress();
}
inline void* getMethodCallLinkInfoReturnLocation(MethodCallLinkInfo* methodCallLinkInfo)
{
- return methodCallLinkInfo->callReturnLocation.calleeReturnAddressValue();
+ return methodCallLinkInfo->callReturnLocation.executableAddress();
}
inline unsigned getCallReturnOffset(CallReturnOffsetToBytecodeIndex* pc)
@@ -215,9 +215,10 @@ namespace JSC {
}
#endif
- class CodeBlock {
+ class CodeBlock : public WTF::FastAllocBase {
friend class JIT;
public:
+ CodeBlock(ScopeNode* ownerNode);
CodeBlock(ScopeNode* ownerNode, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset);
~CodeBlock();
@@ -287,25 +288,25 @@ namespace JSC {
m_linkedCallerList.shrink(lastPos);
}
- StructureStubInfo& getStubInfo(void* returnAddress)
+ StructureStubInfo& getStubInfo(ReturnAddressPtr returnAddress)
{
- return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(m_structureStubInfos.begin(), m_structureStubInfos.size(), returnAddress));
+ return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(m_structureStubInfos.begin(), m_structureStubInfos.size(), returnAddress.value()));
}
- CallLinkInfo& getCallLinkInfo(void* returnAddress)
+ CallLinkInfo& getCallLinkInfo(ReturnAddressPtr returnAddress)
{
- return *(binaryChop<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(m_callLinkInfos.begin(), m_callLinkInfos.size(), returnAddress));
+ return *(binaryChop<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(m_callLinkInfos.begin(), m_callLinkInfos.size(), returnAddress.value()));
}
- MethodCallLinkInfo& getMethodCallLinkInfo(void* returnAddress)
+ MethodCallLinkInfo& getMethodCallLinkInfo(ReturnAddressPtr returnAddress)
{
- return *(binaryChop<MethodCallLinkInfo, void*, getMethodCallLinkInfoReturnLocation>(m_methodCallLinkInfos.begin(), m_methodCallLinkInfos.size(), returnAddress));
+ return *(binaryChop<MethodCallLinkInfo, void*, getMethodCallLinkInfoReturnLocation>(m_methodCallLinkInfos.begin(), m_methodCallLinkInfos.size(), returnAddress.value()));
}
- unsigned getBytecodeIndex(CallFrame* callFrame, void* nativePC)
+ unsigned getBytecodeIndex(CallFrame* callFrame, ReturnAddressPtr returnAddress)
{
reparseForExceptionInfoIfNecessary(callFrame);
- return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(m_exceptionInfo->m_callReturnIndexVector.begin(), m_exceptionInfo->m_callReturnIndexVector.size(), ownerNode()->generatedJITCode().offsetOf(nativePC))->bytecodeIndex;
+ return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(m_exceptionInfo->m_callReturnIndexVector.begin(), m_exceptionInfo->m_callReturnIndexVector.size(), ownerNode()->generatedJITCode().offsetOf(returnAddress.value()))->bytecodeIndex;
}
bool functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex);
@@ -340,8 +341,8 @@ namespace JSC {
CodeType codeType() const { return m_codeType; }
- SourceProvider* source() const { return m_source.get(); }
- unsigned sourceOffset() const { return m_sourceOffset; }
+ SourceProvider* source() const { ASSERT(m_codeType != NativeCode); return m_source.get(); }
+ unsigned sourceOffset() const { ASSERT(m_codeType != NativeCode); return m_sourceOffset; }
size_t numberOfJumpTargets() const { return m_jumpTargets.size(); }
void addJumpTarget(unsigned jumpTarget) { m_jumpTargets.append(jumpTarget); }
@@ -433,7 +434,7 @@ namespace JSC {
SymbolTable& symbolTable() { return m_symbolTable; }
- EvalCodeCache& evalCodeCache() { createRareDataIfNecessary(); return m_rareData->m_evalCodeCache; }
+ EvalCodeCache& evalCodeCache() { ASSERT(m_codeType != NativeCode); createRareDataIfNecessary(); return m_rareData->m_evalCodeCache; }
void shrinkToFit();
@@ -457,6 +458,7 @@ namespace JSC {
void createRareDataIfNecessary()
{
+ ASSERT(m_codeType != NativeCode);
if (!m_rareData)
m_rareData.set(new RareData);
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h
index 24ba490..eeeac6f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h
+++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Instruction.h
@@ -38,12 +38,12 @@
namespace JSC {
- // *Sigh*, If the JIT is enabled we need to track the stubRountine (of type MacroAssembler::CodeLocationLabel),
+ // *Sigh*, If the JIT is enabled we need to track the stubRountine (of type CodeLocationLabel),
// If the JIT is not in use we don't actually need the variable (that said, if the JIT is not in use we don't
// curently actually use PolymorphicAccessStructureLists, which we should). Anyway, this seems like the best
// solution for now - will need to something smarter if/when we actually want mixed-mode operation.
#if ENABLE(JIT)
- typedef MacroAssembler::CodeLocationLabel PolymorphicAccessStructureListStubRoutineType;
+ typedef CodeLocationLabel PolymorphicAccessStructureListStubRoutineType;
#else
typedef void* PolymorphicAccessStructureListStubRoutineType;
#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.h
index eee773c..b4f8e44 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.h
+++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/JumpTable.h
@@ -40,7 +40,7 @@ namespace JSC {
struct OffsetLocation {
int32_t branchOffset;
#if ENABLE(JIT)
- MacroAssembler::CodeLocationLabel ctiOffset;
+ CodeLocationLabel ctiOffset;
#endif
};
@@ -48,7 +48,7 @@ namespace JSC {
typedef HashMap<RefPtr<UString::Rep>, OffsetLocation> StringOffsetTable;
StringOffsetTable offsetTable;
#if ENABLE(JIT)
- MacroAssembler::CodeLocationLabel ctiDefault; // FIXME: it should not be necessary to store this.
+ CodeLocationLabel ctiDefault; // FIXME: it should not be necessary to store this.
#endif
inline int32_t offsetForValue(UString::Rep* value, int32_t defaultOffset)
@@ -61,7 +61,7 @@ namespace JSC {
}
#if ENABLE(JIT)
- inline MacroAssembler::CodeLocationLabel ctiForValue(UString::Rep* value)
+ inline CodeLocationLabel ctiForValue(UString::Rep* value)
{
StringOffsetTable::const_iterator end = offsetTable.end();
StringOffsetTable::const_iterator loc = offsetTable.find(value);
@@ -77,8 +77,8 @@ namespace JSC {
Vector<int32_t> branchOffsets;
int32_t min;
#if ENABLE(JIT)
- Vector<MacroAssembler::CodeLocationLabel> ctiOffsets;
- MacroAssembler::CodeLocationLabel ctiDefault;
+ Vector<CodeLocationLabel> ctiOffsets;
+ CodeLocationLabel ctiDefault;
#endif
int32_t offsetForValue(int32_t value, int32_t defaultOffset);
@@ -89,7 +89,7 @@ namespace JSC {
}
#if ENABLE(JIT)
- inline MacroAssembler::CodeLocationLabel ctiForValue(int32_t value)
+ inline CodeLocationLabel ctiForValue(int32_t value)
{
if (value >= min && static_cast<uint32_t>(value - min) < ctiOffsets.size())
return ctiOffsets[value - min];
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.h
index 24fcb7d..95dd266 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.h
+++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/StructureStubInfo.h
@@ -144,9 +144,9 @@ namespace JSC {
} putByIdReplace;
} u;
- MacroAssembler::CodeLocationLabel stubRoutine;
- MacroAssembler::CodeLocationCall callReturnLocation;
- MacroAssembler::CodeLocationLabel hotPathBegin;
+ CodeLocationLabel stubRoutine;
+ CodeLocationCall callReturnLocation;
+ CodeLocationLabel hotPathBegin;
};
} // namespace JSC