Ignore:
Timestamp:
Oct 22, 2019, 5:55:38 PM (6 years ago)
Author:
[email protected]
Message:

BytecodeIndex should be a proper C++ class
https://bugs.webkit.org/show_bug.cgi?id=203276

Reviewed by Mark Lam.

This patch makes a change to how we refer to the bytecode index in
a bytecode stream. Previously we just used an unsigned number to
represent the index, this patch changes most of the code to use a
BytecodeIndex class instead. The only places where this patch does
not change this is for jump and switch targets / deltas.

Additionally, this patch attempts to canonicalize the terminology
around how we refer to bytecode indices. Now we use the word index
to refer to the bytecode index class and offset to refer to the
unsigned byte offset into the instruction stream.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Sources.txt:
  • bytecode/ByValInfo.h:

(JSC::ByValInfo::ByValInfo):
(JSC::getByValInfoBytecodeIndex):

  • bytecode/BytecodeBasicBlock.cpp:

(JSC::BytecodeBasicBlock::computeImpl):

  • bytecode/BytecodeGeneratorification.cpp:

(JSC::GeneratorLivenessAnalysis::run):

  • bytecode/BytecodeIndex.cpp: Added.

(JSC::BytecodeIndex::dump const):

  • bytecode/BytecodeIndex.h: Added.

(JSC::BytecodeIndex::BytecodeIndex):
(JSC::BytecodeIndex::offset const):
(JSC::BytecodeIndex::asBits const):
(JSC::BytecodeIndex::hash const):
(JSC::BytecodeIndex::deletedValue):
(JSC::BytecodeIndex::isHashTableDeletedValue const):
(JSC::BytecodeIndex::operator bool const):
(JSC::BytecodeIndex::operator == const):
(JSC::BytecodeIndex::operator != const):
(JSC::BytecodeIndex::operator < const):
(JSC::BytecodeIndex::operator > const):
(JSC::BytecodeIndex::operator <= const):
(JSC::BytecodeIndex::operator >= const):
(JSC::BytecodeIndex::fromBits):
(JSC::BytecodeIndexHash::hash):
(JSC::BytecodeIndexHash::equal):

  • bytecode/BytecodeLivenessAnalysis.cpp:

(JSC::BytecodeLivenessAnalysis::getLivenessInfoAtBytecodeIndex):
(JSC::BytecodeLivenessAnalysis::computeFullLiveness):
(JSC::BytecodeLivenessAnalysis::computeKills):
(JSC::BytecodeLivenessAnalysis::dumpResults):
(JSC::BytecodeLivenessAnalysis::getLivenessInfoAtBytecodeOffset): Deleted.

  • bytecode/BytecodeLivenessAnalysis.h:
  • bytecode/BytecodeLivenessAnalysisInlines.h:

(JSC::BytecodeLivenessPropagation::stepOverInstruction):
(JSC::BytecodeLivenessPropagation::computeLocalLivenessForBytecodeIndex):
(JSC::BytecodeLivenessPropagation::computeLocalLivenessForBlock):
(JSC::BytecodeLivenessPropagation::getLivenessInfoAtBytecodeIndex):
(JSC::BytecodeLivenessPropagation::computeLocalLivenessForBytecodeOffset): Deleted.
(JSC::BytecodeLivenessPropagation::getLivenessInfoAtBytecodeOffset): Deleted.

  • bytecode/BytecodeUseDef.h:

(JSC::computeUsesForBytecodeIndex):
(JSC::computeDefsForBytecodeIndex):
(JSC::computeUsesForBytecodeOffset): Deleted.
(JSC::computeDefsForBytecodeOffset): Deleted.

  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::computeFromLLInt):
(JSC::CallLinkStatus::computeFor):
(JSC::CallLinkStatus::computeExitSiteData):

  • bytecode/CallLinkStatus.h:
  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::getCallLinkInfoForBytecodeIndex):
(JSC::CodeBlock::addRareCaseProfile):
(JSC::CodeBlock::rareCaseProfileForBytecodeIndex):
(JSC::CodeBlock::rareCaseProfileCountForBytecodeIndex):
(JSC::CodeBlock::handlerForBytecodeIndex):
(JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndex):
(JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndexSlow):
(JSC::CodeBlock::lineNumberForBytecodeIndex):
(JSC::CodeBlock::columnNumberForBytecodeIndex):
(JSC::CodeBlock::expressionRangeForBytecodeIndex const):
(JSC::CodeBlock::hasOpDebugForLineAndColumn):
(JSC::CodeBlock::getArrayProfile):
(JSC::CodeBlock::tryGetValueProfileForBytecodeIndex):
(JSC::CodeBlock::valueProfilePredictionForBytecodeIndex):
(JSC::CodeBlock::valueProfileForBytecodeIndex):
(JSC::CodeBlock::validate):
(JSC::CodeBlock::arithProfileForBytecodeIndex):
(JSC::CodeBlock::couldTakeSpecialArithFastCase):
(JSC::CodeBlock::bytecodeIndexFromCallSiteIndex):
(JSC::CodeBlock::rareCaseProfileForBytecodeOffset): Deleted.
(JSC::CodeBlock::rareCaseProfileCountForBytecodeOffset): Deleted.
(JSC::CodeBlock::handlerForBytecodeOffset): Deleted.
(JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): Deleted.
(JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow): Deleted.
(JSC::CodeBlock::lineNumberForBytecodeOffset): Deleted.
(JSC::CodeBlock::columnNumberForBytecodeOffset): Deleted.
(JSC::CodeBlock::expressionRangeForBytecodeOffset const): Deleted.
(JSC::CodeBlock::tryGetValueProfileForBytecodeOffset): Deleted.
(JSC::CodeBlock::valueProfilePredictionForBytecodeOffset): Deleted.
(JSC::CodeBlock::valueProfileForBytecodeOffset): Deleted.
(JSC::CodeBlock::arithProfileForBytecodeOffset): Deleted.
(JSC::CodeBlock::couldTakeSpecialFastCase): Deleted.
(JSC::CodeBlock::bytecodeOffsetFromCallSiteIndex): Deleted.

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::likelyToTakeSlowCase):
(JSC::CodeBlock::couldTakeSlowCase):
(JSC::CodeBlock::bytecodeIndex):

  • bytecode/CodeOrigin.cpp:

(JSC::CodeOrigin::approximateHash const):
(JSC::CodeOrigin::dump const):

  • bytecode/CodeOrigin.h:

(JSC::CodeOrigin::CodeOrigin):
(JSC::CodeOrigin::isSet const):
(JSC::CodeOrigin::isHashTableDeletedValue const):
(JSC::CodeOrigin::bytecodeIndex const):
(JSC::CodeOrigin::OutOfLineCodeOrigin::OutOfLineCodeOrigin):
(JSC::CodeOrigin::buildCompositeValue):
(JSC::CodeOrigin::hash const):

  • bytecode/DFGExitProfile.cpp:

(JSC::DFG::FrequentExitSite::dump const):
(JSC::DFG::ExitProfile::exitSitesFor):

  • bytecode/DFGExitProfile.h:

(JSC::DFG::FrequentExitSite::FrequentExitSite):
(JSC::DFG::FrequentExitSite::operator== const):
(JSC::DFG::FrequentExitSite::subsumes const):
(JSC::DFG::FrequentExitSite::hash const):
(JSC::DFG::FrequentExitSite::bytecodeIndex const):
(JSC::DFG::FrequentExitSite::isHashTableDeletedValue const):
(JSC::DFG::QueryableExitProfile::hasExitSite const):
(JSC::DFG::FrequentExitSite::bytecodeOffset const): Deleted.

  • bytecode/DeferredSourceDump.cpp:

(JSC::DeferredSourceDump::DeferredSourceDump):
(JSC::DeferredSourceDump::dump):

  • bytecode/DeferredSourceDump.h:

(): Deleted.

  • bytecode/FullBytecodeLiveness.h:

(JSC::FullBytecodeLiveness::getLiveness const):
(JSC::FullBytecodeLiveness::operandIsLive const):

  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFromLLInt):
(JSC::GetByIdStatus::computeFor):
(JSC::GetByIdStatus::computeForStubInfo):

  • bytecode/GetByIdStatus.h:
  • bytecode/ICStatusUtils.cpp:

(JSC::hasBadCacheExitSite):

  • bytecode/ICStatusUtils.h:
  • bytecode/InByIdStatus.cpp:

(JSC::InByIdStatus::computeFor):

  • bytecode/InByIdStatus.h:
  • bytecode/InlineCallFrame.cpp:

(JSC::InlineCallFrame::dumpInContext const):

  • bytecode/InstanceOfStatus.cpp:

(JSC::InstanceOfStatus::computeFor):

  • bytecode/InstanceOfStatus.h:
  • bytecode/InstructionStream.h:

(JSC::InstructionStream::BaseRef::offset const):
(JSC::InstructionStream::BaseRef::index const):
(JSC::InstructionStream::at const):

  • bytecode/LazyOperandValueProfile.h:

(JSC::LazyOperandValueProfileKey::LazyOperandValueProfileKey):
(JSC::LazyOperandValueProfileKey::operator== const):
(JSC::LazyOperandValueProfileKey::hash const):
(JSC::LazyOperandValueProfileKey::bytecodeIndex const):
(JSC::LazyOperandValueProfileKey::isHashTableDeletedValue const):
(JSC::LazyOperandValueProfileKey::bytecodeOffset const): Deleted.

  • bytecode/MethodOfGettingAValueProfile.cpp:

(JSC::MethodOfGettingAValueProfile::fromLazyOperand):

  • bytecode/MethodOfGettingAValueProfile.h:
  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFromLLInt):
(JSC::PutByIdStatus::computeFor):

  • bytecode/PutByIdStatus.h:
  • bytecode/StructureStubInfo.cpp:

(JSC::StructureStubInfo::StructureStubInfo):

  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::UnlinkedCodeBlock::lineNumberForBytecodeIndex):
(JSC::UnlinkedCodeBlock::expressionRangeForBytecodeIndex const):
(JSC::UnlinkedCodeBlock::handlerForBytecodeIndex):
(JSC::UnlinkedCodeBlock::lineNumberForBytecodeOffset): Deleted.
(JSC::UnlinkedCodeBlock::expressionRangeForBytecodeOffset const): Deleted.
(JSC::UnlinkedCodeBlock::handlerForBytecodeOffset): Deleted.

  • bytecode/UnlinkedCodeBlock.h:
  • bytecode/ValueProfile.h:

(JSC::RareCaseProfile::RareCaseProfile):
(JSC::getRareCaseProfileBytecodeIndex):
(JSC::getRareCaseProfileBytecodeOffset): Deleted.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::ForInContext::finalize):

  • debugger/DebuggerCallFrame.cpp:

(JSC::DebuggerCallFrame::currentPosition):

  • dfg/DFGBasicBlock.cpp:

(JSC::DFG::BasicBlock::BasicBlock):

  • dfg/DFGBasicBlock.h:

(JSC::DFG::getBytecodeBeginForBlock):
(JSC::DFG::blockForBytecodeIndex):
(JSC::DFG::blockForBytecodeOffset): Deleted.

  • dfg/DFGBlockInsertionSet.cpp:

(JSC::DFG::BlockInsertionSet::insert):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::flushForTerminalImpl):
(JSC::DFG::ByteCodeParser::flushIfTerminal):
(JSC::DFG::ByteCodeParser::branchData):
(JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
(JSC::DFG::ByteCodeParser::getPrediction):
(JSC::DFG::ByteCodeParser::getArrayMode):
(JSC::DFG::ByteCodeParser::makeSafe):
(JSC::DFG::ByteCodeParser::makeDivSafe):
(JSC::DFG::ByteCodeParser::allocateTargetableBlock):
(JSC::DFG::ByteCodeParser::allocateUntargetableBlock):
(JSC::DFG::ByteCodeParser::makeBlockTargetable):
(JSC::DFG::ByteCodeParser::handleCall):
(JSC::DFG::ByteCodeParser::handleRecursiveTailCall):
(JSC::DFG::ByteCodeParser::inlineCall):
(JSC::DFG::ByteCodeParser::handleCallVariant):
(JSC::DFG::ByteCodeParser::handleInlining):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::linkBlock):
(JSC::DFG::ByteCodeParser::parseCodeBlock):
(JSC::DFG::ByteCodeParser::parse):

  • dfg/DFGCommonData.cpp:

(JSC::DFG::CommonData::addCodeOrigin):
(JSC::DFG::CommonData::addUniqueCallSiteIndex):
(JSC::DFG::CommonData::lastCallSite const):

  • dfg/DFGCommonData.h:

(JSC::DFG::CommonData::catchOSREntryDataForBytecodeIndex):
(JSC::DFG::CommonData::appendCatchEntrypoint):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compileImpl):
(JSC::DFG::compile):

  • dfg/DFGDriver.h:
  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::methodOfGettingAValueProfileFor):
(JSC::DFG::Graph::willCatchExceptionInMachineFrame):

  • dfg/DFGGraph.h:
  • dfg/DFGJITCode.cpp:

(JSC::DFG::JITCode::clearOSREntryBlockAndResetThresholds):

  • dfg/DFGJITCode.h:

(JSC::DFG::JITCode::appendOSREntryData):
(JSC::DFG::JITCode::osrEntryDataForBytecodeIndex):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::JITCompiler):
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::setStartOfCode):

  • dfg/DFGLiveCatchVariablePreservationPhase.cpp:

(JSC::DFG::LiveCatchVariablePreservationPhase::handleBlockForTryCatch):

  • dfg/DFGOSREntry.cpp:

(JSC::DFG::OSREntryData::dumpInContext const):
(JSC::DFG::prepareOSREntry):
(JSC::DFG::prepareCatchOSREntry):

  • dfg/DFGOSREntry.h:

(JSC::DFG::getOSREntryDataBytecodeIndex):
(JSC::DFG::prepareOSREntry):

  • dfg/DFGOSREntrypointCreationPhase.cpp:

(JSC::DFG::OSREntrypointCreationPhase::run):

  • dfg/DFGOSRExit.cpp:

(JSC::DFG::OSRExit::executeOSRExit):
(JSC::DFG::reifyInlinedCallFrames):
(JSC::DFG::adjustAndJumpToTarget):
(JSC::DFG::printOSRExit):
(JSC::DFG::OSRExit::compileExit):
(JSC::DFG::OSRExit::debugOperationPrintSpeculationFailure):

  • dfg/DFGOSRExit.h:
  • dfg/DFGOSRExitCompilerCommon.cpp:

(JSC::DFG::callerReturnPC):
(JSC::DFG::reifyInlinedCallFrames):
(JSC::DFG::adjustAndJumpToTarget):

  • dfg/DFGOSRExitCompilerCommon.h:
  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::Plan):
(JSC::DFG::Plan::compileInThreadImpl):
(JSC::DFG::Plan::cleanMustHandleValuesIfNecessary):

  • dfg/DFGPlan.h:

(JSC::DFG::Plan::osrEntryBytecodeIndex const):
(JSC::DFG::Plan::tierUpInLoopHierarchy):
(JSC::DFG::Plan::tierUpAndOSREnterBytecodes):

  • dfg/DFGSSAConversionPhase.cpp:

(JSC::DFG::SSAConversionPhase::run):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileCurrentBlock):
(JSC::DFG::SpeculativeJIT::checkArgumentTypes):
(JSC::DFG::SpeculativeJIT::compileValueAdd):
(JSC::DFG::SpeculativeJIT::compileValueSub):
(JSC::DFG::SpeculativeJIT::compileValueNegate):
(JSC::DFG::SpeculativeJIT::compileValueMul):
(JSC::DFG::SpeculativeJIT::emitSwitchCharStringJump):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGTierUpCheckInjectionPhase.cpp:

(JSC::DFG::TierUpCheckInjectionPhase::run):
(JSC::DFG::TierUpCheckInjectionPhase::buildNaturalLoopToLoopHintMap):

  • dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp:

(JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::compilationDidComplete):

  • dfg/DFGValidate.cpp:
  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • ftl/FTLForOSREntryJITCode.h:

(JSC::FTL::ForOSREntryJITCode::setBytecodeIndex):
(JSC::FTL::ForOSREntryJITCode::bytecodeIndex const):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::lower):
(JSC::FTL::DFG::LowerDFGToB3::compileValueAdd):
(JSC::FTL::DFG::LowerDFGToB3::compileValueSub):
(JSC::FTL::DFG::LowerDFGToB3::compileValueMul):
(JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub):
(JSC::FTL::DFG::LowerDFGToB3::compileValueNegate):

  • ftl/FTLOSREntry.cpp:

(JSC::FTL::prepareOSREntry):

  • ftl/FTLOSREntry.h:
  • interpreter/CallFrame.cpp:

(JSC::CallFrame::callSiteIndex const):
(JSC::CallFrame::unsafeCallSiteIndex const):
(JSC::CallFrame::setCurrentVPC):
(JSC::CallFrame::bytecodeIndex):
(JSC::CallFrame::codeOrigin):
(JSC::CallFrame::dump):
(JSC::CallFrame::bytecodeOffset): Deleted.

  • interpreter/CallFrame.h:

(JSC::CallSiteIndex::CallSiteIndex):
(JSC::CallSiteIndex::operator bool const):
(JSC::CallSiteIndex::operator== const):
(JSC::CallSiteIndex::bits const):
(JSC::CallSiteIndex::bytecodeIndex const):
(JSC::DisposableCallSiteIndex::DisposableCallSiteIndex):
(): Deleted.

  • interpreter/Interpreter.cpp:

(JSC::GetStackTraceFunctor::operator() const):
(JSC::findExceptionHandler):

  • interpreter/ShadowChicken.cpp:

(JSC::ShadowChicken::update):

  • interpreter/StackVisitor.cpp:

(JSC::StackVisitor::readNonInlinedFrame):
(JSC::StackVisitor::readInlinedFrame):
(JSC::StackVisitor::Frame::retrieveExpressionInfo const):
(JSC::StackVisitor::Frame::dump const):

  • interpreter/StackVisitor.h:

(JSC::StackVisitor::Frame::bytecodeIndex const):
(JSC::StackVisitor::Frame::bytecodeOffset const): Deleted.

  • jit/JIT.cpp:

(JSC::JIT::JIT):
(JSC::JIT::emitEnterOptimizationCheck):
(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):
(JSC::JIT::compileWithoutLinking):
(JSC::JIT::link):
(JSC::JIT::privateCompileExceptionHandlers):

  • jit/JIT.h:

(JSC::CallRecord::CallRecord):
(JSC::SlowCaseEntry::SlowCaseEntry):
(JSC::SwitchRecord::SwitchRecord):
(JSC::ByValCompilationInfo::ByValCompilationInfo):

  • jit/JITCall.cpp:

(JSC::JIT::compileCallEvalSlowCase):
(JSC::JIT::compileOpCall):

  • jit/JITCodeMap.h:

(JSC::JITCodeMap::Entry::Entry):
(JSC::JITCodeMap::Entry::bytecodeIndex const):
(JSC::JITCodeMap::append):
(JSC::JITCodeMap::find const):

  • jit/JITDisassembler.cpp:

(JSC::JITDisassembler::dumpVectorForInstructions):
(JSC::JITDisassembler::reportInstructions):

  • jit/JITDisassembler.h:
  • jit/JITInlines.h:

(JSC::JIT::emitNakedCall):
(JSC::JIT::emitNakedTailCall):
(JSC::JIT::updateTopCallFrame):
(JSC::JIT::linkAllSlowCasesForBytecodeIndex):
(JSC::JIT::addSlowCase):
(JSC::JIT::addJump):
(JSC::JIT::emitJumpSlowToHot):
(JSC::JIT::emitGetVirtualRegister):
(JSC::JIT::linkAllSlowCasesForBytecodeOffset): Deleted.

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_instanceof):
(JSC::JIT::emit_op_catch):
(JSC::JIT::emit_op_switch_imm):
(JSC::JIT::emit_op_switch_char):
(JSC::JIT::emit_op_switch_string):
(JSC::JIT::emitSlow_op_loop_hint):
(JSC::JIT::emit_op_has_indexed_property):
(JSC::JIT::emit_op_log_shadow_chicken_tail):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_instanceof):
(JSC::JIT::emit_op_catch):
(JSC::JIT::emit_op_switch_imm):
(JSC::JIT::emit_op_switch_char):
(JSC::JIT::emit_op_switch_string):
(JSC::JIT::emit_op_has_indexed_property):

  • jit/JITOperations.cpp:

(JSC::getByVal):
(JSC::tryGetByValOptimize):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitGetByValWithCachedId):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::emitPutByValWithCachedId):
(JSC::JIT::emit_op_try_get_by_id):
(JSC::JIT::emit_op_get_by_id_direct):
(JSC::JIT::emit_op_get_by_id):
(JSC::JIT::emit_op_get_by_id_with_this):
(JSC::JIT::emit_op_put_by_id):
(JSC::JIT::emit_op_in_by_id):

  • jit/JITWorklist.cpp:

(JSC::JITWorklist::Plan::Plan):
(JSC::JITWorklist::Plan::compileNow):
(JSC::JITWorklist::compileLater):
(JSC::JITWorklist::compileNow):

  • jit/JITWorklist.h:
  • jit/PCToCodeOriginMap.cpp:

(JSC::PCToCodeOriginMap::PCToCodeOriginMap):
(JSC::PCToCodeOriginMap::findPC const):

  • jit/PCToCodeOriginMap.h:

(JSC::PCToCodeOriginMapBuilder::defaultCodeOrigin):

  • jit/SlowPathCall.h:

(JSC::JITSlowPathCall::call):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::jitCompileAndSetHeuristics):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • profiler/ProfilerOrigin.cpp:

(JSC::Profiler::Origin::Origin):
(JSC::Profiler::Origin::dump const):
(JSC::Profiler::Origin::toJS const):

  • profiler/ProfilerOrigin.h:

(JSC::Profiler::Origin::Origin):
(JSC::Profiler::Origin::operator! const):
(JSC::Profiler::Origin::bytecodeIndex const):
(JSC::Profiler::Origin::hash const):
(JSC::Profiler::Origin::isHashTableDeletedValue const):

  • runtime/Error.cpp:

(JSC::getBytecodeIndex):
(JSC::getBytecodeOffset): Deleted.

  • runtime/Error.h:
  • runtime/ErrorInstance.cpp:

(JSC::appendSourceToError):
(JSC::ErrorInstance::finishCreation):

  • runtime/SamplingProfiler.cpp:

(JSC::tryGetBytecodeIndex):
(JSC::SamplingProfiler::processUnverifiedStackTraces):
(JSC::SamplingProfiler::reportTopBytecodes):

  • runtime/SamplingProfiler.h:

(JSC::SamplingProfiler::StackFrame::CodeLocation::hasBytecodeIndex const):

  • runtime/StackFrame.cpp:

(JSC::StackFrame::StackFrame):
(JSC::StackFrame::computeLineAndColumn const):

  • runtime/StackFrame.h:

(JSC::StackFrame::hasBytecodeIndex const):
(JSC::StackFrame::bytecodeIndex):
(JSC::StackFrame::hasBytecodeOffset const): Deleted.
(JSC::StackFrame::bytecodeOffset): Deleted.

  • tools/VMInspector.cpp:

(JSC::VMInspector::dumpRegisters):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r251457 r251468  
    15271527}
    15281528
    1529 CallLinkInfo* CodeBlock::getCallLinkInfoForBytecodeIndex(unsigned index)
     1529CallLinkInfo* CodeBlock::getCallLinkInfoForBytecodeIndex(BytecodeIndex index)
    15301530{
    15311531    ConcurrentJSLocker locker(m_lock);
     
    15391539}
    15401540
    1541 RareCaseProfile* CodeBlock::addRareCaseProfile(int bytecodeOffset)
     1541RareCaseProfile* CodeBlock::addRareCaseProfile(BytecodeIndex bytecodeIndex)
    15421542{
    15431543    ConcurrentJSLocker locker(m_lock);
    15441544    auto& jitData = ensureJITData(locker);
    1545     jitData.m_rareCaseProfiles.append(RareCaseProfile(bytecodeOffset));
     1545    jitData.m_rareCaseProfiles.append(RareCaseProfile(bytecodeIndex));
    15461546    return &jitData.m_rareCaseProfiles.last();
    15471547}
    15481548
    1549 RareCaseProfile* CodeBlock::rareCaseProfileForBytecodeOffset(const ConcurrentJSLocker&, int bytecodeOffset)
     1549RareCaseProfile* CodeBlock::rareCaseProfileForBytecodeIndex(const ConcurrentJSLocker&, BytecodeIndex bytecodeIndex)
    15501550{
    15511551    if (auto* jitData = m_jitData.get()) {
    1552         return tryBinarySearch<RareCaseProfile, int>(
    1553             jitData->m_rareCaseProfiles, jitData->m_rareCaseProfiles.size(), bytecodeOffset,
    1554             getRareCaseProfileBytecodeOffset);
     1552        return tryBinarySearch<RareCaseProfile, BytecodeIndex>(
     1553            jitData->m_rareCaseProfiles, jitData->m_rareCaseProfiles.size(), bytecodeIndex,
     1554            getRareCaseProfileBytecodeIndex);
    15551555    }
    15561556    return nullptr;
    15571557}
    15581558
    1559 unsigned CodeBlock::rareCaseProfileCountForBytecodeOffset(const ConcurrentJSLocker& locker, int bytecodeOffset)
    1560 {
    1561     RareCaseProfile* profile = rareCaseProfileForBytecodeOffset(locker, bytecodeOffset);
     1559unsigned CodeBlock::rareCaseProfileCountForBytecodeIndex(const ConcurrentJSLocker& locker, BytecodeIndex bytecodeIndex)
     1560{
     1561    RareCaseProfile* profile = rareCaseProfileForBytecodeIndex(locker, bytecodeIndex);
    15621562    if (profile)
    15631563        return profile->m_counter;
     
    17311731#endif
    17321732
    1733 HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset, RequiredHandler requiredHandler)
    1734 {
    1735     RELEASE_ASSERT(bytecodeOffset < instructions().size());
    1736     return handlerForIndex(bytecodeOffset, requiredHandler);
     1733HandlerInfo* CodeBlock::handlerForBytecodeIndex(BytecodeIndex bytecodeIndex, RequiredHandler requiredHandler)
     1734{
     1735    RELEASE_ASSERT(bytecodeIndex.offset() < instructions().size());
     1736    return handlerForIndex(bytecodeIndex.offset(), requiredHandler);
    17371737}
    17381738
     
    17631763
    17641764
    1765 void CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset(InstructionStream::Offset bytecodeOffset)
    1766 {
    1767     auto& instruction = instructions().at(bytecodeOffset);
     1765void CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndex(BytecodeIndex bytecodeIndex)
     1766{
     1767    auto& instruction = instructions().at(bytecodeIndex);
    17681768    OpCatch op = instruction->as<OpCatch>();
    17691769    auto& metadata = op.metadata(this);
     
    17851785    }
    17861786
    1787     ensureCatchLivenessIsComputedForBytecodeOffsetSlow(op, bytecodeOffset);
    1788 }
    1789 
    1790 void CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow(const OpCatch& op, InstructionStream::Offset bytecodeOffset)
     1787    ensureCatchLivenessIsComputedForBytecodeIndexSlow(op, bytecodeIndex);
     1788}
     1789
     1790void CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndexSlow(const OpCatch& op, BytecodeIndex bytecodeIndex)
    17911791{
    17921792    BytecodeLivenessAnalysis& bytecodeLiveness = livenessAnalysis();
     
    17971797    // into the DFG.
    17981798
    1799     auto nextOffset = instructions().at(bytecodeOffset).next().offset();
    1800     FastBitVector liveLocals = bytecodeLiveness.getLivenessInfoAtBytecodeOffset(this, nextOffset);
     1799    auto nextOffset = instructions().at(bytecodeIndex).next().offset();
     1800    FastBitVector liveLocals = bytecodeLiveness.getLivenessInfoAtBytecodeIndex(this, BytecodeIndex(nextOffset));
    18011801    Vector<VirtualRegister> liveOperands;
    18021802    liveOperands.reserveInitialCapacity(liveLocals.bitCount());
     
    18431843}
    18441844
    1845 unsigned CodeBlock::lineNumberForBytecodeOffset(unsigned bytecodeOffset)
    1846 {
    1847     RELEASE_ASSERT(bytecodeOffset < instructions().size());
    1848     return ownerExecutable()->firstLine() + m_unlinkedCode->lineNumberForBytecodeOffset(bytecodeOffset);
    1849 }
    1850 
    1851 unsigned CodeBlock::columnNumberForBytecodeOffset(unsigned bytecodeOffset)
     1845unsigned CodeBlock::lineNumberForBytecodeIndex(BytecodeIndex bytecodeIndex)
     1846{
     1847    RELEASE_ASSERT(bytecodeIndex.offset() < instructions().size());
     1848    return ownerExecutable()->firstLine() + m_unlinkedCode->lineNumberForBytecodeIndex(bytecodeIndex);
     1849}
     1850
     1851unsigned CodeBlock::columnNumberForBytecodeIndex(BytecodeIndex bytecodeIndex)
    18521852{
    18531853    int divot;
     
    18561856    unsigned line;
    18571857    unsigned column;
    1858     expressionRangeForBytecodeOffset(bytecodeOffset, divot, startOffset, endOffset, line, column);
     1858    expressionRangeForBytecodeIndex(bytecodeIndex, divot, startOffset, endOffset, line, column);
    18591859    return column;
    18601860}
    18611861
    1862 void CodeBlock::expressionRangeForBytecodeOffset(unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset, unsigned& line, unsigned& column) const
    1863 {
    1864     m_unlinkedCode->expressionRangeForBytecodeOffset(bytecodeOffset, divot, startOffset, endOffset, line, column);
     1862void CodeBlock::expressionRangeForBytecodeIndex(BytecodeIndex bytecodeIndex, int& divot, int& startOffset, int& endOffset, unsigned& line, unsigned& column) const
     1863{
     1864    m_unlinkedCode->expressionRangeForBytecodeIndex(bytecodeIndex, divot, startOffset, endOffset, line, column);
    18651865    divot += sourceOffset();
    18661866    column += line ? 1 : firstLineColumnOffset();
     
    18761876            unsigned opDebugLine;
    18771877            unsigned opDebugColumn;
    1878             expressionRangeForBytecodeOffset(it.offset(), unused, unused, unused, opDebugLine, opDebugColumn);
     1878            expressionRangeForBytecodeIndex(it.index(), unused, unused, unused, opDebugLine, opDebugColumn);
    18791879            if (line == opDebugLine && (!column || column == opDebugColumn))
    18801880                return true;
     
    26242624#endif
    26252625
    2626 ArrayProfile* CodeBlock::getArrayProfile(const ConcurrentJSLocker&, unsigned bytecodeOffset)
    2627 {
    2628     auto instruction = instructions().at(bytecodeOffset);
     2626ArrayProfile* CodeBlock::getArrayProfile(const ConcurrentJSLocker&, BytecodeIndex bytecodeIndex)
     2627{
     2628    auto instruction = instructions().at(bytecodeIndex);
    26292629    switch (instruction->opcodeID()) {
    26302630#define CASE1(Op) \
     
    26562656}
    26572657
    2658 ArrayProfile* CodeBlock::getArrayProfile(unsigned bytecodeOffset)
     2658ArrayProfile* CodeBlock::getArrayProfile(BytecodeIndex bytecodeIndex)
    26592659{
    26602660    ConcurrentJSLocker locker(m_lock);
    2661     return getArrayProfile(locker, bytecodeOffset);
     2661    return getArrayProfile(locker, bytecodeIndex);
    26622662}
    26632663
     
    29672967}
    29682968
    2969 ValueProfile* CodeBlock::tryGetValueProfileForBytecodeOffset(int bytecodeOffset)
    2970 {
    2971     auto instruction = instructions().at(bytecodeOffset);
     2969ValueProfile* CodeBlock::tryGetValueProfileForBytecodeIndex(BytecodeIndex bytecodeIndex)
     2970{
     2971    auto instruction = instructions().at(bytecodeIndex);
    29722972    switch (instruction->opcodeID()) {
    29732973
     
    29862986}
    29872987
    2988 SpeculatedType CodeBlock::valueProfilePredictionForBytecodeOffset(const ConcurrentJSLocker& locker, int bytecodeOffset)
    2989 {
    2990     if (ValueProfile* valueProfile = tryGetValueProfileForBytecodeOffset(bytecodeOffset))
     2988SpeculatedType CodeBlock::valueProfilePredictionForBytecodeIndex(const ConcurrentJSLocker& locker, BytecodeIndex bytecodeIndex)
     2989{
     2990    if (ValueProfile* valueProfile = tryGetValueProfileForBytecodeIndex(bytecodeIndex))
    29912991        return valueProfile->computeUpdatedPrediction(locker);
    29922992    return SpecNone;
    29932993}
    29942994
    2995 ValueProfile& CodeBlock::valueProfileForBytecodeOffset(int bytecodeOffset)
    2996 {
    2997     return *tryGetValueProfileForBytecodeOffset(bytecodeOffset);
     2995ValueProfile& CodeBlock::valueProfileForBytecodeIndex(BytecodeIndex bytecodeIndex)
     2996{
     2997    return *tryGetValueProfileForBytecodeIndex(bytecodeIndex);
    29982998}
    29992999
     
    30023002    BytecodeLivenessAnalysis liveness(this); // Compute directly from scratch so it doesn't effect CodeBlock footprint.
    30033003   
    3004     FastBitVector liveAtHead = liveness.getLivenessInfoAtBytecodeOffset(this, 0);
     3004    FastBitVector liveAtHead = liveness.getLivenessInfoAtBytecodeIndex(this, BytecodeIndex(0));
    30053005   
    30063006    if (liveAtHead.numBits() != static_cast<size_t>(m_numCalleeLocals)) {
     
    30263026    for (const auto& instruction : instructionStream) {
    30273027        OpcodeID opcode = instruction->opcodeID();
    3028         if (!!baselineAlternative()->handlerForBytecodeOffset(instruction.offset())) {
     3028        if (!!baselineAlternative()->handlerForBytecodeIndex(BytecodeIndex(instruction.offset()))) {
    30293029            if (opcode == op_catch || opcode == op_enter) {
    30303030                // op_catch/op_enter logically represent an entrypoint. Entrypoints are not allowed to be
     
    30843084}
    30853085
    3086 ArithProfile* CodeBlock::arithProfileForBytecodeOffset(InstructionStream::Offset bytecodeOffset)
    3087 {
    3088     return arithProfileForPC(instructions().at(bytecodeOffset).ptr());
     3086ArithProfile* CodeBlock::arithProfileForBytecodeIndex(BytecodeIndex bytecodeIndex)
     3087{
     3088    return arithProfileForPC(instructions().at(bytecodeIndex.offset()).ptr());
    30893089}
    30903090
     
    31093109}
    31103110
    3111 bool CodeBlock::couldTakeSpecialFastCase(InstructionStream::Offset bytecodeOffset)
     3111bool CodeBlock::couldTakeSpecialArithFastCase(BytecodeIndex bytecodeIndex)
    31123112{
    31133113    if (!hasBaselineJITProfiling())
    31143114        return false;
    3115     ArithProfile* profile = arithProfileForBytecodeOffset(bytecodeOffset);
     3115    ArithProfile* profile = arithProfileForBytecodeIndex(bytecodeIndex);
    31163116    if (!profile)
    31173117        return false;
     
    32323232#endif // ENABLE(JIT)
    32333233
    3234 Optional<unsigned> CodeBlock::bytecodeOffsetFromCallSiteIndex(CallSiteIndex callSiteIndex)
    3235 {
    3236     Optional<unsigned> bytecodeOffset;
     3234Optional<BytecodeIndex> CodeBlock::bytecodeIndexFromCallSiteIndex(CallSiteIndex callSiteIndex)
     3235{
     3236    Optional<BytecodeIndex> bytecodeIndex;
    32373237    JITType jitType = this->jitType();
    32383238    if (jitType == JITType::InterpreterThunk || jitType == JITType::BaselineJIT) {
    32393239#if USE(JSVALUE64)
    3240         bytecodeOffset = callSiteIndex.bits();
     3240        bytecodeIndex = callSiteIndex.bytecodeIndex();
    32413241#else
    32423242        Instruction* instruction = bitwise_cast<Instruction*>(callSiteIndex.bits());
    3243         bytecodeOffset = this->bytecodeOffset(instruction);
     3243        bytecodeIndex = this->bytecodeIndex(instruction);
    32443244#endif
    32453245    } else if (jitType == JITType::DFGJIT || jitType == JITType::FTLJIT) {
     
    32473247        RELEASE_ASSERT(canGetCodeOrigin(callSiteIndex));
    32483248        CodeOrigin origin = codeOrigin(callSiteIndex);
    3249         bytecodeOffset = origin.bytecodeIndex();
     3249        bytecodeIndex = origin.bytecodeIndex();
    32503250#else
    32513251        RELEASE_ASSERT_NOT_REACHED();
     
    32533253    }
    32543254
    3255     return bytecodeOffset;
     3255    return bytecodeIndex;
    32563256}
    32573257
Note: See TracChangeset for help on using the changeset viewer.