Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (188931 => 188932)
--- trunk/Source/_javascript_Core/ChangeLog 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-08-25 19:40:46 UTC (rev 188932)
@@ -1,3 +1,152 @@
+2015-08-25 Saam barati <[email protected]>
+
+ Lets rename codeOriginIndex to callSiteIndex and get rid of CallFrame::Location.
+ https://bugs.webkit.org/show_bug.cgi?id=148213
+
+ Reviewed by Filip Pizlo.
+
+ This patch introduces a struct called CallSiteIndex which is
+ used as a wrapper for a 32-bit int to place things in the tag for ArgumentCount
+ in the call frame. On 32-bit we place Instruction* into this slot for LLInt and Basline.
+ For 32-bit DFG we place a an index into the code origin table in this slot.
+ On 64-bit we place a bytecode offset into this slot for LLInt and Baseline.
+ On 64-bit we place the index into the code origin table in this slot in the
+ DFG/FTL.
+
+ This patch also gets rid of the encoding scheme that describes if something is a
+ bytecode index or a code origin table index. This information can always
+ be determined based on the CodeBlock's' JITType.
+
+ StructureStubInfo now also has a CallSiteIndex which it stores to
+ the call frame when making a call.
+
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::hasCodeOrigins):
+ (JSC::CodeBlock::canGetCodeOrigin):
+ (JSC::CodeBlock::codeOrigin):
+ (JSC::CodeBlock::addFrequentExitSite):
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::StructureStubInfo):
+ * dfg/DFGCommonData.cpp:
+ (JSC::DFG::CommonData::notifyCompilingStructureTransition):
+ (JSC::DFG::CommonData::addCodeOrigin):
+ (JSC::DFG::CommonData::shrinkToFit):
+ * dfg/DFGCommonData.h:
+ (JSC::DFG::CommonData::CommonData):
+ * dfg/DFGJITCompiler.h:
+ (JSC::DFG::JITCompiler::setEndOfCode):
+ (JSC::DFG::JITCompiler::addCallSite):
+ (JSC::DFG::JITCompiler::emitStoreCodeOrigin):
+ * dfg/DFGOSRExitCompilerCommon.cpp:
+ (JSC::DFG::reifyInlinedCallFrames):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compileIn):
+ * dfg/DFGSpeculativeJIT32_64.cpp:
+ (JSC::DFG::SpeculativeJIT::cachedGetById):
+ (JSC::DFG::SpeculativeJIT::cachedPutById):
+ * dfg/DFGSpeculativeJIT64.cpp:
+ (JSC::DFG::SpeculativeJIT::cachedGetById):
+ (JSC::DFG::SpeculativeJIT::cachedPutById):
+ * ftl/FTLCompile.cpp:
+ (JSC::FTL::mmAllocateDataSection):
+ * ftl/FTLInlineCacheDescriptor.h:
+ (JSC::FTL::InlineCacheDescriptor::InlineCacheDescriptor):
+ (JSC::FTL::InlineCacheDescriptor::stackmapID):
+ (JSC::FTL::InlineCacheDescriptor::callSiteIndex):
+ (JSC::FTL::InlineCacheDescriptor::uid):
+ (JSC::FTL::GetByIdDescriptor::GetByIdDescriptor):
+ (JSC::FTL::PutByIdDescriptor::PutByIdDescriptor):
+ (JSC::FTL::CheckInDescriptor::CheckInDescriptor):
+ (JSC::FTL::InlineCacheDescriptor::codeOrigin): Deleted.
+ * ftl/FTLLink.cpp:
+ (JSC::FTL::link):
+ * ftl/FTLLowerDFGToLLVM.cpp:
+ (JSC::FTL::DFG::LowerDFGToLLVM::compilePutById):
+ (JSC::FTL::DFG::LowerDFGToLLVM::compileIn):
+ (JSC::FTL::DFG::LowerDFGToLLVM::getById):
+ (JSC::FTL::DFG::LowerDFGToLLVM::callPreflight):
+ * ftl/FTLSlowPathCall.cpp:
+ (JSC::FTL::storeCodeOrigin):
+ * interpreter/CallFrame.cpp:
+ (JSC::CallFrame::currentVPC):
+ (JSC::CallFrame::setCurrentVPC):
+ (JSC::CallFrame::callSiteBitsAsBytecodeOffset):
+ (JSC::CallFrame::bytecodeOffset):
+ (JSC::CallFrame::codeOrigin):
+ (JSC::CallFrame::topOfFrameInternal):
+ (JSC::CallFrame::locationAsBytecodeOffset): Deleted.
+ (JSC::CallFrame::setLocationAsBytecodeOffset): Deleted.
+ (JSC::CallFrame::bytecodeOffsetFromCodeOriginIndex): Deleted.
+ * interpreter/CallFrame.h:
+ (JSC::CallSiteIndex::CallSiteIndex):
+ (JSC::CallSiteIndex::bits):
+ (JSC::ExecState::returnPCOffset):
+ (JSC::ExecState::abstractReturnPC):
+ (JSC::ExecState::topOfFrame):
+ (JSC::ExecState::setCallerFrame):
+ (JSC::ExecState::setScope):
+ (JSC::ExecState::currentVPC): Deleted.
+ (JSC::ExecState::setCurrentVPC): Deleted.
+ * interpreter/CallFrameInlines.h:
+ (JSC::CallFrame::callSiteBitsAreBytecodeOffset):
+ (JSC::CallFrame::callSiteBitsAreCodeOriginIndex):
+ (JSC::CallFrame::callSiteAsRawBits):
+ (JSC::CallFrame::callSiteIndex):
+ (JSC::CallFrame::hasActivation):
+ (JSC::CallFrame::Location::encode): Deleted.
+ (JSC::CallFrame::Location::decode): Deleted.
+ (JSC::CallFrame::Location::encodeAsBytecodeOffset): Deleted.
+ (JSC::CallFrame::Location::encodeAsBytecodeInstruction): Deleted.
+ (JSC::CallFrame::Location::encodeAsCodeOriginIndex): Deleted.
+ (JSC::CallFrame::Location::isBytecodeLocation): Deleted.
+ (JSC::CallFrame::Location::isCodeOriginIndex): Deleted.
+ (JSC::CallFrame::hasLocationAsBytecodeOffset): Deleted.
+ (JSC::CallFrame::hasLocationAsCodeOriginIndex): Deleted.
+ (JSC::CallFrame::locationAsRawBits): Deleted.
+ (JSC::CallFrame::setLocationAsRawBits): Deleted.
+ (JSC::CallFrame::locationAsBytecodeOffset): Deleted.
+ (JSC::CallFrame::setLocationAsBytecodeOffset): Deleted.
+ (JSC::CallFrame::locationAsCodeOriginIndex): Deleted.
+ * interpreter/StackVisitor.cpp:
+ (JSC::StackVisitor::readFrame):
+ (JSC::StackVisitor::readNonInlinedFrame):
+ (JSC::StackVisitor::Frame::print):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::compileOpCall):
+ * jit/JITInlineCacheGenerator.cpp:
+ (JSC::garbageStubInfo):
+ (JSC::JITInlineCacheGenerator::JITInlineCacheGenerator):
+ (JSC::JITByIdGenerator::JITByIdGenerator):
+ (JSC::JITByIdGenerator::generateFastPathChecks):
+ (JSC::JITGetByIdGenerator::JITGetByIdGenerator):
+ (JSC::JITGetByIdGenerator::generateFastPath):
+ (JSC::JITPutByIdGenerator::JITPutByIdGenerator):
+ * jit/JITInlineCacheGenerator.h:
+ (JSC::JITInlineCacheGenerator::JITInlineCacheGenerator):
+ (JSC::JITInlineCacheGenerator::stubInfo):
+ (JSC::JITByIdGenerator::JITByIdGenerator):
+ (JSC::JITGetByIdGenerator::JITGetByIdGenerator):
+ (JSC::JITPutByIdGenerator::JITPutByIdGenerator):
+ * jit/JITInlines.h:
+ (JSC::JIT::updateTopCallFrame):
+ * jit/JITOperations.cpp:
+ (JSC::getByVal):
+ (JSC::tryGetByValOptimize):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emitGetByValWithCachedId):
+ (JSC::JIT::emitPutByValWithCachedId):
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::emit_op_put_by_id):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emitGetByValWithCachedId):
+ (JSC::JIT::emitPutByValWithCachedId):
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::emit_op_put_by_id):
+ * jit/Repatch.cpp:
+ (JSC::generateByIdStub):
+
2015-08-25 Aleksandr Skachkov <[email protected]>
Function.prototype.toString is incorrect for ArrowFunction
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (188931 => 188932)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2015-08-25 19:40:46 UTC (rev 188932)
@@ -501,16 +501,16 @@
return JITCode::isOptimizingJIT(jitType());
}
- bool canGetCodeOrigin(unsigned index)
+ bool canGetCodeOrigin(CallSiteIndex index)
{
if (!hasCodeOrigins())
return false;
- return index < codeOrigins().size();
+ return index.bits() < codeOrigins().size();
}
- CodeOrigin codeOrigin(unsigned index)
+ CodeOrigin codeOrigin(CallSiteIndex index)
{
- return codeOrigins()[index];
+ return codeOrigins()[index.bits()];
}
bool addFrequentExitSite(const DFG::FrequentExitSite& site)
Modified: trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h (188931 => 188932)
--- trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h 2015-08-25 19:40:46 UTC (rev 188932)
@@ -96,6 +96,7 @@
, seen(false)
, resetByGC(false)
, tookSlowPath(false)
+ , callSiteIndex(UINT_MAX)
{
}
@@ -189,6 +190,7 @@
bool tookSlowPath : 1;
CodeOrigin codeOrigin;
+ CallSiteIndex callSiteIndex;
struct {
unsigned spillMode : 8;
Modified: trunk/Source/_javascript_Core/dfg/DFGCommonData.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/dfg/DFGCommonData.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/dfg/DFGCommonData.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -47,14 +47,14 @@
node->transition()->next);
}
-unsigned CommonData::addCodeOrigin(CodeOrigin codeOrigin)
+CallSiteIndex CommonData::addCodeOrigin(CodeOrigin codeOrigin)
{
if (codeOrigins.isEmpty()
|| codeOrigins.last() != codeOrigin)
codeOrigins.append(codeOrigin);
unsigned index = codeOrigins.size() - 1;
ASSERT(codeOrigins[index] == codeOrigin);
- return index;
+ return CallSiteIndex(index);
}
void CommonData::shrinkToFit()
Modified: trunk/Source/_javascript_Core/dfg/DFGCommonData.h (188931 => 188932)
--- trunk/Source/_javascript_Core/dfg/DFGCommonData.h 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/dfg/DFGCommonData.h 2015-08-25 19:40:46 UTC (rev 188932)
@@ -79,7 +79,7 @@
{ }
void notifyCompilingStructureTransition(Plan&, CodeBlock*, Node*);
- unsigned addCodeOrigin(CodeOrigin);
+ CallSiteIndex addCodeOrigin(CodeOrigin);
void shrinkToFit();
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h (188931 => 188932)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h 2015-08-25 19:40:46 UTC (rev 188932)
@@ -150,11 +150,15 @@
m_disassembler->setEndOfCode(labelIgnoringWatchpoints());
}
+ CallSiteIndex addCallSite(CodeOrigin codeOrigin)
+ {
+ return m_jitCode->common.addCodeOrigin(codeOrigin);
+ }
+
void emitStoreCodeOrigin(CodeOrigin codeOrigin)
{
- unsigned index = m_jitCode->common.addCodeOrigin(codeOrigin);
- unsigned locationBits = CallFrame::Location::encodeAsCodeOriginIndex(index);
- store32(TrustedImm32(locationBits), tagFor(static_cast<VirtualRegister>(JSStack::ArgumentCount)));
+ CallSiteIndex callSite = addCallSite(codeOrigin);
+ store32(TrustedImm32(callSite.bits()), tagFor(static_cast<VirtualRegister>(JSStack::ArgumentCount)));
}
// Add a call out from JIT code, without an exception check.
Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -201,14 +201,14 @@
jit.store32(AssemblyHelpers::TrustedImm32(inlineCallFrame->arguments.size()), AssemblyHelpers::payloadFor((VirtualRegister)(inlineCallFrame->stackOffset + JSStack::ArgumentCount)));
#if USE(JSVALUE64)
jit.store64(callerFrameGPR, AssemblyHelpers::addressForByteOffset(inlineCallFrame->callerFrameOffset()));
- uint32_t locationBits = CallFrame::Location::encodeAsBytecodeOffset(codeOrigin.bytecodeIndex);
+ uint32_t locationBits = CallSiteIndex(codeOrigin.bytecodeIndex).bits();
jit.store32(AssemblyHelpers::TrustedImm32(locationBits), AssemblyHelpers::tagFor((VirtualRegister)(inlineCallFrame->stackOffset + JSStack::ArgumentCount)));
if (!inlineCallFrame->isClosureCall)
jit.store64(AssemblyHelpers::TrustedImm64(JSValue::encode(JSValue(inlineCallFrame->calleeConstant()))), AssemblyHelpers::addressFor((VirtualRegister)(inlineCallFrame->stackOffset + JSStack::Callee)));
#else // USE(JSVALUE64) // so this is the 32-bit part
jit.storePtr(callerFrameGPR, AssemblyHelpers::addressForByteOffset(inlineCallFrame->callerFrameOffset()));
Instruction* instruction = baselineCodeBlock->instructions().begin() + codeOrigin.bytecodeIndex;
- uint32_t locationBits = CallFrame::Location::encodeAsBytecodeInstruction(instruction);
+ uint32_t locationBits = CallSiteIndex(instruction).bits();
jit.store32(AssemblyHelpers::TrustedImm32(locationBits), AssemblyHelpers::tagFor((VirtualRegister)(inlineCallFrame->stackOffset + JSStack::ArgumentCount)));
jit.store32(AssemblyHelpers::TrustedImm32(JSValue::CellTag), AssemblyHelpers::tagFor((VirtualRegister)(inlineCallFrame->stackOffset + JSStack::Callee)));
if (!inlineCallFrame->isClosureCall)
@@ -217,10 +217,10 @@
}
#if USE(JSVALUE64)
- uint32_t locationBits = CallFrame::Location::encodeAsBytecodeOffset(codeOrigin.bytecodeIndex);
+ uint32_t locationBits = CallSiteIndex(codeOrigin.bytecodeIndex).bits();
#else
Instruction* instruction = jit.baselineCodeBlock()->instructions().begin() + codeOrigin.bytecodeIndex;
- uint32_t locationBits = CallFrame::Location::encodeAsBytecodeInstruction(instruction);
+ uint32_t locationBits = CallSiteIndex(instruction).bits();
#endif
jit.store32(AssemblyHelpers::TrustedImm32(locationBits), AssemblyHelpers::tagFor((VirtualRegister)(JSStack::ArgumentCount)));
}
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -964,6 +964,7 @@
JSValueRegs::payloadOnly(resultGPR), stubInfo, baseGPR,
static_cast<const AtomicStringImpl*>(string->tryGetValueImpl()));
+ stubInfo->callSiteIndex = m_jit.addCallSite(node->origin.semantic);
stubInfo->codeOrigin = node->origin.semantic;
stubInfo->patch.baseGPR = static_cast<int8_t>(baseGPR);
stubInfo->patch.valueGPR = static_cast<int8_t>(resultGPR);
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -183,7 +183,7 @@
}
JITGetByIdGenerator gen(
- m_jit.codeBlock(), codeOrigin, usedRegisters(),
+ m_jit.codeBlock(), codeOrigin, m_jit.addCallSite(codeOrigin), usedRegisters(),
JSValueRegs(baseTagGPROrNone, basePayloadGPR),
JSValueRegs(resultTagGPR, resultPayloadGPR), spillMode);
@@ -215,7 +215,7 @@
void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg basePayloadGPR, GPRReg valueTagGPR, GPRReg valuePayloadGPR, GPRReg scratchGPR, unsigned identifierNumber, PutKind putKind, JITCompiler::Jump slowPathTarget, SpillRegistersMode spillMode)
{
JITPutByIdGenerator gen(
- m_jit.codeBlock(), codeOrigin, usedRegisters(),
+ m_jit.codeBlock(), codeOrigin, m_jit.addCallSite(codeOrigin), usedRegisters(),
JSValueRegs::payloadOnly(basePayloadGPR), JSValueRegs(valueTagGPR, valuePayloadGPR),
scratchGPR, spillMode, m_jit.ecmaModeFor(codeOrigin), putKind);
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -154,7 +154,7 @@
void SpeculativeJIT::cachedGetById(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg resultGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget, SpillRegistersMode spillMode)
{
JITGetByIdGenerator gen(
- m_jit.codeBlock(), codeOrigin, usedRegisters(), JSValueRegs(baseGPR),
+ m_jit.codeBlock(), codeOrigin, m_jit.addCallSite(codeOrigin), usedRegisters(), JSValueRegs(baseGPR),
JSValueRegs(resultGPR), spillMode);
gen.generateFastPath(m_jit);
@@ -174,7 +174,7 @@
void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg valueGPR, GPRReg scratchGPR, unsigned identifierNumber, PutKind putKind, JITCompiler::Jump slowPathTarget, SpillRegistersMode spillMode)
{
JITPutByIdGenerator gen(
- m_jit.codeBlock(), codeOrigin, usedRegisters(), JSValueRegs(baseGPR),
+ m_jit.codeBlock(), codeOrigin, m_jit.addCallSite(codeOrigin), usedRegisters(), JSValueRegs(baseGPR),
JSValueRegs(valueGPR), scratchGPR, spillMode, m_jit.ecmaModeFor(codeOrigin), putKind);
gen.generateFastPath(m_jit);
Modified: trunk/Source/_javascript_Core/ftl/FTLCompile.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/ftl/FTLCompile.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/ftl/FTLCompile.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -456,6 +456,7 @@
continue;
}
+ CodeOrigin codeOrigin = state.jitCode->common.codeOrigins[getById.callSiteIndex().bits()];
for (unsigned i = 0; i < iter->value.size(); ++i) {
StackMaps::Record& record = iter->value[i];
@@ -465,13 +466,13 @@
GPRReg base = record.locations[1].directGPR();
JITGetByIdGenerator gen(
- codeBlock, getById.codeOrigin(), usedRegisters, JSValueRegs(base),
+ codeBlock, codeOrigin, getById.callSiteIndex(), usedRegisters, JSValueRegs(base),
JSValueRegs(result), NeedToSpill);
MacroAssembler::Label begin = slowPathJIT.label();
MacroAssembler::Call call = callOperation(
- state, usedRegisters, slowPathJIT, getById.codeOrigin(), &exceptionTarget,
+ state, usedRegisters, slowPathJIT, codeOrigin, &exceptionTarget,
operationGetByIdOptimize, result, gen.stubInfo(), base, getById.uid());
gen.reportSlowPathCall(begin, call);
@@ -493,6 +494,7 @@
continue;
}
+ CodeOrigin codeOrigin = state.jitCode->common.codeOrigins[putById.callSiteIndex().bits()];
for (unsigned i = 0; i < iter->value.size(); ++i) {
StackMaps::Record& record = iter->value[i];
@@ -502,14 +504,14 @@
GPRReg value = record.locations[1].directGPR();
JITPutByIdGenerator gen(
- codeBlock, putById.codeOrigin(), usedRegisters, JSValueRegs(base),
+ codeBlock, codeOrigin, putById.callSiteIndex(), usedRegisters, JSValueRegs(base),
JSValueRegs(value), GPRInfo::patchpointScratchRegister, NeedToSpill,
putById.ecmaMode(), putById.putKind());
MacroAssembler::Label begin = slowPathJIT.label();
MacroAssembler::Call call = callOperation(
- state, usedRegisters, slowPathJIT, putById.codeOrigin(), &exceptionTarget,
+ state, usedRegisters, slowPathJIT, codeOrigin, &exceptionTarget,
gen.slowPathFunction(), gen.stubInfo(), value, base, putById.uid());
gen.reportSlowPathCall(begin, call);
@@ -531,13 +533,15 @@
continue;
}
+ CodeOrigin codeOrigin = state.jitCode->common.codeOrigins[checkIn.callSiteIndex().bits()];
for (unsigned i = 0; i < iter->value.size(); ++i) {
StackMaps::Record& record = iter->value[i];
RegisterSet usedRegisters = usedRegistersFor(record);
GPRReg result = record.locations[0].directGPR();
GPRReg obj = record.locations[1].directGPR();
StructureStubInfo* stubInfo = codeBlock->addStubInfo();
- stubInfo->codeOrigin = checkIn.codeOrigin();
+ stubInfo->codeOrigin = codeOrigin;
+ stubInfo->callSiteIndex = checkIn.callSiteIndex();
stubInfo->patch.baseGPR = static_cast<int8_t>(obj);
stubInfo->patch.valueGPR = static_cast<int8_t>(result);
stubInfo->patch.usedRegisters = usedRegisters;
@@ -546,7 +550,7 @@
MacroAssembler::Label begin = slowPathJIT.label();
MacroAssembler::Call slowCall = callOperation(
- state, usedRegisters, slowPathJIT, checkIn.codeOrigin(), &exceptionTarget,
+ state, usedRegisters, slowPathJIT, codeOrigin, &exceptionTarget,
operationInOptimize, result, stubInfo, obj, checkIn.m_uid);
checkIn.m_slowPathDone.append(slowPathJIT.jump());
Modified: trunk/Source/_javascript_Core/ftl/FTLInlineCacheDescriptor.h (188931 => 188932)
--- trunk/Source/_javascript_Core/ftl/FTLInlineCacheDescriptor.h 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/ftl/FTLInlineCacheDescriptor.h 2015-08-25 19:40:46 UTC (rev 188932)
@@ -37,22 +37,24 @@
class InlineCacheDescriptor {
public:
- InlineCacheDescriptor() { }
+ InlineCacheDescriptor()
+ : m_callSiteIndex(UINT_MAX)
+ { }
- InlineCacheDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, UniquedStringImpl* uid)
+ InlineCacheDescriptor(unsigned stackmapID, CallSiteIndex callSite, UniquedStringImpl* uid)
: m_stackmapID(stackmapID)
- , m_codeOrigin(codeOrigin)
+ , m_callSiteIndex(callSite)
, m_uid(uid)
{
}
unsigned stackmapID() const { return m_stackmapID; }
- CodeOrigin codeOrigin() const { return m_codeOrigin; }
+ CallSiteIndex callSiteIndex() const { return m_callSiteIndex; }
UniquedStringImpl* uid() const { return m_uid; }
private:
unsigned m_stackmapID;
- CodeOrigin m_codeOrigin;
+ CallSiteIndex m_callSiteIndex;
UniquedStringImpl* m_uid;
public:
@@ -63,8 +65,8 @@
public:
GetByIdDescriptor() { }
- GetByIdDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, UniquedStringImpl* uid)
- : InlineCacheDescriptor(stackmapID, codeOrigin, uid)
+ GetByIdDescriptor(unsigned stackmapID, CallSiteIndex callSite, UniquedStringImpl* uid)
+ : InlineCacheDescriptor(stackmapID, callSite, uid)
{
}
@@ -76,9 +78,9 @@
PutByIdDescriptor() { }
PutByIdDescriptor(
- unsigned stackmapID, CodeOrigin codeOrigin, UniquedStringImpl* uid,
+ unsigned stackmapID, CallSiteIndex callSite, UniquedStringImpl* uid,
ECMAMode ecmaMode, PutKind putKind)
- : InlineCacheDescriptor(stackmapID, codeOrigin, uid)
+ : InlineCacheDescriptor(stackmapID, callSite, uid)
, m_ecmaMode(ecmaMode)
, m_putKind(putKind)
{
@@ -111,8 +113,8 @@
public:
CheckInDescriptor() { }
- CheckInDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const UniquedStringImpl* uid)
- : InlineCacheDescriptor(stackmapID, codeOrigin, nullptr)
+ CheckInDescriptor(unsigned stackmapID, CallSiteIndex callSite, const UniquedStringImpl* uid)
+ : InlineCacheDescriptor(stackmapID, callSite, nullptr)
, m_uid(uid)
{
}
Modified: trunk/Source/_javascript_Core/ftl/FTLLink.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/ftl/FTLLink.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/ftl/FTLLink.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -153,7 +153,7 @@
jit.emitFunctionPrologue();
jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
jit.store32(
- CCallHelpers::TrustedImm32(CallFrame::Location::encodeAsBytecodeOffset(0)),
+ CCallHelpers::TrustedImm32(CallSiteIndex(0).bits()),
CCallHelpers::tagFor(JSStack::ArgumentCount));
jit.storePtr(GPRInfo::callFrameRegister, &vm.topCallFrame);
CCallHelpers::Call callArityCheck = jit.call();
Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -2220,7 +2220,7 @@
setInstructionCallingConvention(call, LLVMAnyRegCallConv);
m_ftlState.putByIds.append(PutByIdDescriptor(
- stackmapID, m_node->origin.semantic, uid,
+ stackmapID, m_ftlState.jitCode->common.addCodeOrigin(m_node->origin.semantic), uid,
m_graph.executableFor(m_node->origin.semantic)->ecmaMode(),
m_node->op() == PutByIdDirect ? Direct : NotDirect));
}
@@ -4957,7 +4957,7 @@
setInstructionCallingConvention(call, LLVMAnyRegCallConv);
- m_ftlState.checkIns.append(CheckInDescriptor(stackmapID, m_node->origin.semantic, str));
+ m_ftlState.checkIns.append(CheckInDescriptor(stackmapID, m_ftlState.jitCode->common.addCodeOrigin(m_node->origin.semantic), str));
setJSValue(call);
return;
}
@@ -5800,7 +5800,7 @@
constNull(m_out.ref8), m_out.constInt32(1), base);
setInstructionCallingConvention(call, LLVMAnyRegCallConv);
- m_ftlState.getByIds.append(GetByIdDescriptor(stackmapID, m_node->origin.semantic, uid));
+ m_ftlState.getByIds.append(GetByIdDescriptor(stackmapID, m_ftlState.jitCode->common.addCodeOrigin(m_node->origin.semantic), uid));
return call;
}
@@ -8056,8 +8056,7 @@
{
m_out.store32(
m_out.constInt32(
- CallFrame::Location::encodeAsCodeOriginIndex(
- m_ftlState.jitCode->common.addCodeOrigin(codeOrigin))),
+ m_ftlState.jitCode->common.addCodeOrigin(codeOrigin).bits()),
tagFor(JSStack::ArgumentCount));
}
void callPreflight()
Modified: trunk/Source/_javascript_Core/ftl/FTLSlowPathCall.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/ftl/FTLSlowPathCall.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/ftl/FTLSlowPathCall.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -166,8 +166,8 @@
if (!codeOrigin.isSet())
return;
- unsigned index = state.jitCode->common.addCodeOrigin(codeOrigin);
- unsigned locationBits = CallFrame::Location::encodeAsCodeOriginIndex(index);
+ CallSiteIndex callSite = state.jitCode->common.addCodeOrigin(codeOrigin);
+ unsigned locationBits = callSite.bits();
jit.store32(
CCallHelpers::TrustedImm32(locationBits),
CCallHelpers::tagFor(static_cast<VirtualRegister>(JSStack::ArgumentCount)));
Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/interpreter/CallFrame.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -46,63 +46,63 @@
#endif
#if USE(JSVALUE32_64)
-unsigned CallFrame::locationAsBytecodeOffset() const
+Instruction* CallFrame::currentVPC() const
{
- ASSERT(codeBlock());
- ASSERT(hasLocationAsBytecodeOffset());
- return currentVPC() - codeBlock()->instructions().begin();
+ return bitwise_cast<Instruction*>(callSiteIndex().bits());
}
-void CallFrame::setLocationAsBytecodeOffset(unsigned offset)
+void CallFrame::setCurrentVPC(Instruction* vpc)
{
+ CallSiteIndex callSite(vpc);
+ this[JSStack::ArgumentCount].tag() = callSite.bits();
+}
+
+unsigned CallFrame::callSiteBitsAsBytecodeOffset() const
+{
ASSERT(codeBlock());
- setCurrentVPC(codeBlock()->instructions().begin() + offset);
- ASSERT(hasLocationAsBytecodeOffset());
+ ASSERT(callSiteBitsAreBytecodeOffset());
+ return currentVPC() - codeBlock()->instructions().begin();
}
-#else
+
+#else // USE(JSVALUE32_64)
Instruction* CallFrame::currentVPC() const
{
- return codeBlock()->instructions().begin() + locationAsBytecodeOffset();
+ ASSERT(callSiteBitsAreBytecodeOffset());
+ return codeBlock()->instructions().begin() + callSiteBitsAsBytecodeOffset();
}
+
void CallFrame::setCurrentVPC(Instruction* vpc)
{
- setLocationAsBytecodeOffset(vpc - codeBlock()->instructions().begin());
+ CallSiteIndex callSite(vpc - codeBlock()->instructions().begin());
+ this[JSStack::ArgumentCount].tag() = static_cast<int32_t>(callSite.bits());
}
-#endif
-
-#if ENABLE(DFG_JIT)
-unsigned CallFrame::bytecodeOffsetFromCodeOriginIndex()
+
+unsigned CallFrame::callSiteBitsAsBytecodeOffset() const
{
- ASSERT(hasLocationAsCodeOriginIndex());
- CodeBlock* codeBlock = this->codeBlock();
- ASSERT(codeBlock);
-
- CodeOrigin codeOrigin;
- unsigned index = locationAsCodeOriginIndex();
- ASSERT(codeBlock->canGetCodeOrigin(index));
- codeOrigin = codeBlock->codeOrigin(index);
-
- for (InlineCallFrame* inlineCallFrame = codeOrigin.inlineCallFrame; inlineCallFrame;) {
- if (inlineCallFrame->baselineCodeBlock() == codeBlock)
- return codeOrigin.bytecodeIndex;
-
- codeOrigin = inlineCallFrame->caller;
- inlineCallFrame = codeOrigin.inlineCallFrame;
- }
- return codeOrigin.bytecodeIndex;
+ ASSERT(codeBlock());
+ ASSERT(callSiteBitsAreBytecodeOffset());
+ return callSiteIndex().bits();
}
-#endif // ENABLE(DFG_JIT)
-
+#endif
+
unsigned CallFrame::bytecodeOffset()
{
if (!codeBlock())
return 0;
#if ENABLE(DFG_JIT)
- if (hasLocationAsCodeOriginIndex())
- return bytecodeOffsetFromCodeOriginIndex();
+ if (callSiteBitsAreCodeOriginIndex()) {
+ ASSERT(codeBlock());
+ CodeOrigin codeOrigin = this->codeOrigin();
+ for (InlineCallFrame* inlineCallFrame = codeOrigin.inlineCallFrame; inlineCallFrame;) {
+ codeOrigin = inlineCallFrame->caller;
+ inlineCallFrame = codeOrigin.inlineCallFrame;
+ }
+ return codeOrigin.bytecodeIndex;
+ }
#endif
- return locationAsBytecodeOffset();
+ ASSERT(callSiteBitsAreBytecodeOffset());
+ return callSiteBitsAsBytecodeOffset();
}
CodeOrigin CallFrame::codeOrigin()
@@ -110,13 +110,13 @@
if (!codeBlock())
return CodeOrigin(0);
#if ENABLE(DFG_JIT)
- if (hasLocationAsCodeOriginIndex()) {
- unsigned index = locationAsCodeOriginIndex();
+ if (callSiteBitsAreCodeOriginIndex()) {
+ CallSiteIndex index = callSiteIndex();
ASSERT(codeBlock()->canGetCodeOrigin(index));
return codeBlock()->codeOrigin(index);
}
#endif
- return CodeOrigin(locationAsBytecodeOffset());
+ return CodeOrigin(callSiteBitsAsBytecodeOffset());
}
Register* CallFrame::topOfFrameInternal()
Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.h (188931 => 188932)
--- trunk/Source/_javascript_Core/interpreter/CallFrame.h 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.h 2015-08-25 19:40:46 UTC (rev 188932)
@@ -38,6 +38,21 @@
class Interpreter;
class JSScope;
+ struct CallSiteIndex {
+ explicit CallSiteIndex(uint32_t bits)
+ : m_bits(bits)
+ { }
+#if USE(JSVALUE32_64)
+ explicit CallSiteIndex(Instruction* instruction)
+ : m_bits(bitwise_cast<uint32_t>(instruction))
+ { }
+#endif
+ inline uint32_t bits() const { return m_bits; }
+
+ private:
+ uint32_t m_bits;
+ };
+
// Represents the current state of script execution.
// Passed as the first argument to most functions.
class ExecState : private Register {
@@ -107,51 +122,15 @@
static ptrdiff_t returnPCOffset() { return OBJECT_OFFSETOF(CallerFrameAndPC, pc); }
AbstractPC abstractReturnPC(VM& vm) { return AbstractPC(vm, this); }
- class Location {
- public:
- static inline uint32_t decode(uint32_t bits);
+ bool callSiteBitsAreBytecodeOffset() const;
+ bool callSiteBitsAreCodeOriginIndex() const;
- static inline bool isBytecodeLocation(uint32_t bits);
-#if USE(JSVALUE64)
- static inline uint32_t encodeAsBytecodeOffset(uint32_t bits);
-#else
- static inline uint32_t encodeAsBytecodeInstruction(Instruction*);
-#endif
+ unsigned callSiteAsRawBits() const;
+ CallSiteIndex callSiteIndex() const;
+ private:
+ unsigned callSiteBitsAsBytecodeOffset() const;
+ public:
- static inline bool isCodeOriginIndex(uint32_t bits);
- static inline uint32_t encodeAsCodeOriginIndex(uint32_t bits);
-
- private:
- enum TypeTag {
- BytecodeLocationTag = 0,
- CodeOriginIndexTag = 1,
- };
-
- static inline uint32_t encode(TypeTag, uint32_t bits);
-
- static const uint32_t s_mask = 0x1;
-#if USE(JSVALUE64)
- static const uint32_t s_shift = 31;
- static const uint32_t s_shiftedMask = s_mask << s_shift;
-#else
- static const uint32_t s_shift = 1;
-#endif
- };
-
- bool hasLocationAsBytecodeOffset() const;
- bool hasLocationAsCodeOriginIndex() const;
-
- unsigned locationAsRawBits() const;
- unsigned locationAsBytecodeOffset() const;
- unsigned locationAsCodeOriginIndex() const;
-
- void setLocationAsRawBits(unsigned);
- void setLocationAsBytecodeOffset(unsigned);
-
-#if ENABLE(DFG_JIT)
- unsigned bytecodeOffsetFromCodeOriginIndex();
-#endif
-
// This will try to get you the bytecode offset, but you should be aware that
// this bytecode offset may be bogus in the presence of inlining. This will
// also return 0 if the call frame has no notion of bytecode offsets (for
@@ -170,19 +149,8 @@
return topOfFrameInternal();
}
-#if USE(JSVALUE32_64)
- Instruction* currentVPC() const
- {
- return bitwise_cast<Instruction*>(this[JSStack::ArgumentCount].tag());
- }
- void setCurrentVPC(Instruction* vpc)
- {
- this[JSStack::ArgumentCount].tag() = bitwise_cast<int32_t>(vpc);
- }
-#else
- Instruction* currentVPC() const;
+ Instruction* currentVPC() const; // This only makes sense in the LLInt and baseline.
void setCurrentVPC(Instruction* vpc);
-#endif
void setCallerFrame(CallFrame* frame) { callerFrameAndPC().callerFrame = frame; }
void setScope(int scopeRegisterOffset, JSScope* scope) { static_cast<Register*>(this)[scopeRegisterOffset] = scope; }
Modified: trunk/Source/_javascript_Core/interpreter/CallFrameInlines.h (188931 => 188932)
--- trunk/Source/_javascript_Core/interpreter/CallFrameInlines.h 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/interpreter/CallFrameInlines.h 2015-08-25 19:40:46 UTC (rev 188932)
@@ -31,114 +31,54 @@
namespace JSC {
-inline uint32_t CallFrame::Location::encode(CallFrame::Location::TypeTag tag, uint32_t bits)
+inline bool CallFrame::callSiteBitsAreBytecodeOffset() const
{
-#if USE(JSVALUE64)
- ASSERT(!(bits & s_shiftedMask));
- ASSERT(!(tag & ~s_mask));
- return bits | (tag << s_shift);
-#else
- ASSERT(!(tag & ~s_mask));
- if (tag & CodeOriginIndexTag)
- bits = (bits << s_shift);
- ASSERT(!(bits & s_mask));
- bits |= tag;
- return bits;
-#endif
-}
+ ASSERT(codeBlock());
+ switch (codeBlock()->jitType()) {
+ case JITCode::InterpreterThunk:
+ case JITCode::BaselineJIT:
+ return true;
+ case JITCode::None:
+ case JITCode::HostCallThunk:
+ RELEASE_ASSERT_NOT_REACHED();
+ return false;
+ default:
+ return false;
+ }
-inline uint32_t CallFrame::Location::decode(uint32_t bits)
-{
-#if USE(JSVALUE64)
- return bits & ~s_shiftedMask;
-#else
- if (isCodeOriginIndex(bits))
- return bits >> s_shift;
- return bits & ~s_mask;
-#endif
+ RELEASE_ASSERT_NOT_REACHED();
+ return false;
}
-#if USE(JSVALUE64)
-inline uint32_t CallFrame::Location::encodeAsBytecodeOffset(uint32_t bits)
+inline bool CallFrame::callSiteBitsAreCodeOriginIndex() const
{
- uint32_t encodedBits = encode(BytecodeLocationTag, bits);
- ASSERT(isBytecodeLocation(encodedBits));
- return encodedBits;
-}
-#else
-inline uint32_t CallFrame::Location::encodeAsBytecodeInstruction(Instruction* instruction)
-{
- uint32_t encodedBits = encode(BytecodeLocationTag, reinterpret_cast<uint32_t>(instruction));
- ASSERT(isBytecodeLocation(encodedBits));
- return encodedBits;
-}
-#endif
+ ASSERT(codeBlock());
+ switch (codeBlock()->jitType()) {
+ case JITCode::DFGJIT:
+ case JITCode::FTLJIT:
+ return true;
+ case JITCode::None:
+ case JITCode::HostCallThunk:
+ RELEASE_ASSERT_NOT_REACHED();
+ return false;
+ default:
+ return false;
+ }
-inline uint32_t CallFrame::Location::encodeAsCodeOriginIndex(uint32_t bits)
-{
- uint32_t encodedBits = encode(CodeOriginIndexTag, bits);
- ASSERT(isCodeOriginIndex(encodedBits));
- return encodedBits;
+ RELEASE_ASSERT_NOT_REACHED();
+ return false;
}
-inline bool CallFrame::Location::isBytecodeLocation(uint32_t bits)
+inline unsigned CallFrame::callSiteAsRawBits() const
{
- return !isCodeOriginIndex(bits);
-}
-
-inline bool CallFrame::Location::isCodeOriginIndex(uint32_t bits)
-{
-#if USE(JSVALUE64)
- TypeTag tag = static_cast<TypeTag>(bits >> s_shift);
- return !!(tag & CodeOriginIndexTag);
-#else
- return !!(bits & CodeOriginIndexTag);
-#endif
-}
-
-inline bool CallFrame::hasLocationAsBytecodeOffset() const
-{
- return Location::isBytecodeLocation(locationAsRawBits());
-}
-
-inline bool CallFrame::hasLocationAsCodeOriginIndex() const
-{
- return Location::isCodeOriginIndex(locationAsRawBits());
-}
-
-inline unsigned CallFrame::locationAsRawBits() const
-{
return this[JSStack::ArgumentCount].tag();
}
-inline void CallFrame::setLocationAsRawBits(unsigned bits)
+inline CallSiteIndex CallFrame::callSiteIndex() const
{
- this[JSStack::ArgumentCount].tag() = static_cast<int32_t>(bits);
+ return CallSiteIndex(callSiteAsRawBits());
}
-#if USE(JSVALUE64)
-inline unsigned CallFrame::locationAsBytecodeOffset() const
-{
- ASSERT(hasLocationAsBytecodeOffset());
- ASSERT(codeBlock());
- return Location::decode(locationAsRawBits());
-}
-
-inline void CallFrame::setLocationAsBytecodeOffset(unsigned offset)
-{
- ASSERT(codeBlock());
- setLocationAsRawBits(Location::encodeAsBytecodeOffset(offset));
- ASSERT(hasLocationAsBytecodeOffset());
-}
-#endif // USE(JSVALUE64)
-
-inline unsigned CallFrame::locationAsCodeOriginIndex() const
-{
- ASSERT(hasLocationAsCodeOriginIndex());
- ASSERT(codeBlock());
- return Location::decode(locationAsRawBits());
-}
-
inline bool CallFrame::hasActivation() const
{
JSValue activation = uncheckedActivation();
Modified: trunk/Source/_javascript_Core/interpreter/StackVisitor.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/interpreter/StackVisitor.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/interpreter/StackVisitor.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -95,7 +95,7 @@
return;
}
- unsigned index = callFrame->locationAsCodeOriginIndex();
+ CallSiteIndex index = callFrame->callSiteIndex();
ASSERT(codeBlock->canGetCodeOrigin(index));
if (!codeBlock->canGetCodeOrigin(index)) {
// See assertion above. In release builds, we try to protect ourselves
@@ -125,7 +125,7 @@
m_frame.m_codeBlock = callFrame->codeBlock();
m_frame.m_bytecodeOffset = !m_frame.codeBlock() ? 0
: codeOrigin ? codeOrigin->bytecodeIndex
- : callFrame->locationAsBytecodeOffset();
+ : callFrame->bytecodeOffset();
#if ENABLE(DFG_JIT)
m_frame.m_inlineCallFrame = 0;
#endif
@@ -376,7 +376,7 @@
logF(indent, "callee: %p\n", callee());
logF(indent, "returnPC: %p\n", returnPC);
logF(indent, "callerFrame: %p\n", callerFrame);
- unsigned locationRawBits = callFrame->locationAsRawBits();
+ unsigned locationRawBits = callFrame->callSiteAsRawBits();
logF(indent, "rawLocationBits: %u 0x%x\n", locationRawBits, locationRawBits);
logF(indent, "codeBlock: %p ", codeBlock);
if (codeBlock)
@@ -385,15 +385,15 @@
if (codeBlock && !isInlined) {
indent++;
- if (callFrame->hasLocationAsBytecodeOffset()) {
- unsigned bytecodeOffset = callFrame->locationAsBytecodeOffset();
+ if (callFrame->callSiteBitsAreBytecodeOffset()) {
+ unsigned bytecodeOffset = callFrame->bytecodeOffset();
log(indent, "bytecodeOffset: ", bytecodeOffset, " of ", codeBlock->instructions().size(), "\n");
#if ENABLE(DFG_JIT)
} else {
log(indent, "hasCodeOrigins: ", codeBlock->hasCodeOrigins(), "\n");
if (codeBlock->hasCodeOrigins()) {
- unsigned codeOriginIndex = callFrame->locationAsCodeOriginIndex();
- log(indent, "codeOriginIndex: ", codeOriginIndex, " of ", codeBlock->codeOrigins().size(), "\n");
+ CallSiteIndex callSiteIndex = callFrame->callSiteIndex();
+ log(indent, "callSiteIndex: ", callSiteIndex.bits(), " of ", codeBlock->codeOrigins().size(), "\n");
JITCode::JITType jitType = codeBlock->jitType();
if (jitType != JITCode::FTLJIT) {
Modified: trunk/Source/_javascript_Core/jit/JITCall.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/jit/JITCall.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/jit/JITCall.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -168,7 +168,7 @@
} // SP holds newCallFrame + sizeof(CallerFrameAndPC), with ArgumentCount initialized.
uint32_t bytecodeOffset = instruction - m_codeBlock->instructions().begin();
- uint32_t locationBits = CallFrame::Location::encodeAsBytecodeOffset(bytecodeOffset);
+ uint32_t locationBits = CallSiteIndex(bytecodeOffset).bits();
store32(TrustedImm32(locationBits), Address(callFrameRegister, JSStack::ArgumentCount * static_cast<int>(sizeof(Register)) + TagOffset));
emitGetVirtualRegister(callee, regT0); // regT0 holds callee.
Modified: trunk/Source/_javascript_Core/jit/JITCall32_64.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/jit/JITCall32_64.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/jit/JITCall32_64.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -229,7 +229,7 @@
store32(TrustedImm32(argCount), Address(stackPointerRegister, JSStack::ArgumentCount * static_cast<int>(sizeof(Register)) + PayloadOffset - sizeof(CallerFrameAndPC)));
} // SP holds newCallFrame + sizeof(CallerFrameAndPC), with ArgumentCount initialized.
- uint32_t locationBits = CallFrame::Location::encodeAsBytecodeInstruction(instruction);
+ uint32_t locationBits = CallSiteIndex(instruction).bits();
store32(TrustedImm32(locationBits), tagFor(JSStack::ArgumentCount, callFrameRegister));
emitLoad(callee, regT1, regT0); // regT1, regT0 holds callee.
Modified: trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -40,17 +40,18 @@
return stubInfo;
}
-JITInlineCacheGenerator::JITInlineCacheGenerator(CodeBlock* codeBlock, CodeOrigin codeOrigin)
+JITInlineCacheGenerator::JITInlineCacheGenerator(CodeBlock* codeBlock, CodeOrigin codeOrigin, CallSiteIndex callSite)
: m_codeBlock(codeBlock)
{
m_stubInfo = m_codeBlock ? m_codeBlock->addStubInfo() : garbageStubInfo();
m_stubInfo->codeOrigin = codeOrigin;
+ m_stubInfo->callSiteIndex = callSite;
}
JITByIdGenerator::JITByIdGenerator(
- CodeBlock* codeBlock, CodeOrigin codeOrigin, const RegisterSet& usedRegisters,
+ CodeBlock* codeBlock, CodeOrigin codeOrigin, CallSiteIndex callSite, const RegisterSet& usedRegisters,
JSValueRegs base, JSValueRegs value, SpillRegistersMode spillMode)
- : JITInlineCacheGenerator(codeBlock, codeOrigin)
+ : JITInlineCacheGenerator(codeBlock, codeOrigin, callSite)
, m_base(base)
, m_value(value)
{
@@ -111,9 +112,9 @@
}
JITGetByIdGenerator::JITGetByIdGenerator(
- CodeBlock* codeBlock, CodeOrigin codeOrigin, const RegisterSet& usedRegisters,
+ CodeBlock* codeBlock, CodeOrigin codeOrigin, CallSiteIndex callSite, const RegisterSet& usedRegisters,
JSValueRegs base, JSValueRegs value, SpillRegistersMode spillMode)
- : JITByIdGenerator(codeBlock, codeOrigin, usedRegisters, base, value, spillMode)
+ : JITByIdGenerator(codeBlock, codeOrigin, callSite, usedRegisters, base, value, spillMode)
{
RELEASE_ASSERT(base.payloadGPR() != value.tagGPR());
}
@@ -136,10 +137,10 @@
}
JITPutByIdGenerator::JITPutByIdGenerator(
- CodeBlock* codeBlock, CodeOrigin codeOrigin, const RegisterSet& usedRegisters,
+ CodeBlock* codeBlock, CodeOrigin codeOrigin, CallSiteIndex callSite, const RegisterSet& usedRegisters,
JSValueRegs base, JSValueRegs value, GPRReg scratch, SpillRegistersMode spillMode,
ECMAMode ecmaMode, PutKind putKind)
- : JITByIdGenerator(codeBlock, codeOrigin, usedRegisters, base, value, spillMode)
+ : JITByIdGenerator(codeBlock, codeOrigin, callSite, usedRegisters, base, value, spillMode)
, m_scratch(scratch)
, m_ecmaMode(ecmaMode)
, m_putKind(putKind)
Modified: trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.h (188931 => 188932)
--- trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.h 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.h 2015-08-25 19:40:46 UTC (rev 188932)
@@ -41,7 +41,7 @@
class JITInlineCacheGenerator {
protected:
JITInlineCacheGenerator() { }
- JITInlineCacheGenerator(CodeBlock*, CodeOrigin);
+ JITInlineCacheGenerator(CodeBlock*, CodeOrigin, CallSiteIndex);
public:
StructureStubInfo* stubInfo() const { return m_stubInfo; }
@@ -56,7 +56,7 @@
JITByIdGenerator() { }
JITByIdGenerator(
- CodeBlock*, CodeOrigin, const RegisterSet&, JSValueRegs base, JSValueRegs value,
+ CodeBlock*, CodeOrigin, CallSiteIndex, const RegisterSet&, JSValueRegs base, JSValueRegs value,
SpillRegistersMode spillMode);
public:
@@ -95,7 +95,7 @@
JITGetByIdGenerator() { }
JITGetByIdGenerator(
- CodeBlock*, CodeOrigin, const RegisterSet& usedRegisters, JSValueRegs base,
+ CodeBlock*, CodeOrigin, CallSiteIndex, const RegisterSet& usedRegisters, JSValueRegs base,
JSValueRegs value, SpillRegistersMode spillMode);
void generateFastPath(MacroAssembler&);
@@ -106,7 +106,7 @@
JITPutByIdGenerator() { }
JITPutByIdGenerator(
- CodeBlock*, CodeOrigin, const RegisterSet& usedRegisters, JSValueRegs base,
+ CodeBlock*, CodeOrigin, CallSiteIndex, const RegisterSet& usedRegisters, JSValueRegs base,
JSValueRegs, GPRReg scratch, SpillRegistersMode spillMode, ECMAMode, PutKind);
void generateFastPath(MacroAssembler&);
Modified: trunk/Source/_javascript_Core/jit/JITInlines.h (188931 => 188932)
--- trunk/Source/_javascript_Core/jit/JITInlines.h 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/jit/JITInlines.h 2015-08-25 19:40:46 UTC (rev 188932)
@@ -130,9 +130,9 @@
ASSERT(static_cast<int>(m_bytecodeOffset) >= 0);
#if USE(JSVALUE32_64)
Instruction* instruction = m_codeBlock->instructions().begin() + m_bytecodeOffset + 1;
- uint32_t locationBits = CallFrame::Location::encodeAsBytecodeInstruction(instruction);
+ uint32_t locationBits = CallSiteIndex(instruction).bits();
#else
- uint32_t locationBits = CallFrame::Location::encodeAsBytecodeOffset(m_bytecodeOffset + 1);
+ uint32_t locationBits = CallSiteIndex(m_bytecodeOffset + 1).bits();
#endif
store32(TrustedImm32(locationBits), intTagFor(JSStack::ArgumentCount));
storePtr(callFrameRegister, &m_vm->topCallFrame);
Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/jit/JITOperations.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -579,7 +579,7 @@
if (baseValue.isObject() && subscript.isInt32()) {
JSObject* object = asObject(baseValue);
- ASSERT(exec->locationAsBytecodeOffset());
+ ASSERT(exec->bytecodeOffset());
ASSERT(!byValInfo->stubRoutine);
Structure* structure = object->structure(vm);
@@ -604,7 +604,7 @@
if (baseValue.isObject() && isStringOrSymbol(subscript)) {
const Identifier propertyName = subscript.toPropertyKey(exec);
if (!subscript.isString() || !parseIndex(propertyName)) {
- ASSERT(exec->locationAsBytecodeOffset());
+ ASSERT(exec->bytecodeOffset());
ASSERT(!byValInfo->stubRoutine);
if (byValInfo->seen) {
if (byValInfo->cachedId == propertyName) {
@@ -659,7 +659,7 @@
VM& vm = exec->vm();
if (subscript.isInt32()) {
- ASSERT(exec->locationAsBytecodeOffset());
+ ASSERT(exec->bytecodeOffset());
ASSERT(!byValInfo->stubRoutine);
Structure* structure = object->structure(vm);
@@ -684,7 +684,7 @@
Optional<uint32_t> index = parseIndex(propertyName);
if (!subscript.isString() || !index) {
- ASSERT(exec->locationAsBytecodeOffset());
+ ASSERT(exec->bytecodeOffset());
ASSERT(!byValInfo->stubRoutine);
if (byValInfo->seen) {
if (byValInfo->cachedId == propertyName) {
@@ -1548,7 +1548,7 @@
if (JSCell::canUseFastGetOwnProperty(structure)) {
if (RefPtr<AtomicStringImpl> existingAtomicString = asString(subscript)->toExistingAtomicString(exec)) {
if (JSValue result = baseValue.asCell()->fastGetOwnProperty(vm, structure, existingAtomicString.get())) {
- ASSERT(exec->locationAsBytecodeOffset());
+ ASSERT(exec->bytecodeOffset());
if (byValInfo->stubInfo && byValInfo->cachedId.impl() != existingAtomicString)
byValInfo->tookSlowPath = true;
return result;
@@ -1558,7 +1558,7 @@
}
if (subscript.isUInt32()) {
- ASSERT(exec->locationAsBytecodeOffset());
+ ASSERT(exec->bytecodeOffset());
byValInfo->tookSlowPath = true;
uint32_t i = subscript.asUInt32();
@@ -1587,7 +1587,7 @@
if (exec->hadException())
return jsUndefined();
- ASSERT(exec->locationAsBytecodeOffset());
+ ASSERT(exec->bytecodeOffset());
if (byValInfo->stubInfo && (!isStringOrSymbol(subscript) || byValInfo->cachedId != property))
byValInfo->tookSlowPath = true;
@@ -1604,7 +1604,7 @@
if (baseValue.isObject() && subscript.isInt32()) {
JSObject* object = asObject(baseValue);
- ASSERT(exec->locationAsBytecodeOffset());
+ ASSERT(exec->bytecodeOffset());
ASSERT(!byValInfo->stubRoutine);
if (hasOptimizableIndexing(object->structure(vm))) {
@@ -1631,7 +1631,7 @@
if (baseValue.isObject() && isStringOrSymbol(subscript)) {
const Identifier propertyName = subscript.toPropertyKey(exec);
if (!subscript.isString() || !parseIndex(propertyName)) {
- ASSERT(exec->locationAsBytecodeOffset());
+ ASSERT(exec->bytecodeOffset());
ASSERT(!byValInfo->stubRoutine);
if (byValInfo->seen) {
if (byValInfo->cachedId == propertyName) {
@@ -1706,7 +1706,7 @@
JSObject* object = asObject(baseValue);
bool didOptimize = false;
- ASSERT(exec->locationAsBytecodeOffset());
+ ASSERT(exec->bytecodeOffset());
ASSERT(!byValInfo->stubRoutine);
if (hasOptimizableIndexing(object->structure(vm))) {
@@ -1775,7 +1775,7 @@
else {
result = baseValue.get(exec, i);
if (!isJSString(baseValue)) {
- ASSERT(exec->locationAsBytecodeOffset());
+ ASSERT(exec->bytecodeOffset());
ctiPatchCallByReturnAddress(exec->codeBlock(), ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(byValInfo->stubRoutine ? operationGetByValGeneric : operationGetByValOptimize));
}
}
Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -213,7 +213,7 @@
emitIdentifierCheck(regT1, regT3, propertyName, slowCases);
JITGetByIdGenerator gen(
- m_codeBlock, CodeOrigin(m_bytecodeOffset), RegisterSet::specialRegisters(),
+ m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(m_bytecodeOffset), RegisterSet::specialRegisters(),
JSValueRegs(regT0), JSValueRegs(regT0), DontSpill);
gen.generateFastPath(*this);
@@ -446,7 +446,7 @@
emitGetVirtualRegisters(base, regT0, value, regT1);
JITPutByIdGenerator gen(
- m_codeBlock, CodeOrigin(m_bytecodeOffset), RegisterSet::specialRegisters(),
+ m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(m_bytecodeOffset), RegisterSet::specialRegisters(),
JSValueRegs(regT0), JSValueRegs(regT1), regT2, DontSpill, m_codeBlock->ecmaMode(), putKind);
gen.generateFastPath(*this);
doneCases.append(jump());
@@ -556,7 +556,7 @@
emitArrayProfilingSiteForBytecodeIndexWithCell(regT0, regT1, m_bytecodeOffset);
JITGetByIdGenerator gen(
- m_codeBlock, CodeOrigin(m_bytecodeOffset), RegisterSet::specialRegisters(),
+ m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(m_bytecodeOffset), RegisterSet::specialRegisters(),
JSValueRegs(regT0), JSValueRegs(regT0), DontSpill);
gen.generateFastPath(*this);
addSlowCase(gen.slowPathJump());
@@ -603,7 +603,7 @@
emitJumpSlowCaseIfNotJSCell(regT0, baseVReg);
JITPutByIdGenerator gen(
- m_codeBlock, CodeOrigin(m_bytecodeOffset), RegisterSet::specialRegisters(),
+ m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(m_bytecodeOffset), RegisterSet::specialRegisters(),
JSValueRegs(regT0), JSValueRegs(regT1), regT2, DontSpill, m_codeBlock->ecmaMode(),
direct ? Direct : NotDirect);
Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -256,7 +256,7 @@
emitIdentifierCheck(regT2, regT4, propertyName, slowCases);
JITGetByIdGenerator gen(
- m_codeBlock, CodeOrigin(m_bytecodeOffset), RegisterSet::specialRegisters(),
+ m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(currentInstruction), RegisterSet::specialRegisters(),
JSValueRegs::payloadOnly(regT0), JSValueRegs(regT1, regT0), DontSpill);
gen.generateFastPath(*this);
@@ -468,7 +468,7 @@
emitLoad(value, regT3, regT2);
JITPutByIdGenerator gen(
- m_codeBlock, CodeOrigin(m_bytecodeOffset), RegisterSet::specialRegisters(),
+ m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(currentInstruction), RegisterSet::specialRegisters(),
JSValueRegs::payloadOnly(regT0), JSValueRegs(regT3, regT2), regT1, DontSpill, m_codeBlock->ecmaMode(), putKind);
gen.generateFastPath(*this);
doneCases.append(jump());
@@ -561,7 +561,7 @@
emitArrayProfilingSiteForBytecodeIndexWithCell(regT0, regT2, m_bytecodeOffset);
JITGetByIdGenerator gen(
- m_codeBlock, CodeOrigin(m_bytecodeOffset), RegisterSet::specialRegisters(),
+ m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(currentInstruction), RegisterSet::specialRegisters(),
JSValueRegs::payloadOnly(regT0), JSValueRegs(regT1, regT0), DontSpill);
gen.generateFastPath(*this);
addSlowCase(gen.slowPathJump());
@@ -606,7 +606,7 @@
emitJumpSlowCaseIfNotJSCell(base, regT1);
JITPutByIdGenerator gen(
- m_codeBlock, CodeOrigin(m_bytecodeOffset), RegisterSet::specialRegisters(),
+ m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(currentInstruction), RegisterSet::specialRegisters(),
JSValueRegs::payloadOnly(regT0), JSValueRegs(regT3, regT2),
regT1, DontSpill, m_codeBlock->ecmaMode(), direct ? Direct : NotDirect);
Modified: trunk/Source/_javascript_Core/jit/Repatch.cpp (188931 => 188932)
--- trunk/Source/_javascript_Core/jit/Repatch.cpp 2015-08-25 19:16:08 UTC (rev 188931)
+++ trunk/Source/_javascript_Core/jit/Repatch.cpp 2015-08-25 19:40:46 UTC (rev 188932)
@@ -411,7 +411,7 @@
// Need to make sure that whenever this call is made in the future, we remember the
// place that we made it from. It just so happens to be the place that we are at
// right now!
- stubJit.store32(MacroAssembler::TrustedImm32(exec->locationAsRawBits()),
+ stubJit.store32(MacroAssembler::TrustedImm32(stubInfo.callSiteIndex.bits()),
CCallHelpers::tagFor(static_cast<VirtualRegister>(JSStack::ArgumentCount)));
if (kind == CallGetter || kind == CallSetter) {