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/dfg/DFGByteCodeParser.cpp

    r251106 r251468  
    149149    // It is also used when doing an early return from an inlined callee: it is easier to fix the bytecode index later on if needed
    150150    // than to move the right index all the way to the treatment of op_ret.
    151     BasicBlock* allocateTargetableBlock(unsigned bytecodeIndex);
     151    BasicBlock* allocateTargetableBlock(BytecodeIndex);
    152152    BasicBlock* allocateUntargetableBlock();
    153153    // An untargetable block can be given a bytecodeIndex to be later managed by linkBlock, but only once, and it can never go in the other direction
    154     void makeBlockTargetable(BasicBlock*, unsigned bytecodeIndex);
     154    void makeBlockTargetable(BasicBlock*, BytecodeIndex);
    155155    void addJumpTo(BasicBlock*);
    156156    void addJumpTo(unsigned bytecodeIndex);
     
    175175    unsigned getInliningBalance(const CallLinkStatus&, CodeSpecializationKind);
    176176    enum class CallOptimizationResult { OptimizedToJump, Inlined, DidNothing };
    177     CallOptimizationResult handleCallVariant(Node* callTargetNode, VirtualRegister result, CallVariant, int registerOffset, VirtualRegister thisArgument, int argumentCountIncludingThis, unsigned nextOffset, InlineCallFrame::Kind, SpeculatedType prediction, unsigned& inliningBalance, BasicBlock* continuationBlock, bool needsToCheckCallee);
    178     CallOptimizationResult handleInlining(Node* callTargetNode, VirtualRegister result, const CallLinkStatus&, int registerOffset, VirtualRegister thisArgument, int argumentCountIncludingThis, unsigned nextOffset, NodeType callOp, InlineCallFrame::Kind, SpeculatedType prediction);
     177    CallOptimizationResult handleCallVariant(Node* callTargetNode, VirtualRegister result, CallVariant, int registerOffset, VirtualRegister thisArgument, int argumentCountIncludingThis, BytecodeIndex nextIndex, InlineCallFrame::Kind, SpeculatedType prediction, unsigned& inliningBalance, BasicBlock* continuationBlock, bool needsToCheckCallee);
     178    CallOptimizationResult handleInlining(Node* callTargetNode, VirtualRegister result, const CallLinkStatus&, int registerOffset, VirtualRegister thisArgument, int argumentCountIncludingThis, BytecodeIndex nextIndex, NodeType callOp, InlineCallFrame::Kind, SpeculatedType prediction);
    179179    template<typename ChecksFunctor>
    180180    void inlineCall(Node* callTargetNode, VirtualRegister result, CallVariant, int registerOffset, int argumentCountIncludingThis, InlineCallFrame::Kind, BasicBlock* continuationBlock, const ChecksFunctor& insertChecks);
     
    568568        origin.walkUpInlineStack(
    569569            [&] (CodeOrigin origin) {
    570                 unsigned bytecodeIndex = origin.bytecodeIndex();
     570                BytecodeIndex bytecodeIndex = origin.bytecodeIndex();
    571571                InlineCallFrame* inlineCallFrame = origin.inlineCallFrame();
    572572                flushImpl(inlineCallFrame, addFlushDirect);
     
    643643    void flushIfTerminal(SwitchData& data)
    644644    {
    645         if (data.fallThrough.bytecodeIndex() > m_currentIndex)
     645        if (data.fallThrough.bytecodeIndex() > m_currentIndex.offset())
    646646            return;
    647647       
    648648        for (unsigned i = data.cases.size(); i--;) {
    649             if (data.cases[i].target.bytecodeIndex() > m_currentIndex)
     649            if (data.cases[i].target.bytecodeIndex() > m_currentIndex.offset())
    650650                return;
    651651        }
     
    710710        // We assume that branches originating from bytecode always have a fall-through. We
    711711        // use this assumption to avoid checking for the creation of terminal blocks.
    712         ASSERT((taken > m_currentIndex) || (notTaken > m_currentIndex));
     712        ASSERT((taken > m_currentIndex.offset()) || (notTaken > m_currentIndex.offset()));
    713713        BranchData* data = m_graph.m_branchData.add();
    714714        *data = BranchData::withBytecodeIndices(taken, notTaken);
     
    835835    }
    836836   
    837     SpeculatedType getPredictionWithoutOSRExit(unsigned bytecodeIndex)
     837    SpeculatedType getPredictionWithoutOSRExit(BytecodeIndex bytecodeIndex)
    838838    {
    839839        auto getValueProfilePredictionFromForCodeBlockAndBytecodeOffset = [&] (CodeBlock* codeBlock, const CodeOrigin& codeOrigin)
     
    842842            {
    843843                ConcurrentJSLocker locker(codeBlock->m_lock);
    844                 prediction = codeBlock->valueProfilePredictionForBytecodeOffset(locker, codeOrigin.bytecodeIndex());
     844                prediction = codeBlock->valueProfilePredictionForBytecodeIndex(locker, codeOrigin.bytecodeIndex());
    845845            }
    846846            auto* fuzzerAgent = m_vm->fuzzerAgent();
     
    861861        // inlined tail call frames, we use SpecFullTop
    862862        // to avoid a spurious OSR exit.
    863         auto instruction = m_inlineStackTop->m_profiledBlock->instructions().at(bytecodeIndex);
     863        auto instruction = m_inlineStackTop->m_profiledBlock->instructions().at(bytecodeIndex.offset());
    864864        OpcodeID opcodeID = instruction->opcodeID();
    865865
     
    895895    }
    896896
    897     SpeculatedType getPrediction(unsigned bytecodeIndex)
     897    SpeculatedType getPrediction(BytecodeIndex bytecodeIndex)
    898898    {
    899899        SpeculatedType prediction = getPredictionWithoutOSRExit(bytecodeIndex);
     
    921921    {
    922922        CodeBlock* codeBlock = m_inlineStackTop->m_profiledBlock;
    923         ArrayProfile* profile = codeBlock->getArrayProfile(codeBlock->bytecodeOffset(m_currentInstruction));
     923        ArrayProfile* profile = codeBlock->getArrayProfile(codeBlock->bytecodeIndex(m_currentInstruction));
    924924        return getArrayMode(*profile, action);
    925925    }
     
    944944
    945945        {
    946             ArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->arithProfileForBytecodeOffset(m_currentIndex);
     946            ArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->arithProfileForBytecodeIndex(m_currentIndex);
    947947            if (arithProfile) {
    948948                switch (node->op()) {
     
    957957                        node->mergeFlags(NodeMayHaveBigIntResult);
    958958                    break;
    959                
     959
    960960                case ValueMul:
    961961                case ArithMul: {
     
    988988                    break;
    989989                }
    990                
     990
    991991                default:
    992992                    break;
     
    10291029        // is what the special fast case counter tells us.
    10301030       
    1031         if (!m_inlineStackTop->m_profiledBlock->couldTakeSpecialFastCase(m_currentIndex))
     1031        if (!m_inlineStackTop->m_profiledBlock->couldTakeSpecialArithFastCase(m_currentIndex))
    10321032            return node;
    10331033       
     
    10351035        node->mergeFlags(NodeMayOverflowInt32InBaseline | NodeMayNegZeroInBaseline);
    10361036       
    1037         ArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->arithProfileForBytecodeOffset(m_currentIndex);
     1037        ArithProfile* arithProfile = m_inlineStackTop->m_profiledBlock->arithProfileForBytecodeIndex(m_currentIndex);
    10381038        if (arithProfile->didObserveBigInt())
    10391039            node->mergeFlags(NodeMayHaveBigIntResult);
     
    10621062    BasicBlock* m_currentBlock;
    10631063    // The bytecode index of the current instruction being generated.
    1064     unsigned m_currentIndex;
     1064    BytecodeIndex m_currentIndex;
    10651065    // The semantic origin of the current node if different from the current Index.
    10661066    CodeOrigin m_currentSemanticOrigin;
     
    11921192};
    11931193
    1194 BasicBlock* ByteCodeParser::allocateTargetableBlock(unsigned bytecodeIndex)
     1194BasicBlock* ByteCodeParser::allocateTargetableBlock(BytecodeIndex bytecodeIndex)
    11951195{
    1196     ASSERT(bytecodeIndex != UINT_MAX);
     1196    ASSERT(bytecodeIndex);
    11971197    Ref<BasicBlock> block = adoptRef(*new BasicBlock(bytecodeIndex, m_numArguments, m_numLocals, 1));
    11981198    BasicBlock* blockPtr = block.ptr();
    11991199    // m_blockLinkingTargets must always be sorted in increasing order of bytecodeBegin
    12001200    if (m_inlineStackTop->m_blockLinkingTargets.size())
    1201         ASSERT(m_inlineStackTop->m_blockLinkingTargets.last()->bytecodeBegin < bytecodeIndex);
     1201        ASSERT(m_inlineStackTop->m_blockLinkingTargets.last()->bytecodeBegin.offset() < bytecodeIndex.offset());
    12021202    m_inlineStackTop->m_blockLinkingTargets.append(blockPtr);
    12031203    m_graph.appendBlock(WTFMove(block));
     
    12071207BasicBlock* ByteCodeParser::allocateUntargetableBlock()
    12081208{
    1209     Ref<BasicBlock> block = adoptRef(*new BasicBlock(UINT_MAX, m_numArguments, m_numLocals, 1));
     1209    Ref<BasicBlock> block = adoptRef(*new BasicBlock(BytecodeIndex(), m_numArguments, m_numLocals, 1));
    12101210    BasicBlock* blockPtr = block.ptr();
    12111211    m_graph.appendBlock(WTFMove(block));
     
    12131213}
    12141214
    1215 void ByteCodeParser::makeBlockTargetable(BasicBlock* block, unsigned bytecodeIndex)
     1215void ByteCodeParser::makeBlockTargetable(BasicBlock* block, BytecodeIndex bytecodeIndex)
    12161216{
    1217     RELEASE_ASSERT(block->bytecodeBegin == UINT_MAX);
     1217    RELEASE_ASSERT(!block->bytecodeBegin);
    12181218    block->bytecodeBegin = bytecodeIndex;
    12191219    // m_blockLinkingTargets must always be sorted in increasing order of bytecodeBegin
    12201220    if (m_inlineStackTop->m_blockLinkingTargets.size())
    1221         ASSERT(m_inlineStackTop->m_blockLinkingTargets.last()->bytecodeBegin < bytecodeIndex);
     1221        ASSERT(m_inlineStackTop->m_blockLinkingTargets.last()->bytecodeBegin.offset() < bytecodeIndex.offset());
    12221222    m_inlineStackTop->m_blockLinkingTargets.append(block);
    12231223}
     
    12791279        VirtualRegister thisArgument = virtualRegisterForArgument(0, registerOffset);
    12801280        auto optimizationResult = handleInlining(callTarget, result, callLinkStatus, registerOffset, thisArgument,
    1281             argumentCountIncludingThis, m_currentIndex + instructionSize, op, kind, prediction);
     1281            argumentCountIncludingThis, BytecodeIndex(m_currentIndex.offset() + instructionSize), op, kind, prediction);
    12821282        if (optimizationResult == CallOptimizationResult::OptimizedToJump)
    12831283            return Terminal;
     
    14581458
    14591459        // We want to emit the SetLocals with an exit origin that points to the place we are jumping to.
    1460         unsigned oldIndex = m_currentIndex;
     1460        BytecodeIndex oldIndex = m_currentIndex;
    14611461        auto oldStackTop = m_inlineStackTop;
    14621462        m_inlineStackTop = stackEntry;
    1463         m_currentIndex = opcodeLengths[op_enter];
     1463        m_currentIndex = BytecodeIndex(opcodeLengths[op_enter]);
    14641464        m_exitOK = true;
    14651465        processSetLocalQueue();
     
    14681468        m_exitOK = false;
    14691469
    1470         BasicBlock** entryBlockPtr = tryBinarySearch<BasicBlock*, unsigned>(stackEntry->m_blockLinkingTargets, stackEntry->m_blockLinkingTargets.size(), opcodeLengths[op_enter], getBytecodeBeginForBlock);
     1470        BasicBlock** entryBlockPtr = tryBinarySearch<BasicBlock*, BytecodeIndex>(stackEntry->m_blockLinkingTargets, stackEntry->m_blockLinkingTargets.size(), BytecodeIndex(opcodeLengths[op_enter]), getBytecodeBeginForBlock);
    14711471        RELEASE_ASSERT(entryBlockPtr);
    14721472        addJumpTo(*entryBlockPtr);
     
    16261626
    16271627    // This is where the actual inlining really happens.
    1628     unsigned oldIndex = m_currentIndex;
    1629     m_currentIndex = 0;
     1628    BytecodeIndex oldIndex = m_currentIndex;
     1629    m_currentIndex = BytecodeIndex(0);
    16301630
    16311631    switch (kind) {
     
    17621762}
    17631763
    1764 ByteCodeParser::CallOptimizationResult ByteCodeParser::handleCallVariant(Node* callTargetNode, VirtualRegister result, CallVariant callee, int registerOffset, VirtualRegister thisArgument, int argumentCountIncludingThis, unsigned nextOffset, InlineCallFrame::Kind kind, SpeculatedType prediction, unsigned& inliningBalance, BasicBlock* continuationBlock, bool needsToCheckCallee)
     1764ByteCodeParser::CallOptimizationResult ByteCodeParser::handleCallVariant(Node* callTargetNode, VirtualRegister result, CallVariant callee, int registerOffset, VirtualRegister thisArgument, int argumentCountIncludingThis, BytecodeIndex nextIndex, InlineCallFrame::Kind kind, SpeculatedType prediction, unsigned& inliningBalance, BasicBlock* continuationBlock, bool needsToCheckCallee)
    17651765{
    17661766    VERBOSE_LOG("    Considering callee ", callee, "\n");
     
    17901790        inliningBalance--;
    17911791        if (continuationBlock) {
    1792             m_currentIndex = nextOffset;
     1792            m_currentIndex = nextIndex;
    17931793            m_exitOK = true;
    17941794            processSetLocalQueue();
     
    19731973    int registerOffset, VirtualRegister thisArgument,
    19741974    int argumentCountIncludingThis,
    1975     unsigned nextOffset, NodeType callOp, InlineCallFrame::Kind kind, SpeculatedType prediction)
     1975    BytecodeIndex nextIndex, NodeType callOp, InlineCallFrame::Kind kind, SpeculatedType prediction)
    19761976{
    19771977    VERBOSE_LOG("Handling inlining...\nStack: ", currentCodeOrigin(), "\n");
     
    19861986        return handleCallVariant(
    19871987            callTargetNode, result, callLinkStatus[0], registerOffset, thisArgument,
    1988             argumentCountIncludingThis, nextOffset, kind, prediction, inliningBalance, nullptr, true);
     1988            argumentCountIncludingThis, nextIndex, kind, prediction, inliningBalance, nullptr, true);
    19891989    }
    19901990
     
    20622062    VERBOSE_LOG("About to loop over functions at ", currentCodeOrigin(), ".\n");
    20632063
    2064     unsigned oldOffset = m_currentIndex;
     2064    BytecodeIndex oldIndex = m_currentIndex;
    20652065    for (unsigned i = 0; i < callLinkStatus.size(); ++i) {
    2066         m_currentIndex = oldOffset;
     2066        m_currentIndex = oldIndex;
    20672067        BasicBlock* calleeEntryBlock = allocateUntargetableBlock();
    20682068        m_currentBlock = calleeEntryBlock;
     
    20762076        auto inliningResult = handleCallVariant(
    20772077            myCallTargetNode, result, callLinkStatus[i], registerOffset,
    2078             thisArgument, argumentCountIncludingThis, nextOffset, kind, prediction,
     2078            thisArgument, argumentCountIncludingThis, nextIndex, kind, prediction,
    20792079            inliningBalance, continuationBlock, false);
    20802080       
     
    21052105    // Slow path block
    21062106    m_currentBlock = allocateUntargetableBlock();
    2107     m_currentIndex = oldOffset;
     2107    m_currentIndex = oldIndex;
    21082108    m_exitOK = true;
    21092109    data.fallThrough = BranchTarget(m_currentBlock);
     
    21252125    }
    21262126
    2127     m_currentIndex = nextOffset;
     2127    m_currentIndex = nextIndex;
    21282128    m_exitOK = true; // Origin changed, so it's fine to exit again.
    21292129    processSetLocalQueue();
     
    21372137    prepareToParseBlock();
    21382138   
    2139     m_currentIndex = oldOffset;
     2139    m_currentIndex = oldIndex;
    21402140    m_currentBlock = continuationBlock;
    21412141    m_exitOK = true;
     
    46944694#define NEXT_OPCODE(name) \
    46954695    if (true) { \
    4696         m_currentIndex += currentInstruction->size(); \
     4696        m_currentIndex = BytecodeIndex(m_currentIndex.offset() + currentInstruction->size()); \
    46974697        goto WTF_CONCAT(NEXT_OPCODE_, __LINE__); /* Need a unique label: usable more than once per function. */ \
    46984698    } else \
     
    47014701
    47024702#define LAST_OPCODE_LINKED(name) do { \
    4703         m_currentIndex += currentInstruction->size(); \
     4703        m_currentIndex = BytecodeIndex(m_currentIndex.offset() + currentInstruction->size()); \
    47044704        m_exitOK = false; \
    47054705        return; \
     
    47254725{
    47264726    auto& instructions = m_inlineStackTop->m_codeBlock->instructions();
    4727     unsigned blockBegin = m_currentIndex;
     4727    BytecodeIndex blockBegin = m_currentIndex;
    47284728
    47294729    // If we are the first basic block, introduce markers for arguments. This allows
     
    47694769       
    47704770        // Don't extend over jump destinations.
    4771         if (m_currentIndex == limit) {
     4771        if (m_currentIndex.offset() == limit) {
    47724772            // Ordinarily we want to plant a jump. But refuse to do this if the block is
    47734773            // empty. This is a special case for inlining, which might otherwise create
     
    47794779
    47804780            if (!m_currentBlock->isEmpty())
    4781                 addJumpTo(m_currentIndex);
     4781                addJumpTo(m_currentIndex.offset());
    47824782            return;
    47834783        }
     
    58045804            auto bytecode = currentInstruction->as<OpJmp>();
    58055805            int relativeOffset = jumpTarget(bytecode.m_targetLabel);
    5806             addToGraph(Jump, OpInfo(m_currentIndex + relativeOffset));
     5806            addToGraph(Jump, OpInfo(m_currentIndex.offset() + relativeOffset));
    58075807            if (relativeOffset <= 0)
    58085808                flushForTerminal();
     
    58145814            unsigned relativeOffset = jumpTarget(bytecode.m_targetLabel);
    58155815            Node* condition = get(bytecode.m_condition);
    5816             addToGraph(Branch, OpInfo(branchData(m_currentIndex + relativeOffset, m_currentIndex + currentInstruction->size())), condition);
     5816            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + relativeOffset, m_currentIndex.offset() + currentInstruction->size())), condition);
    58175817            LAST_OPCODE(op_jtrue);
    58185818        }
     
    58225822            unsigned relativeOffset = jumpTarget(bytecode.m_targetLabel);
    58235823            Node* condition = get(bytecode.m_condition);
    5824             addToGraph(Branch, OpInfo(branchData(m_currentIndex + currentInstruction->size(), m_currentIndex + relativeOffset)), condition);
     5824            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + currentInstruction->size(), m_currentIndex.offset() + relativeOffset)), condition);
    58255825            LAST_OPCODE(op_jfalse);
    58265826        }
     
    58325832            Node* nullConstant = addToGraph(JSConstant, OpInfo(m_constantNull));
    58335833            Node* condition = addToGraph(CompareEq, value, nullConstant);
    5834             addToGraph(Branch, OpInfo(branchData(m_currentIndex + relativeOffset, m_currentIndex + currentInstruction->size())), condition);
     5834            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + relativeOffset, m_currentIndex.offset() + currentInstruction->size())), condition);
    58355835            LAST_OPCODE(op_jeq_null);
    58365836        }
     
    58425842            Node* nullConstant = addToGraph(JSConstant, OpInfo(m_constantNull));
    58435843            Node* condition = addToGraph(CompareEq, value, nullConstant);
    5844             addToGraph(Branch, OpInfo(branchData(m_currentIndex + currentInstruction->size(), m_currentIndex + relativeOffset)), condition);
     5844            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + currentInstruction->size(), m_currentIndex.offset() + relativeOffset)), condition);
    58455845            LAST_OPCODE(op_jneq_null);
    58465846        }
     
    58515851            Node* value = get(bytecode.m_value);
    58525852            Node* condition = addToGraph(IsUndefinedOrNull, value);
    5853             addToGraph(Branch, OpInfo(branchData(m_currentIndex + relativeOffset, m_currentIndex + currentInstruction->size())), condition);
     5853            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + relativeOffset, m_currentIndex.offset() + currentInstruction->size())), condition);
    58545854            LAST_OPCODE(op_jundefined_or_null);
    58555855        }
     
    58605860            Node* value = get(bytecode.m_value);
    58615861            Node* condition = addToGraph(IsUndefinedOrNull, value);
    5862             addToGraph(Branch, OpInfo(branchData(m_currentIndex + currentInstruction->size(), m_currentIndex + relativeOffset)), condition);
     5862            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + currentInstruction->size(), m_currentIndex.offset() + relativeOffset)), condition);
    58635863            LAST_OPCODE(op_jnundefined_or_null);
    58645864        }
     
    58705870            Node* op2 = get(bytecode.m_rhs);
    58715871            Node* condition = addToGraph(CompareLess, op1, op2);
    5872             addToGraph(Branch, OpInfo(branchData(m_currentIndex + relativeOffset, m_currentIndex + currentInstruction->size())), condition);
     5872            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + relativeOffset, m_currentIndex.offset() + currentInstruction->size())), condition);
    58735873            LAST_OPCODE(op_jless);
    58745874        }
     
    58805880            Node* op2 = get(bytecode.m_rhs);
    58815881            Node* condition = addToGraph(CompareLessEq, op1, op2);
    5882             addToGraph(Branch, OpInfo(branchData(m_currentIndex + relativeOffset, m_currentIndex + currentInstruction->size())), condition);
     5882            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + relativeOffset, m_currentIndex.offset() + currentInstruction->size())), condition);
    58835883            LAST_OPCODE(op_jlesseq);
    58845884        }
     
    58905890            Node* op2 = get(bytecode.m_rhs);
    58915891            Node* condition = addToGraph(CompareGreater, op1, op2);
    5892             addToGraph(Branch, OpInfo(branchData(m_currentIndex + relativeOffset, m_currentIndex + currentInstruction->size())), condition);
     5892            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + relativeOffset, m_currentIndex.offset() + currentInstruction->size())), condition);
    58935893            LAST_OPCODE(op_jgreater);
    58945894        }
     
    59005900            Node* op2 = get(bytecode.m_rhs);
    59015901            Node* condition = addToGraph(CompareGreaterEq, op1, op2);
    5902             addToGraph(Branch, OpInfo(branchData(m_currentIndex + relativeOffset, m_currentIndex + currentInstruction->size())), condition);
     5902            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + relativeOffset, m_currentIndex.offset() + currentInstruction->size())), condition);
    59035903            LAST_OPCODE(op_jgreatereq);
    59045904        }
     
    59105910            Node* op2 = get(bytecode.m_rhs);
    59115911            Node* condition = addToGraph(CompareEq, op1, op2);
    5912             addToGraph(Branch, OpInfo(branchData(m_currentIndex + relativeOffset, m_currentIndex + currentInstruction->size())), condition);
     5912            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + relativeOffset, m_currentIndex.offset() + currentInstruction->size())), condition);
    59135913            LAST_OPCODE(op_jeq);
    59145914        }
     
    59205920            Node* op2 = get(bytecode.m_rhs);
    59215921            Node* condition = addToGraph(CompareStrictEq, op1, op2);
    5922             addToGraph(Branch, OpInfo(branchData(m_currentIndex + relativeOffset, m_currentIndex + currentInstruction->size())), condition);
     5922            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + relativeOffset, m_currentIndex.offset() + currentInstruction->size())), condition);
    59235923            LAST_OPCODE(op_jstricteq);
    59245924        }
     
    59305930            Node* op2 = get(bytecode.m_rhs);
    59315931            Node* condition = addToGraph(CompareLess, op1, op2);
    5932             addToGraph(Branch, OpInfo(branchData(m_currentIndex + currentInstruction->size(), m_currentIndex + relativeOffset)), condition);
     5932            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + currentInstruction->size(), m_currentIndex.offset() + relativeOffset)), condition);
    59335933            LAST_OPCODE(op_jnless);
    59345934        }
     
    59405940            Node* op2 = get(bytecode.m_rhs);
    59415941            Node* condition = addToGraph(CompareLessEq, op1, op2);
    5942             addToGraph(Branch, OpInfo(branchData(m_currentIndex + currentInstruction->size(), m_currentIndex + relativeOffset)), condition);
     5942            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + currentInstruction->size(), m_currentIndex.offset() + relativeOffset)), condition);
    59435943            LAST_OPCODE(op_jnlesseq);
    59445944        }
     
    59505950            Node* op2 = get(bytecode.m_rhs);
    59515951            Node* condition = addToGraph(CompareGreater, op1, op2);
    5952             addToGraph(Branch, OpInfo(branchData(m_currentIndex + currentInstruction->size(), m_currentIndex + relativeOffset)), condition);
     5952            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + currentInstruction->size(), m_currentIndex.offset() + relativeOffset)), condition);
    59535953            LAST_OPCODE(op_jngreater);
    59545954        }
     
    59605960            Node* op2 = get(bytecode.m_rhs);
    59615961            Node* condition = addToGraph(CompareGreaterEq, op1, op2);
    5962             addToGraph(Branch, OpInfo(branchData(m_currentIndex + currentInstruction->size(), m_currentIndex + relativeOffset)), condition);
     5962            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + currentInstruction->size(), m_currentIndex.offset() + relativeOffset)), condition);
    59635963            LAST_OPCODE(op_jngreatereq);
    59645964        }
     
    59705970            Node* op2 = get(bytecode.m_rhs);
    59715971            Node* condition = addToGraph(CompareEq, op1, op2);
    5972             addToGraph(Branch, OpInfo(branchData(m_currentIndex + currentInstruction->size(), m_currentIndex + relativeOffset)), condition);
     5972            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + currentInstruction->size(), m_currentIndex.offset() + relativeOffset)), condition);
    59735973            LAST_OPCODE(op_jneq);
    59745974        }
     
    59805980            Node* op2 = get(bytecode.m_rhs);
    59815981            Node* condition = addToGraph(CompareStrictEq, op1, op2);
    5982             addToGraph(Branch, OpInfo(branchData(m_currentIndex + currentInstruction->size(), m_currentIndex + relativeOffset)), condition);
     5982            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + currentInstruction->size(), m_currentIndex.offset() + relativeOffset)), condition);
    59835983            LAST_OPCODE(op_jnstricteq);
    59845984        }
     
    59905990            Node* op2 = get(bytecode.m_rhs);
    59915991            Node* condition = addToGraph(CompareBelow, op1, op2);
    5992             addToGraph(Branch, OpInfo(branchData(m_currentIndex + relativeOffset, m_currentIndex + currentInstruction->size())), condition);
     5992            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + relativeOffset, m_currentIndex.offset() + currentInstruction->size())), condition);
    59935993            LAST_OPCODE(op_jbelow);
    59945994        }
     
    60006000            Node* op2 = get(bytecode.m_rhs);
    60016001            Node* condition = addToGraph(CompareBelowEq, op1, op2);
    6002             addToGraph(Branch, OpInfo(branchData(m_currentIndex + relativeOffset, m_currentIndex + currentInstruction->size())), condition);
     6002            addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + relativeOffset, m_currentIndex.offset() + currentInstruction->size())), condition);
    60036003            LAST_OPCODE(op_jbeloweq);
    60046004        }
     
    60096009            data.kind = SwitchImm;
    60106010            data.switchTableIndex = m_inlineStackTop->m_switchRemap[bytecode.m_tableIndex];
    6011             data.fallThrough.setBytecodeIndex(m_currentIndex + jumpTarget(bytecode.m_defaultOffset));
     6011            data.fallThrough.setBytecodeIndex(m_currentIndex.offset() + jumpTarget(bytecode.m_defaultOffset));
    60126012            SimpleJumpTable& table = m_codeBlock->switchJumpTable(data.switchTableIndex);
    60136013            for (unsigned i = 0; i < table.branchOffsets.size(); ++i) {
    60146014                if (!table.branchOffsets[i])
    60156015                    continue;
    6016                 unsigned target = m_currentIndex + table.branchOffsets[i];
     6016                unsigned target = m_currentIndex.offset() + table.branchOffsets[i];
    60176017                if (target == data.fallThrough.bytecodeIndex())
    60186018                    continue;
     
    60296029            data.kind = SwitchChar;
    60306030            data.switchTableIndex = m_inlineStackTop->m_switchRemap[bytecode.m_tableIndex];
    6031             data.fallThrough.setBytecodeIndex(m_currentIndex + jumpTarget(bytecode.m_defaultOffset));
     6031            data.fallThrough.setBytecodeIndex(m_currentIndex.offset() + jumpTarget(bytecode.m_defaultOffset));
    60326032            SimpleJumpTable& table = m_codeBlock->switchJumpTable(data.switchTableIndex);
    60336033            for (unsigned i = 0; i < table.branchOffsets.size(); ++i) {
    60346034                if (!table.branchOffsets[i])
    60356035                    continue;
    6036                 unsigned target = m_currentIndex + table.branchOffsets[i];
     6036                unsigned target = m_currentIndex.offset() + table.branchOffsets[i];
    60376037                if (target == data.fallThrough.bytecodeIndex())
    60386038                    continue;
     
    60506050            data.kind = SwitchString;
    60516051            data.switchTableIndex = bytecode.m_tableIndex;
    6052             data.fallThrough.setBytecodeIndex(m_currentIndex + jumpTarget(bytecode.m_defaultOffset));
     6052            data.fallThrough.setBytecodeIndex(m_currentIndex.offset() + jumpTarget(bytecode.m_defaultOffset));
    60536053            StringJumpTable& table = m_codeBlock->stringSwitchJumpTable(data.switchTableIndex);
    60546054            StringJumpTable::StringOffsetTable::iterator iter;
    60556055            StringJumpTable::StringOffsetTable::iterator end = table.offsetTable.end();
    60566056            for (iter = table.offsetTable.begin(); iter != end; ++iter) {
    6057                 unsigned target = m_currentIndex + iter->value.branchOffset;
     6057                unsigned target = m_currentIndex.offset() + iter->value.branchOffset;
    60586058                if (target == data.fallThrough.bytecodeIndex())
    60596059                    continue;
     
    60806080                setDirect(m_inlineStackTop->m_returnValue, get(bytecode.m_value), ImmediateSetWithFlush);
    60816081
    6082             if (!m_inlineStackTop->m_continuationBlock && m_currentIndex + currentInstruction->size() != m_inlineStackTop->m_codeBlock->instructions().size()) {
     6082            if (!m_inlineStackTop->m_continuationBlock && m_currentIndex.offset() + currentInstruction->size() != m_inlineStackTop->m_codeBlock->instructions().size()) {
    60836083                // This is an early return from an inlined function and we do not have a continuation block, so we must allocate one.
    60846084                // It is untargetable, because we do not know the appropriate index.
     
    62086208                entrypointArguments.resize(m_numArguments);
    62096209
    6210                 unsigned exitBytecodeIndex = m_currentIndex + currentInstruction->size();
     6210                BytecodeIndex exitBytecodeIndex = BytecodeIndex(m_currentIndex.offset() + currentInstruction->size());
    62116211
    62126212                for (unsigned argument = 0; argument < argumentPredictions.size(); ++argument) {
     
    63176317            if (bytecode.metadata(codeBlock).m_hasJumped) {
    63186318                Node* condition = addToGraph(CompareEqPtr, OpInfo(frozenPointer), child);
    6319                 addToGraph(Branch, OpInfo(branchData(m_currentIndex + currentInstruction->size(), m_currentIndex + relativeOffset)), condition);
     6319                addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + currentInstruction->size(), m_currentIndex.offset() + relativeOffset)), condition);
    63206320                LAST_OPCODE(op_jneq_ptr);
    63216321            }
     
    71367136    switch (node->op()) {
    71377137    case Jump:
    7138         node->targetBlock() = blockForBytecodeOffset(possibleTargets, node->targetBytecodeOffsetDuringParsing());
     7138        node->targetBlock() = blockForBytecodeIndex(possibleTargets, BytecodeIndex(node->targetBytecodeOffsetDuringParsing()));
    71397139        break;
    71407140       
    71417141    case Branch: {
    71427142        BranchData* data = node->branchData();
    7143         data->taken.block = blockForBytecodeOffset(possibleTargets, data->takenBytecodeIndex());
    7144         data->notTaken.block = blockForBytecodeOffset(possibleTargets, data->notTakenBytecodeIndex());
     7143        data->taken.block = blockForBytecodeIndex(possibleTargets, BytecodeIndex(data->takenBytecodeIndex()));
     7144        data->notTaken.block = blockForBytecodeIndex(possibleTargets, BytecodeIndex(data->notTakenBytecodeIndex()));
    71457145        break;
    71467146    }
     
    71497149        SwitchData* data = node->switchData();
    71507150        for (unsigned i = node->switchData()->cases.size(); i--;)
    7151             data->cases[i].target.block = blockForBytecodeOffset(possibleTargets, data->cases[i].target.bytecodeIndex());
    7152         data->fallThrough.block = blockForBytecodeOffset(possibleTargets, data->fallThrough.bytecodeIndex());
     7151            data->cases[i].target.block = blockForBytecodeIndex(possibleTargets, BytecodeIndex(data->cases[i].target.bytecodeIndex()));
     7152        data->fallThrough.block = blockForBytecodeIndex(possibleTargets, BytecodeIndex(data->fallThrough.bytecodeIndex()));
    71537153        break;
    71547154    }
     
    73247324        // The maximum bytecode offset to go into the current basicblock is either the next jump target, or the end of the instructions.
    73257325        unsigned limit = jumpTargetIndex < jumpTargets.size() ? jumpTargets[jumpTargetIndex] : codeBlock->instructions().size();
    7326         ASSERT(m_currentIndex < limit);
     7326        ASSERT(m_currentIndex.offset() < limit);
    73277327
    73287328        // Loop until we reach the current limit (i.e. next jump target).
     
    73477347
    73487348            // We should not have gone beyond the limit.
    7349             ASSERT(m_currentIndex <= limit);
     7349            ASSERT(m_currentIndex.offset() <= limit);
    73507350
    73517351            if (m_currentBlock->isEmpty()) {
     
    73537353                // or polymorphic (creating an empty continuation block),
    73547354                // and then we hit the limit before putting anything in the continuation block.
    7355                 ASSERT(m_currentIndex == limit);
     7355                ASSERT(m_currentIndex.offset() == limit);
    73567356                makeBlockTargetable(m_currentBlock, m_currentIndex);
    73577357            } else {
    7358                 ASSERT(m_currentBlock->terminal() || (m_currentIndex == codeBlock->instructions().size() && inlineCallFrame()));
     7358                ASSERT(m_currentBlock->terminal() || (m_currentIndex.offset() == codeBlock->instructions().size() && inlineCallFrame()));
    73597359                m_currentBlock = nullptr;
    73607360            }
    7361         } while (m_currentIndex < limit);
     7361        } while (m_currentIndex.offset() < limit);
    73627362    }
    73637363
    73647364    // Should have reached the end of the instructions.
    7365     ASSERT(m_currentIndex == codeBlock->instructions().size());
     7365    ASSERT(m_currentIndex.offset() == codeBlock->instructions().size());
    73667366   
    73677367    VERBOSE_LOG("Done parsing ", *codeBlock, " (fell off end)\n");
     
    75267526{
    75277527    // Set during construction.
    7528     ASSERT(!m_currentIndex);
     7528    ASSERT(!m_currentIndex.offset());
    75297529   
    75307530    VERBOSE_LOG("Parsing ", *m_codeBlock, "\n");
Note: See TracChangeset for help on using the changeset viewer.