Use CodeBlock::instructions()[] and CodeBlock::bytecodeOffset() instead of doing...
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Mar 2018 18:23:30 +0000 (18:23 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Mar 2018 18:23:30 +0000 (18:23 +0000)
commitb810e3c370e7efd256defd91c38580c34463dc60
tree8d0270732d7020a0c609b6a7b59ae59de54faa1c
parent502dc5ec65300a05aea2f63a959df7074bf6516f
Use CodeBlock::instructions()[] and CodeBlock::bytecodeOffset() instead of doing own pointer math.
https://bugs.webkit.org/show_bug.cgi?id=183857
<rdar://problem/38712184>

Reviewed by JF Bastien.

We should avoid doing pointer math with CodeBlock::instructions().begin().
Instead, we should use the operator[] that comes with CodeBlock::instructions()
for computing an Instruction*, and use CodeBlock::bytecodeOffset() for computing
the bytecode offset of a given Instruction*.  These methods will do assertions
which helps catch bugs sooner, plus they are more descriptive of the operation
we're trying to do.

* bytecode/BytecodeKills.h:
(JSC::BytecodeKills::operandIsKilled const):
(JSC::BytecodeKills::forEachOperandKilledAt const):
* bytecode/CallLinkStatus.cpp:
(JSC::CallLinkStatus::computeFromLLInt):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::arithProfileForBytecodeOffset):
(JSC::CodeBlock::bytecodeOffsetFromCallSiteIndex):
* bytecode/GetByIdStatus.cpp:
(JSC::GetByIdStatus::computeFromLLInt):
* bytecode/PutByIdStatus.cpp:
(JSC::PutByIdStatus::computeFromLLInt):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
* dfg/DFGOSRExit.cpp:
(JSC::DFG::reifyInlinedCallFrames):
* dfg/DFGOSRExitCompilerCommon.cpp:
(JSC::DFG::reifyInlinedCallFrames):
* interpreter/CallFrame.cpp:
(JSC::CallFrame::callSiteBitsAsBytecodeOffset const):
(JSC::CallFrame::currentVPC const):
(JSC::CallFrame::setCurrentVPC):
* jit/JITCall.cpp:
(JSC::JIT::compileOpCall):
* jit/JITInlines.h:
(JSC::JIT::updateTopCallFrame):
(JSC::JIT::copiedInstruction):
* jit/JITOpcodes.cpp:
(JSC::JIT::privateCompileHasIndexedProperty):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::privateCompileHasIndexedProperty):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::privateCompileGetByVal):
(JSC::JIT::privateCompileGetByValWithCachedId):
(JSC::JIT::privateCompilePutByVal):
(JSC::JIT::privateCompilePutByValWithCachedId):
* jit/SlowPathCall.h:
(JSC::JITSlowPathCall::call):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::llint_trace_operand):
(JSC::LLInt::llint_trace_value):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::setupGetByIdPrototypeCache): Deleted.
(JSC::LLInt::getByVal): Deleted.
(JSC::LLInt::handleHostCall): Deleted.
(JSC::LLInt::setUpCall): Deleted.
(JSC::LLInt::genericCall): Deleted.
(JSC::LLInt::varargsSetup): Deleted.
(JSC::LLInt::llint_throw_stack_overflow_error): Deleted.
(JSC::LLInt::llint_stack_check_at_vm_entry): Deleted.
(JSC::LLInt::llint_write_barrier_slow): Deleted.
(JSC::LLInt::llint_crash): Deleted.
* runtime/SamplingProfiler.cpp:
(JSC::tryGetBytecodeIndex):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/BytecodeKills.h
Source/JavaScriptCore/bytecode/CallLinkStatus.cpp
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/JavaScriptCore/bytecode/GetByIdStatus.cpp
Source/JavaScriptCore/bytecode/PutByIdStatus.cpp
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
Source/JavaScriptCore/dfg/DFGOSRExit.cpp
Source/JavaScriptCore/dfg/DFGOSRExitCompilerCommon.cpp
Source/JavaScriptCore/interpreter/CallFrame.cpp
Source/JavaScriptCore/jit/JITCall.cpp
Source/JavaScriptCore/jit/JITInlines.h
Source/JavaScriptCore/jit/JITOpcodes.cpp
Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
Source/JavaScriptCore/jit/JITPropertyAccess.cpp
Source/JavaScriptCore/jit/SlowPathCall.h
Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
Source/JavaScriptCore/runtime/SamplingProfiler.cpp