2008-10-23 Gavin Barraclough <barraclough@apple.com>
Reviewed by Oliver Hunt.
Fix hideous pathological case performance when looking up repatch info, bug #21727.
When repatching JIT code to optimize we look up records providing information about
the generated code (also used to track recsources used in linking to be later released).
The lookup was being performed using a linear scan of all such records.
(1) Split up the different types of reptach information. This means we can search them
separately, and in some cases should reduce their size.
(2) In the case of property accesses, search with a binary chop over the data.
(3) In the case of calls, pass a pointer to the repatch info into the relink function.
* VM/CTI.cpp:
(JSC::CTI::CTI):
(JSC::CTI::compileOpCall):
(JSC::CTI::privateCompileMainPass):
(JSC::CTI::privateCompileSlowCases):
(JSC::CTI::privateCompile):
(JSC::CTI::unlinkCall):
(JSC::CTI::linkCall):
* VM/CTI.h:
* VM/CodeBlock.cpp:
(JSC::CodeBlock::dump):
(JSC::CodeBlock::~CodeBlock):
(JSC::CodeBlock::unlinkCallers):
(JSC::CodeBlock::derefStructureIDs):
* VM/CodeBlock.h:
(JSC::StructureStubInfo::StructureStubInfo):
(JSC::CallLinkInfo::CallLinkInfo):
(JSC::CallLinkInfo::setUnlinked):
(JSC::CallLinkInfo::isLinked):
(JSC::getStructureStubInfoReturnLocation):
(JSC::binaryChop):
(JSC::CodeBlock::addCaller):
(JSC::CodeBlock::getStubInfo):
* VM/CodeGenerator.cpp:
(JSC::CodeGenerator::emitResolve):
(JSC::CodeGenerator::emitGetById):
(JSC::CodeGenerator::emitPutById):
(JSC::CodeGenerator::emitCall):
(JSC::CodeGenerator::emitConstruct):
* VM/Machine.cpp:
(JSC::Machine::cti_vm_lazyLinkCall):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37831 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/VM/CTI.h b/JavaScriptCore/VM/CTI.h
index 674ced4..e2e5292 100644
--- a/JavaScriptCore/VM/CTI.h
+++ b/JavaScriptCore/VM/CTI.h
@@ -79,6 +79,7 @@
#define ARG_instr4 static_cast<Instruction*>(ARGS[4])
#define ARG_instr5 static_cast<Instruction*>(ARGS[5])
#define ARG_instr6 static_cast<Instruction*>(ARGS[6])
+#define ARG_linkInfo2 static_cast<CallLinkInfo*>(ARGS[2])
#define CTI_RETURN_ADDRESS_SLOT (ARGS[-1])
@@ -94,9 +95,9 @@
class StringJumpTable;
class StructureIDChain;
+ struct CallLinkInfo;
struct Instruction;
struct OperandTypes;
- struct StructureStubInfo;
typedef JSValue* (SFX_CALL *CTIHelper_j)(CTI_ARGS);
typedef JSObject* (SFX_CALL *CTIHelper_o)(CTI_ARGS);
@@ -334,8 +335,8 @@
return cti.privateCompilePatchGetArrayLength(returnAddress);
}
- static void linkCall(CodeBlock* callerCodeBlock, JSFunction* callee, CodeBlock* calleeCodeBlock, void* ctiCode, void* returnAddress, int callerArgCount);
- static void unlinkCall(StructureStubInfo*);
+ static void linkCall(JSFunction* callee, CodeBlock* calleeCodeBlock, void* ctiCode, CallLinkInfo* callLinkInfo, int callerArgCount);
+ static void unlinkCall(CallLinkInfo*);
inline static JSValuePtr execute(void* code, RegisterFile* registerFile, CallFrame* callFrame, JSGlobalData* globalData, JSValuePtr* exception)
{
@@ -433,7 +434,8 @@
Vector<CallRecord> m_calls;
Vector<X86Assembler::JmpDst> m_labels;
- Vector<StructureStubCompilationInfo> m_structureStubCompilationInfo;
+ Vector<StructureStubCompilationInfo> m_propertyAccessCompilationInfo;
+ Vector<StructureStubCompilationInfo> m_callStructureStubCompilationInfo;
Vector<JmpTable> m_jmpTable;
struct JSRInfo {