Changeset 229609 in webkit


Ignore:
Timestamp:
Mar 14, 2018, 1:05:37 PM (7 years ago)
Author:
mark.lam@apple.com
Message:

Enhance the MacroAssembler and LinkBuffer to support pointer profiling.
https://bugs.webkit.org/show_bug.cgi?id=183623
<rdar://problem/38443314>

Reviewed by Michael Saboff.

Source/JavaScriptCore:

  1. Added a PtrTag argument to indirect call() and indirect jump() MacroAssembler emitters to support pointer profiling.
  1. Also added tagPtr(), untagPtr(), and removePtrTag() placeholder methods.
  1. Added a PtrTag to LinkBuffer finalizeCodeWithoutDisassembly() and clients.
  1. Updated clients to pass a PtrTag. For the most part, I just apply NoPtrTag as a placeholder until we have time to analyze what pointer profile each client site has later.


  1. Apply PtrTags to the YarrJIT.
  • assembler/ARM64Assembler.h:

(JSC::ARM64Assembler::linkJumpOrCall):

  • assembler/AbstractMacroAssembler.h:

(JSC::AbstractMacroAssembler::getLinkerAddress):
(JSC::AbstractMacroAssembler::tagPtr):
(JSC::AbstractMacroAssembler::untagPtr):
(JSC::AbstractMacroAssembler::removePtrTag):

  • assembler/LinkBuffer.cpp:

(JSC::LinkBuffer::finalizeCodeWithoutDisassembly):
(JSC::LinkBuffer::finalizeCodeWithDisassembly):

  • assembler/LinkBuffer.h:

(JSC::LinkBuffer::link):
(JSC::LinkBuffer::locationOfNearCall):
(JSC::LinkBuffer::locationOf):

  • assembler/MacroAssemblerARM.h:

(JSC::MacroAssemblerARM::jump):
(JSC::MacroAssemblerARM::call):
(JSC::MacroAssemblerARM::readCallTarget):

  • assembler/MacroAssemblerARM64.h:

(JSC::MacroAssemblerARM64::call):
(JSC::MacroAssemblerARM64::jump):
(JSC::MacroAssemblerARM64::readCallTarget):
(JSC::MacroAssemblerARM64::linkCall):

  • assembler/MacroAssemblerARMv7.h:

(JSC::MacroAssemblerARMv7::jump):
(JSC::MacroAssemblerARMv7::relativeTableJump):
(JSC::MacroAssemblerARMv7::call):
(JSC::MacroAssemblerARMv7::readCallTarget):

  • assembler/MacroAssemblerCodeRef.cpp:

(JSC::MacroAssemblerCodePtr::createLLIntCodePtr):
(JSC::MacroAssemblerCodeRef::createLLIntCodeRef):

  • assembler/MacroAssemblerCodeRef.h:

(JSC::FunctionPtr::FunctionPtr):
(JSC::FunctionPtr::value const):
(JSC::MacroAssemblerCodePtr:: const):
(JSC::MacroAssemblerCodeRef::MacroAssemblerCodeRef):
(JSC::MacroAssemblerCodeRef::retaggedCode const):

  • assembler/MacroAssemblerMIPS.h:

(JSC::MacroAssemblerMIPS::jump):
(JSC::MacroAssemblerMIPS::call):
(JSC::MacroAssemblerMIPS::readCallTarget):

  • assembler/MacroAssemblerX86.h:

(JSC::MacroAssemblerX86::call):
(JSC::MacroAssemblerX86::jump):
(JSC::MacroAssemblerX86::readCallTarget):

  • assembler/MacroAssemblerX86Common.cpp:

(JSC::MacroAssembler::probe):

  • assembler/MacroAssemblerX86Common.h:

(JSC::MacroAssemblerX86Common::jump):
(JSC::MacroAssemblerX86Common::call):

  • assembler/MacroAssemblerX86_64.h:

(JSC::MacroAssemblerX86_64::call):
(JSC::MacroAssemblerX86_64::jump):
(JSC::MacroAssemblerX86_64::readCallTarget):

  • assembler/testmasm.cpp:

(JSC::compile):
(JSC::invoke):

  • b3/B3Compile.cpp:

(JSC::B3::compile):

  • b3/B3LowerMacros.cpp:
  • b3/air/AirCCallSpecial.cpp:

(JSC::B3::Air::CCallSpecial::generate):

  • b3/air/testair.cpp:
  • b3/testb3.cpp:

(JSC::B3::invoke):
(JSC::B3::testInterpreter):
(JSC::B3::testEntrySwitchSimple):
(JSC::B3::testEntrySwitchNoEntrySwitch):
(JSC::B3::testEntrySwitchWithCommonPaths):
(JSC::B3::testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint):
(JSC::B3::testEntrySwitchLoop):

  • bytecode/AccessCase.cpp:

(JSC::AccessCase::generateImpl):

  • bytecode/AccessCaseSnippetParams.cpp:

(JSC::SlowPathCallGeneratorWithArguments::generateImpl):

  • bytecode/InlineAccess.cpp:

(JSC::linkCodeInline):
(JSC::InlineAccess::rewireStubAsJump):

  • bytecode/PolymorphicAccess.cpp:

(JSC::AccessGenerationState::emitExplicitExceptionHandler):
(JSC::PolymorphicAccess::regenerate):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::compileExceptionHandlers):
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compileFunction):
(JSC::DFG::JITCompiler::noticeCatchEntrypoint):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::appendCall):

  • dfg/DFGJITFinalizer.cpp:

(JSC::DFG::JITFinalizer::finalize):
(JSC::DFG::JITFinalizer::finalizeFunction):

  • dfg/DFGOSRExit.cpp:

(JSC::DFG::OSRExit::emitRestoreArguments):
(JSC::DFG::OSRExit::compileOSRExit):

  • dfg/DFGOSRExitCompilerCommon.cpp:

(JSC::DFG::handleExitCounts):
(JSC::DFG::osrWriteBarrier):
(JSC::DFG::adjustAndJumpToTarget):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::emitSwitchIntJump):
(JSC::DFG::SpeculativeJIT::emitSwitchImm):
(JSC::DFG::SpeculativeJIT::emitSwitchStringOnString):

  • dfg/DFGSpeculativeJIT64.cpp:

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

  • dfg/DFGThunks.cpp:

(JSC::DFG::osrExitThunkGenerator):
(JSC::DFG::osrExitGenerationThunkGenerator):
(JSC::DFG::osrEntryThunkGenerator):

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • ftl/FTLJITFinalizer.cpp:

(JSC::FTL::JITFinalizer::finalizeCommon):

  • ftl/FTLLazySlowPath.cpp:

(JSC::FTL::LazySlowPath::generate):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::lower):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
(JSC::FTL::DFG::LowerDFGToB3::compileCallEval):

  • ftl/FTLOSRExitCompiler.cpp:

(JSC::FTL::compileStub):
(JSC::FTL::compileFTLOSRExit):

  • ftl/FTLSlowPathCall.cpp:

(JSC::FTL::SlowPathCallContext::makeCall):

  • ftl/FTLThunks.cpp:

(JSC::FTL::genericGenerationThunkGenerator):
(JSC::FTL::osrExitGenerationThunkGenerator):
(JSC::FTL::lazySlowPathGenerationThunkGenerator):
(JSC::FTL::slowPathCallThunkGenerator):

  • jit/AssemblyHelpers.cpp:

(JSC::AssemblyHelpers::callExceptionFuzz):
(JSC::AssemblyHelpers::debugCall):

  • jit/CCallHelpers.cpp:

(JSC::CCallHelpers::ensureShadowChickenPacket):

  • jit/CCallHelpers.h:

(JSC::CCallHelpers::jumpToExceptionHandler):

  • jit/ExecutableAllocator.cpp:

(JSC::FixedVMPoolExecutableAllocator::jitWriteThunkGenerator):

  • jit/JIT.cpp:

(JSC::JIT::emitEnterOptimizationCheck):
(JSC::JIT::link):
(JSC::JIT::privateCompileExceptionHandlers):

  • jit/JIT.h:

(JSC::JIT::appendCall):

  • jit/JITMathIC.h:

(JSC::isProfileEmpty):

  • jit/JITOpcodes.cpp:

(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::privateCompileHasIndexedProperty):

  • jit/JITOpcodes32_64.cpp:

(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::privateCompileHasIndexedProperty):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::stringGetByValStubGenerator):
(JSC::JIT::privateCompileGetByVal):
(JSC::JIT::privateCompileGetByValWithCachedId):
(JSC::JIT::privateCompilePutByVal):
(JSC::JIT::privateCompilePutByValWithCachedId):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::stringGetByValStubGenerator):

  • jit/JITStubRoutine.h:
  • jit/Repatch.cpp:

(JSC::readCallTarget):
(JSC::appropriateOptimizingPutByIdFunction):
(JSC::linkPolymorphicCall):
(JSC::resetPutByID):

  • jit/SlowPathCall.h:

(JSC::JITSlowPathCall::call):

  • jit/SpecializedThunkJIT.h:

(JSC::SpecializedThunkJIT::finalize):
(JSC::SpecializedThunkJIT::callDoubleToDouble):

  • jit/ThunkGenerators.cpp:

(JSC::throwExceptionFromCallSlowPathGenerator):
(JSC::slowPathFor):
(JSC::linkCallThunkGenerator):
(JSC::linkPolymorphicCallThunkGenerator):
(JSC::virtualThunkFor):
(JSC::nativeForGenerator):
(JSC::arityFixupGenerator):
(JSC::unreachableGenerator):
(JSC::boundThisNoArgsFunctionCallGenerator):

  • llint/LLIntThunks.cpp:

(JSC::LLInt::generateThunkWithJumpTo):
(JSC::LLInt::functionForCallEntryThunkGenerator):
(JSC::LLInt::functionForConstructEntryThunkGenerator):
(JSC::LLInt::functionForCallArityCheckThunkGenerator):
(JSC::LLInt::functionForConstructArityCheckThunkGenerator):
(JSC::LLInt::evalEntryThunkGenerator):
(JSC::LLInt::programEntryThunkGenerator):
(JSC::LLInt::moduleProgramEntryThunkGenerator):

  • runtime/PtrTag.h:
  • wasm/WasmB3IRGenerator.cpp:

(JSC::Wasm::B3IRGenerator::addCall):
(JSC::Wasm::B3IRGenerator::addCallIndirect):

  • wasm/WasmBBQPlan.cpp:

(JSC::Wasm::BBQPlan::complete):

  • wasm/WasmBinding.cpp:

(JSC::Wasm::wasmToWasm):

  • wasm/WasmOMGPlan.cpp:

(JSC::Wasm::OMGPlan::work):

  • wasm/WasmThunks.cpp:

(JSC::Wasm::throwExceptionFromWasmThunkGenerator):
(JSC::Wasm::throwStackOverflowFromWasmThunkGenerator):
(JSC::Wasm::triggerOMGTierUpThunkGenerator):

  • wasm/js/WasmToJS.cpp:

(JSC::Wasm::handleBadI64Use):
(JSC::Wasm::wasmToJS):

  • yarr/YarrJIT.cpp:

(JSC::Yarr::YarrGenerator::loadFromFrameAndJump):
(JSC::Yarr::YarrGenerator::BacktrackingState::linkDataLabels):
(JSC::Yarr::YarrGenerator::generateTryReadUnicodeCharacterHelper):
(JSC::Yarr::YarrGenerator::generateEnter):
(JSC::Yarr::YarrGenerator::YarrGenerator):
(JSC::Yarr::YarrGenerator::compile):
(JSC::Yarr::jitCompile):

  • yarr/YarrJIT.h:

(JSC::Yarr::YarrCodeBlock::execute):

Source/WebCore:

No new tests. Just adding PtrTags required by new MacroAssembler API.

  • cssjit/FunctionCall.h:

(WebCore::FunctionCall::prepareAndCall):

  • cssjit/SelectorCompiler.cpp:

(WebCore::SelectorCompiler::SelectorCodeGenerator::compile):

Location:
trunk/Source
Files:
70 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r229608 r229609  
     12018-03-14  Mark Lam  <mark.lam@apple.com>
     2
     3        Enhance the MacroAssembler and LinkBuffer to support pointer profiling.
     4        https://bugs.webkit.org/show_bug.cgi?id=183623
     5        <rdar://problem/38443314>
     6
     7        Reviewed by Michael Saboff.
     8
     9        1. Added a PtrTag argument to indirect call() and indirect jump() MacroAssembler
     10           emitters to support pointer profiling.
     11
     12        2. Also added tagPtr(), untagPtr(), and removePtrTag() placeholder methods.
     13
     14        3. Added a PtrTag to LinkBuffer finalizeCodeWithoutDisassembly() and clients.
     15
     16        4. Updated clients to pass a PtrTag.  For the most part, I just apply NoPtrTag as
     17           a placeholder until we have time to analyze what pointer profile each client
     18           site has later.
     19   
     20        5. Apply PtrTags to the YarrJIT.
     21
     22        * assembler/ARM64Assembler.h:
     23        (JSC::ARM64Assembler::linkJumpOrCall):
     24        * assembler/AbstractMacroAssembler.h:
     25        (JSC::AbstractMacroAssembler::getLinkerAddress):
     26        (JSC::AbstractMacroAssembler::tagPtr):
     27        (JSC::AbstractMacroAssembler::untagPtr):
     28        (JSC::AbstractMacroAssembler::removePtrTag):
     29        * assembler/LinkBuffer.cpp:
     30        (JSC::LinkBuffer::finalizeCodeWithoutDisassembly):
     31        (JSC::LinkBuffer::finalizeCodeWithDisassembly):
     32        * assembler/LinkBuffer.h:
     33        (JSC::LinkBuffer::link):
     34        (JSC::LinkBuffer::locationOfNearCall):
     35        (JSC::LinkBuffer::locationOf):
     36        * assembler/MacroAssemblerARM.h:
     37        (JSC::MacroAssemblerARM::jump):
     38        (JSC::MacroAssemblerARM::call):
     39        (JSC::MacroAssemblerARM::readCallTarget):
     40        * assembler/MacroAssemblerARM64.h:
     41        (JSC::MacroAssemblerARM64::call):
     42        (JSC::MacroAssemblerARM64::jump):
     43        (JSC::MacroAssemblerARM64::readCallTarget):
     44        (JSC::MacroAssemblerARM64::linkCall):
     45        * assembler/MacroAssemblerARMv7.h:
     46        (JSC::MacroAssemblerARMv7::jump):
     47        (JSC::MacroAssemblerARMv7::relativeTableJump):
     48        (JSC::MacroAssemblerARMv7::call):
     49        (JSC::MacroAssemblerARMv7::readCallTarget):
     50        * assembler/MacroAssemblerCodeRef.cpp:
     51        (JSC::MacroAssemblerCodePtr::createLLIntCodePtr):
     52        (JSC::MacroAssemblerCodeRef::createLLIntCodeRef):
     53        * assembler/MacroAssemblerCodeRef.h:
     54        (JSC::FunctionPtr::FunctionPtr):
     55        (JSC::FunctionPtr::value const):
     56        (JSC::MacroAssemblerCodePtr:: const):
     57        (JSC::MacroAssemblerCodeRef::MacroAssemblerCodeRef):
     58        (JSC::MacroAssemblerCodeRef::retaggedCode const):
     59        * assembler/MacroAssemblerMIPS.h:
     60        (JSC::MacroAssemblerMIPS::jump):
     61        (JSC::MacroAssemblerMIPS::call):
     62        (JSC::MacroAssemblerMIPS::readCallTarget):
     63        * assembler/MacroAssemblerX86.h:
     64        (JSC::MacroAssemblerX86::call):
     65        (JSC::MacroAssemblerX86::jump):
     66        (JSC::MacroAssemblerX86::readCallTarget):
     67        * assembler/MacroAssemblerX86Common.cpp:
     68        (JSC::MacroAssembler::probe):
     69        * assembler/MacroAssemblerX86Common.h:
     70        (JSC::MacroAssemblerX86Common::jump):
     71        (JSC::MacroAssemblerX86Common::call):
     72        * assembler/MacroAssemblerX86_64.h:
     73        (JSC::MacroAssemblerX86_64::call):
     74        (JSC::MacroAssemblerX86_64::jump):
     75        (JSC::MacroAssemblerX86_64::readCallTarget):
     76        * assembler/testmasm.cpp:
     77        (JSC::compile):
     78        (JSC::invoke):
     79        * b3/B3Compile.cpp:
     80        (JSC::B3::compile):
     81        * b3/B3LowerMacros.cpp:
     82        * b3/air/AirCCallSpecial.cpp:
     83        (JSC::B3::Air::CCallSpecial::generate):
     84        * b3/air/testair.cpp:
     85        * b3/testb3.cpp:
     86        (JSC::B3::invoke):
     87        (JSC::B3::testInterpreter):
     88        (JSC::B3::testEntrySwitchSimple):
     89        (JSC::B3::testEntrySwitchNoEntrySwitch):
     90        (JSC::B3::testEntrySwitchWithCommonPaths):
     91        (JSC::B3::testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint):
     92        (JSC::B3::testEntrySwitchLoop):
     93        * bytecode/AccessCase.cpp:
     94        (JSC::AccessCase::generateImpl):
     95        * bytecode/AccessCaseSnippetParams.cpp:
     96        (JSC::SlowPathCallGeneratorWithArguments::generateImpl):
     97        * bytecode/InlineAccess.cpp:
     98        (JSC::linkCodeInline):
     99        (JSC::InlineAccess::rewireStubAsJump):
     100        * bytecode/PolymorphicAccess.cpp:
     101        (JSC::AccessGenerationState::emitExplicitExceptionHandler):
     102        (JSC::PolymorphicAccess::regenerate):
     103        * dfg/DFGJITCompiler.cpp:
     104        (JSC::DFG::JITCompiler::compileExceptionHandlers):
     105        (JSC::DFG::JITCompiler::link):
     106        (JSC::DFG::JITCompiler::compileFunction):
     107        (JSC::DFG::JITCompiler::noticeCatchEntrypoint):
     108        * dfg/DFGJITCompiler.h:
     109        (JSC::DFG::JITCompiler::appendCall):
     110        * dfg/DFGJITFinalizer.cpp:
     111        (JSC::DFG::JITFinalizer::finalize):
     112        (JSC::DFG::JITFinalizer::finalizeFunction):
     113        * dfg/DFGOSRExit.cpp:
     114        (JSC::DFG::OSRExit::emitRestoreArguments):
     115        (JSC::DFG::OSRExit::compileOSRExit):
     116        * dfg/DFGOSRExitCompilerCommon.cpp:
     117        (JSC::DFG::handleExitCounts):
     118        (JSC::DFG::osrWriteBarrier):
     119        (JSC::DFG::adjustAndJumpToTarget):
     120        * dfg/DFGSpeculativeJIT.cpp:
     121        (JSC::DFG::SpeculativeJIT::emitSwitchIntJump):
     122        (JSC::DFG::SpeculativeJIT::emitSwitchImm):
     123        (JSC::DFG::SpeculativeJIT::emitSwitchStringOnString):
     124        * dfg/DFGSpeculativeJIT64.cpp:
     125        (JSC::DFG::SpeculativeJIT::compile):
     126        * dfg/DFGThunks.cpp:
     127        (JSC::DFG::osrExitThunkGenerator):
     128        (JSC::DFG::osrExitGenerationThunkGenerator):
     129        (JSC::DFG::osrEntryThunkGenerator):
     130        * ftl/FTLCompile.cpp:
     131        (JSC::FTL::compile):
     132        * ftl/FTLJITFinalizer.cpp:
     133        (JSC::FTL::JITFinalizer::finalizeCommon):
     134        * ftl/FTLLazySlowPath.cpp:
     135        (JSC::FTL::LazySlowPath::generate):
     136        * ftl/FTLLink.cpp:
     137        (JSC::FTL::link):
     138        * ftl/FTLLowerDFGToB3.cpp:
     139        (JSC::FTL::DFG::LowerDFGToB3::lower):
     140        (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
     141        (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
     142        (JSC::FTL::DFG::LowerDFGToB3::compileCallEval):
     143        * ftl/FTLOSRExitCompiler.cpp:
     144        (JSC::FTL::compileStub):
     145        (JSC::FTL::compileFTLOSRExit):
     146        * ftl/FTLSlowPathCall.cpp:
     147        (JSC::FTL::SlowPathCallContext::makeCall):
     148        * ftl/FTLThunks.cpp:
     149        (JSC::FTL::genericGenerationThunkGenerator):
     150        (JSC::FTL::osrExitGenerationThunkGenerator):
     151        (JSC::FTL::lazySlowPathGenerationThunkGenerator):
     152        (JSC::FTL::slowPathCallThunkGenerator):
     153        * jit/AssemblyHelpers.cpp:
     154        (JSC::AssemblyHelpers::callExceptionFuzz):
     155        (JSC::AssemblyHelpers::debugCall):
     156        * jit/CCallHelpers.cpp:
     157        (JSC::CCallHelpers::ensureShadowChickenPacket):
     158        * jit/CCallHelpers.h:
     159        (JSC::CCallHelpers::jumpToExceptionHandler):
     160        * jit/ExecutableAllocator.cpp:
     161        (JSC::FixedVMPoolExecutableAllocator::jitWriteThunkGenerator):
     162        * jit/JIT.cpp:
     163        (JSC::JIT::emitEnterOptimizationCheck):
     164        (JSC::JIT::link):
     165        (JSC::JIT::privateCompileExceptionHandlers):
     166        * jit/JIT.h:
     167        (JSC::JIT::appendCall):
     168        * jit/JITMathIC.h:
     169        (JSC::isProfileEmpty):
     170        * jit/JITOpcodes.cpp:
     171        (JSC::JIT::emit_op_catch):
     172        (JSC::JIT::emit_op_switch_imm):
     173        (JSC::JIT::emit_op_switch_char):
     174        (JSC::JIT::emit_op_switch_string):
     175        (JSC::JIT::emitSlow_op_loop_hint):
     176        (JSC::JIT::privateCompileHasIndexedProperty):
     177        * jit/JITOpcodes32_64.cpp:
     178        (JSC::JIT::emit_op_catch):
     179        (JSC::JIT::emit_op_switch_imm):
     180        (JSC::JIT::emit_op_switch_char):
     181        (JSC::JIT::emit_op_switch_string):
     182        (JSC::JIT::privateCompileHasIndexedProperty):
     183        * jit/JITPropertyAccess.cpp:
     184        (JSC::JIT::stringGetByValStubGenerator):
     185        (JSC::JIT::privateCompileGetByVal):
     186        (JSC::JIT::privateCompileGetByValWithCachedId):
     187        (JSC::JIT::privateCompilePutByVal):
     188        (JSC::JIT::privateCompilePutByValWithCachedId):
     189        * jit/JITPropertyAccess32_64.cpp:
     190        (JSC::JIT::stringGetByValStubGenerator):
     191        * jit/JITStubRoutine.h:
     192        * jit/Repatch.cpp:
     193        (JSC::readCallTarget):
     194        (JSC::appropriateOptimizingPutByIdFunction):
     195        (JSC::linkPolymorphicCall):
     196        (JSC::resetPutByID):
     197        * jit/SlowPathCall.h:
     198        (JSC::JITSlowPathCall::call):
     199        * jit/SpecializedThunkJIT.h:
     200        (JSC::SpecializedThunkJIT::finalize):
     201        (JSC::SpecializedThunkJIT::callDoubleToDouble):
     202        * jit/ThunkGenerators.cpp:
     203        (JSC::throwExceptionFromCallSlowPathGenerator):
     204        (JSC::slowPathFor):
     205        (JSC::linkCallThunkGenerator):
     206        (JSC::linkPolymorphicCallThunkGenerator):
     207        (JSC::virtualThunkFor):
     208        (JSC::nativeForGenerator):
     209        (JSC::arityFixupGenerator):
     210        (JSC::unreachableGenerator):
     211        (JSC::boundThisNoArgsFunctionCallGenerator):
     212        * llint/LLIntThunks.cpp:
     213        (JSC::LLInt::generateThunkWithJumpTo):
     214        (JSC::LLInt::functionForCallEntryThunkGenerator):
     215        (JSC::LLInt::functionForConstructEntryThunkGenerator):
     216        (JSC::LLInt::functionForCallArityCheckThunkGenerator):
     217        (JSC::LLInt::functionForConstructArityCheckThunkGenerator):
     218        (JSC::LLInt::evalEntryThunkGenerator):
     219        (JSC::LLInt::programEntryThunkGenerator):
     220        (JSC::LLInt::moduleProgramEntryThunkGenerator):
     221        * runtime/PtrTag.h:
     222        * wasm/WasmB3IRGenerator.cpp:
     223        (JSC::Wasm::B3IRGenerator::addCall):
     224        (JSC::Wasm::B3IRGenerator::addCallIndirect):
     225        * wasm/WasmBBQPlan.cpp:
     226        (JSC::Wasm::BBQPlan::complete):
     227        * wasm/WasmBinding.cpp:
     228        (JSC::Wasm::wasmToWasm):
     229        * wasm/WasmOMGPlan.cpp:
     230        (JSC::Wasm::OMGPlan::work):
     231        * wasm/WasmThunks.cpp:
     232        (JSC::Wasm::throwExceptionFromWasmThunkGenerator):
     233        (JSC::Wasm::throwStackOverflowFromWasmThunkGenerator):
     234        (JSC::Wasm::triggerOMGTierUpThunkGenerator):
     235        * wasm/js/WasmToJS.cpp:
     236        (JSC::Wasm::handleBadI64Use):
     237        (JSC::Wasm::wasmToJS):
     238        * yarr/YarrJIT.cpp:
     239        (JSC::Yarr::YarrGenerator::loadFromFrameAndJump):
     240        (JSC::Yarr::YarrGenerator::BacktrackingState::linkDataLabels):
     241        (JSC::Yarr::YarrGenerator::generateTryReadUnicodeCharacterHelper):
     242        (JSC::Yarr::YarrGenerator::generateEnter):
     243        (JSC::Yarr::YarrGenerator::YarrGenerator):
     244        (JSC::Yarr::YarrGenerator::compile):
     245        (JSC::Yarr::jitCompile):
     246        * yarr/YarrJIT.h:
     247        (JSC::Yarr::YarrCodeBlock::execute):
     248
    12492018-03-14  Caitlin Potter  <caitp@igalia.com>
    2250
  • trunk/Source/JavaScriptCore/assembler/ARM64Assembler.h

    r228932 r229609  
    3030#include "AssemblerBuffer.h"
    3131#include "AssemblerCommon.h"
     32#include "PtrTag.h"
    3233#include <limits.h>
    3334#include <wtf/Assertions.h>
     
    30343035        ASSERT(!(reinterpret_cast<intptr_t>(from) & 3));
    30353036        ASSERT(!(reinterpret_cast<intptr_t>(to) & 3));
    3036         intptr_t offset = (reinterpret_cast<intptr_t>(to) - reinterpret_cast<intptr_t>(fromInstruction)) >> 2;
     3037        intptr_t offset = (removeCodePtrTag<intptr_t>(to) - removeCodePtrTag<intptr_t>(fromInstruction)) >> 2;
    30373038        ASSERT(static_cast<int>(offset) == offset);
    30383039
  • trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h

    r229547 r229609  
    3535#include "MacroAssemblerHelpers.h"
    3636#include "Options.h"
     37#include "PtrTag.h"
    3738#include <wtf/CryptographicallyRandomNumber.h>
    3839#include <wtf/Noncopyable.h>
     
    872873    }
    873874
    874     static void* getLinkerAddress(void* code, AssemblerLabel label)
    875     {
    876         return AssemblerType::getRelocatedAddress(code, label);
     875    // FIXME: remove the default PtrTag value once we've tagged all the clients.
     876    static void* getLinkerAddress(void* code, AssemblerLabel label, PtrTag tag = NoPtrTag)
     877    {
     878        return tagCodePtr(AssemblerType::getRelocatedAddress(code, label), tag);
    877879    }
    878880
     
    951953        buffer.setCodeSize(targetCodeSize);
    952954    }
     955
     956    ALWAYS_INLINE void tagPtr(RegisterID, PtrTag) { }
     957    ALWAYS_INLINE void tagPtr(RegisterID, RegisterID) { }
     958    ALWAYS_INLINE void untagPtr(RegisterID, PtrTag) { }
     959    ALWAYS_INLINE void untagPtr(RegisterID, RegisterID) { }
     960    ALWAYS_INLINE void removePtrTag(RegisterID) { }
    953961
    954962protected:
  • trunk/Source/JavaScriptCore/assembler/LinkBuffer.cpp

    r225363 r229609  
    11/*
    2  * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4545}
    4646
    47 LinkBuffer::CodeRef LinkBuffer::finalizeCodeWithoutDisassembly()
     47LinkBuffer::CodeRef LinkBuffer::finalizeCodeWithoutDisassembly(PtrTag tag)
    4848{
    4949    performFinalization();
     
    5151    ASSERT(m_didAllocate);
    5252    if (m_executableMemory)
    53         return CodeRef(*m_executableMemory);
    54    
    55     return CodeRef::createSelfManagedCodeRef(MacroAssemblerCodePtr(m_code));
    56 }
    57 
    58 LinkBuffer::CodeRef LinkBuffer::finalizeCodeWithDisassembly(const char* format, ...)
    59 {
    60     CodeRef result = finalizeCodeWithoutDisassembly();
     53        return CodeRef(*m_executableMemory, tag);
     54   
     55    return CodeRef::createSelfManagedCodeRef(MacroAssemblerCodePtr(tagCodePtr(m_code, tag)));
     56}
     57
     58LinkBuffer::CodeRef LinkBuffer::finalizeCodeWithDisassembly(PtrTag tag, const char* format, ...)
     59{
     60    CodeRef result = finalizeCodeWithoutDisassembly(tag);
    6161
    6262    if (m_alreadyDisassembled)
     
    7171    out.printf(":\n");
    7272
    73     out.printf("    Code at [%p, %p):\n", result.code().executableAddress(), result.code().executableAddress<char*>() + result.size());
     73    uint8_t* executableAddress = removeCodePtrTag<uint8_t*>(result.code().executableAddress());
     74    out.printf("    Code at [%p, %p):\n", executableAddress, executableAddress + result.size());
    7475   
    7576    CString header = out.toCString();
  • trunk/Source/JavaScriptCore/assembler/LinkBuffer.h

    r229054 r229609  
    122122    // These methods are used to link or set values at code generation time.
    123123
     124    template<typename Func, typename = std::enable_if_t<std::is_function<typename std::remove_pointer<Func>::type>::value>>
     125    void link(Call call, Func funcName, PtrTag tag)
     126    {
     127        FunctionPtr function(funcName, tag);
     128        link(call, function);
     129    }
     130
    124131    void link(Call call, FunctionPtr function)
    125132    {
     
    176183        ASSERT(call.isFlagSet(Call::Linkable));
    177184        ASSERT(call.isFlagSet(Call::Near));
    178         return CodeLocationNearCall(MacroAssembler::getLinkerAddress(code(), applyOffset(call.m_label)),
     185        return CodeLocationNearCall(MacroAssembler::getLinkerAddress(code(), applyOffset(call.m_label), NearCallPtrTag),
    179186            call.isFlagSet(Call::Tail) ? NearCallMode::Tail : NearCallMode::Regular);
    180187    }
     
    185192    }
    186193
    187     CodeLocationLabel locationOf(Label label)
    188     {
    189         return CodeLocationLabel(MacroAssembler::getLinkerAddress(code(), applyOffset(label.m_label)));
     194    // FIXME: remove the default PtrTag value once we've tagged all the clients.
     195    CodeLocationLabel locationOf(Label label, PtrTag tag = NoPtrTag)
     196    {
     197        return CodeLocationLabel(MacroAssembler::getLinkerAddress(code(), applyOffset(label.m_label), tag));
    190198    }
    191199
     
    233241    // displaying disassembly.
    234242   
    235     JS_EXPORT_PRIVATE CodeRef finalizeCodeWithoutDisassembly();
    236     JS_EXPORT_PRIVATE CodeRef finalizeCodeWithDisassembly(const char* format, ...) WTF_ATTRIBUTE_PRINTF(2, 3);
     243    JS_EXPORT_PRIVATE CodeRef finalizeCodeWithoutDisassembly(PtrTag);
     244    JS_EXPORT_PRIVATE CodeRef finalizeCodeWithDisassembly(PtrTag, const char* format, ...) WTF_ATTRIBUTE_PRINTF(3, 4);
    237245
    238246    CodePtr trampolineAt(Label label)
     
    308316};
    309317
    310 #define FINALIZE_CODE_IF(condition, linkBufferReference, ...)  \
     318#define FINALIZE_CODE_IF(condition, linkBufferReference, resultPtrTag, ...)  \
    311319    (UNLIKELY((condition))                                              \
    312         ? (linkBufferReference).finalizeCodeWithDisassembly(__VA_ARGS__) \
    313         : (linkBufferReference).finalizeCodeWithoutDisassembly())
     320        ? (linkBufferReference).finalizeCodeWithDisassembly(resultPtrTag, __VA_ARGS__) \
     321        : (linkBufferReference).finalizeCodeWithoutDisassembly(resultPtrTag))
    314322
    315323bool shouldDumpDisassemblyFor(CodeBlock*);
    316324
    317 #define FINALIZE_CODE_FOR(codeBlock, linkBufferReference, ...)  \
    318     FINALIZE_CODE_IF((shouldDumpDisassemblyFor(codeBlock) || Options::asyncDisassembly()), linkBufferReference, __VA_ARGS__)
     325#define FINALIZE_CODE_FOR(codeBlock, linkBufferReference, resultPtrTag, ...)  \
     326    FINALIZE_CODE_IF((shouldDumpDisassemblyFor(codeBlock) || Options::asyncDisassembly()), linkBufferReference, resultPtrTag, __VA_ARGS__)
    319327
    320328// Use this to finalize code, like so:
    321329//
    322 // CodeRef code = FINALIZE_CODE(linkBuffer, "my super thingy number %d", number);
     330// CodeRef code = FINALIZE_CODE(linkBuffer, tag, "my super thingy number %d", number);
    323331//
    324332// Which, in disassembly mode, will print:
     
    334342// is true, so you can hide expensive disassembly-only computations inside there.
    335343
    336 #define FINALIZE_CODE(linkBufferReference, ...)  \
    337     FINALIZE_CODE_IF((JSC::Options::asyncDisassembly() || JSC::Options::dumpDisassembly()), linkBufferReference, __VA_ARGS__)
    338 
    339 #define FINALIZE_DFG_CODE(linkBufferReference, ...)  \
    340     FINALIZE_CODE_IF((JSC::Options::asyncDisassembly() || JSC::Options::dumpDisassembly() || Options::dumpDFGDisassembly()), linkBufferReference, __VA_ARGS__)
     344#define FINALIZE_CODE(linkBufferReference, resultPtrTag, ...)  \
     345    FINALIZE_CODE_IF((JSC::Options::asyncDisassembly() || JSC::Options::dumpDisassembly()), linkBufferReference, resultPtrTag, __VA_ARGS__)
     346
     347#define FINALIZE_DFG_CODE(linkBufferReference, resultPtrTag, ...)  \
     348    FINALIZE_CODE_IF((JSC::Options::asyncDisassembly() || JSC::Options::dumpDisassembly() || Options::dumpDFGDisassembly()), linkBufferReference, resultPtrTag, __VA_ARGS__)
    341349
    342350} // namespace JSC
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h

    r229087 r229609  
    790790    }
    791791
    792     void jump(RegisterID target)
     792    void jump(RegisterID target, PtrTag)
    793793    {
    794794        m_assembler.bx(target);
    795795    }
    796796
    797     void jump(Address address)
     797    void jump(Address address, PtrTag)
    798798    {
    799799        load32(address, ARMRegisters::pc);
    800800    }
    801801
    802     void jump(AbsoluteAddress address)
     802    void jump(AbsoluteAddress address, PtrTag)
    803803    {
    804804        move(TrustedImmPtr(address.m_ptr), ARMRegisters::S0);
     
    989989    }
    990990
    991     Call call(RegisterID target)
     991    Call call(RegisterID target, PtrTag)
    992992    {
    993993        return Call(m_assembler.blx(target), Call::None);
    994994    }
    995995
    996     void call(Address address)
     996    void call(Address address, PtrTag)
    997997    {
    998998        call32(address.base, address.offset);
     
    11191119    }
    11201120
    1121     Call call()
     1121    Call call(PtrTag)
    11221122    {
    11231123        ensureSpace(2 * sizeof(ARMWord), sizeof(ARMWord));
     
    15001500    static FunctionPtr readCallTarget(CodeLocationCall call)
    15011501    {
    1502         return FunctionPtr(reinterpret_cast<void(*)()>(ARMAssembler::readCallTarget(call.dataLocation())));
     1502        return FunctionPtr(reinterpret_cast<void(*)()>(ARMAssembler::readCallTarget(call.dataLocation())), CodeEntryPtrTag);
    15031503    }
    15041504
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h

    r229391 r229609  
    30853085    // Jumps, calls, returns
    30863086
    3087     ALWAYS_INLINE Call call()
     3087    ALWAYS_INLINE Call call(PtrTag)
    30883088    {
    30893089        AssemblerLabel pointerLabel = m_assembler.label();
     
    30963096    }
    30973097
    3098     ALWAYS_INLINE Call call(RegisterID target)
     3098    ALWAYS_INLINE Call call(RegisterID target, PtrTag)
    30993099    {
    31003100        invalidateAllTempRegisters();
     
    31033103    }
    31043104
    3105     ALWAYS_INLINE Call call(Address address)
     3105    ALWAYS_INLINE Call call(Address address, PtrTag tag)
    31063106    {
    31073107        load64(address, getCachedDataTempRegisterIDAndInvalidate());
    3108         return call(dataTempRegister);
     3108        return call(dataTempRegister, tag);
    31093109    }
    31103110
     
    31163116    }
    31173117
    3118     void jump(RegisterID target)
     3118    void jump(RegisterID target, PtrTag)
    31193119    {
    31203120        m_assembler.br(target);
    31213121    }
    31223122
    3123     void jump(Address address)
     3123    void jump(Address address, PtrTag)
    31243124    {
    31253125        load64(address, getCachedDataTempRegisterIDAndInvalidate());
     
    31273127    }
    31283128   
    3129     void jump(BaseIndex address)
     3129    void jump(BaseIndex address, PtrTag)
    31303130    {
    31313131        load64(address, getCachedDataTempRegisterIDAndInvalidate());
     
    31333133    }
    31343134
    3135     void jump(AbsoluteAddress address)
     3135    void jump(AbsoluteAddress address, PtrTag)
    31363136    {
    31373137        move(TrustedImmPtr(address.m_ptr), getCachedDataTempRegisterIDAndInvalidate());
     
    37653765    static FunctionPtr readCallTarget(CodeLocationCall call)
    37663766    {
    3767         return FunctionPtr(reinterpret_cast<void(*)()>(Assembler::readCallTarget(call.dataLocation())));
     3767        return FunctionPtr(reinterpret_cast<void(*)()>(Assembler::readCallTarget(call.dataLocation())), CodeEntryPtrTag);
    37683768    }
    37693769
     
    44324432    {
    44334433        if (!call.isFlagSet(Call::Near))
    4434             Assembler::linkPointer(code, call.m_label.labelAtOffset(REPATCH_OFFSET_CALL_TO_POINTER), function.value());
     4434            Assembler::linkPointer(code, call.m_label.labelAtOffset(REPATCH_OFFSET_CALL_TO_POINTER), function.executableAddress());
    44354435        else if (call.isFlagSet(Call::Tail))
    4436             Assembler::linkJump(code, call.m_label, function.value());
     4436            Assembler::linkJump(code, call.m_label, function.executableAddress());
    44374437        else
    4438             Assembler::linkCall(code, call.m_label, function.value());
     4438            Assembler::linkCall(code, call.m_label, function.executableAddress());
    44394439    }
    44404440
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h

    r229087 r229609  
    16001600    }
    16011601
    1602     void jump(RegisterID target)
     1602    void jump(RegisterID target, PtrTag)
    16031603    {
    16041604        m_assembler.bx(target);
     
    16061606
    16071607    // Address is a memory location containing the address to jump to
    1608     void jump(Address address)
     1608    void jump(Address address, PtrTag)
    16091609    {
    16101610        load32(address, dataTempRegister);
     
    16121612    }
    16131613   
    1614     void jump(AbsoluteAddress address)
     1614    void jump(AbsoluteAddress address, PtrTag)
    16151615    {
    16161616        move(TrustedImmPtr(address.m_ptr), dataTempRegister);
     
    17641764        ShiftTypeAndAmount shift(SRType_LSL, scale);
    17651765        m_assembler.add(dataTempRegister, dataTempRegister, index, shift);
    1766         jump(dataTempRegister);
     1766        jump(dataTempRegister, NoPtrTag);
    17671767    }
    17681768
     
    17881788    }
    17891789
    1790     ALWAYS_INLINE Call call()
     1790    ALWAYS_INLINE Call call(PtrTag)
    17911791    {
    17921792        moveFixedWidthEncoding(TrustedImm32(0), dataTempRegister);
     
    17941794    }
    17951795
    1796     ALWAYS_INLINE Call call(RegisterID target)
     1796    ALWAYS_INLINE Call call(RegisterID target, PtrTag)
    17971797    {
    17981798        return Call(m_assembler.blx(target), Call::None);
    17991799    }
    18001800
    1801     ALWAYS_INLINE Call call(Address address)
     1801    ALWAYS_INLINE Call call(Address address, PtrTag)
    18021802    {
    18031803        load32(address, dataTempRegister);
     
    19781978    static FunctionPtr readCallTarget(CodeLocationCall call)
    19791979    {
    1980         return FunctionPtr(reinterpret_cast<void(*)()>(ARMv7Assembler::readCallTarget(call.dataLocation())));
     1980        return FunctionPtr(reinterpret_cast<void(*)()>(ARMv7Assembler::readCallTarget(call.dataLocation())), CodeEntryPtrTag);
    19811981    }
    19821982   
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.cpp

    r225437 r229609  
    11/*
    2  * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3434namespace JSC {
    3535
    36 MacroAssemblerCodePtr MacroAssemblerCodePtr::createLLIntCodePtr(OpcodeID codeId)
     36MacroAssemblerCodePtr MacroAssemblerCodePtr::createLLIntCodePtr(OpcodeID opcodeID)
    3737{
    38     return createFromExecutableAddress(LLInt::getCodePtr(codeId));
     38    ASSERT(opcodeID >= NUMBER_OF_BYTECODE_IDS);
     39    return createFromExecutableAddress(LLInt::getCodePtr(opcodeID));
    3940}
    4041
     
    5758}
    5859
    59 MacroAssemblerCodeRef MacroAssemblerCodeRef::createLLIntCodeRef(OpcodeID codeId)
     60MacroAssemblerCodeRef MacroAssemblerCodeRef::createLLIntCodeRef(OpcodeID opcodeID)
    6061{
    61     return createSelfManagedCodeRef(MacroAssemblerCodePtr::createFromExecutableAddress(LLInt::getCodePtr(codeId)));
     62    return createSelfManagedCodeRef(MacroAssemblerCodePtr::createLLIntCodePtr(opcodeID));
    6263}
    6364
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h

    r229367 r229609  
    2828#include "ExecutableAllocator.h"
    2929#include "JSCPoison.h"
     30#include "PtrTag.h"
    3031#include <wtf/DataLog.h>
    3132#include <wtf/PrintStream.h>
     
    6465    FunctionPtr() { }
    6566
    66     template<typename returnType, typename... Arguments>
    67     FunctionPtr(returnType(*value)(Arguments...))
    68         : m_value(reinterpret_cast<void*>(value))
     67    template<typename ReturnType, typename... Arguments>
     68    FunctionPtr(ReturnType(*value)(Arguments...), PtrTag tag = SlowPathPtrTag)
     69        : m_value(tagCFunctionPtr<void*>(value, tag))
    6970    {
    7071        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
     
    7677#if CALLING_CONVENTION_IS_STDCALL && !OS(WINDOWS)
    7778
    78     template<typename returnType, typename... Arguments>
    79     FunctionPtr(returnType(CDECL *value)(Arguments...))
    80         : m_value(reinterpret_cast<void*>(value))
     79    template<typename ReturnType, typename... Arguments>
     80    FunctionPtr(ReturnType(CDECL *value)(Arguments...), PtrTag tag = SlowPathPtrTag)
     81        : m_value(tagCFunctionPtr<void*>(value, tag))
    8182    {
    8283        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
     
    8889#if COMPILER_SUPPORTS(FASTCALL_CALLING_CONVENTION)
    8990
    90     template<typename returnType, typename... Arguments>
    91     FunctionPtr(returnType(FASTCALL *value)(Arguments...))
    92         : m_value(reinterpret_cast<void*>(value))
     91    template<typename ReturnType, typename... Arguments>
     92    FunctionPtr(ReturnType(FASTCALL *value)(Arguments...), PtrTag tag = SlowPathPtrTag)
     93        : m_value(tagCFunctionPtr<void*>(value, tag))
    9394    {
    9495        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
     
    99100
    100101    template<typename FunctionType>
    101     explicit FunctionPtr(FunctionType* value)
     102    explicit FunctionPtr(FunctionType* value, PtrTag tag = SlowPathPtrTag)
    102103        // Using a C-ctyle cast here to avoid compiler error on RVTC:
    103104        // Error:  #694: reinterpret_cast cannot cast away const or other type qualifiers
    104105        // (I guess on RVTC function pointers have a different constness to GCC/MSVC?)
    105         : m_value((void*)value)
     106        : m_value(tagCodePtr<void*>(value, tag))
    106107    {
    107108        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
     
    114115    {
    115116        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
    116         return m_value;
     117        return removeCodePtrTag(m_value);
    117118    }
    118119    void* executableAddress() const
     
    184185        ASSERT_VALID_CODE_POINTER(m_value.unpoisoned());
    185186    }
    186    
     187
    187188    static MacroAssemblerCodePtr createFromExecutableAddress(void* value)
    188189    {
     
    228229        m_value.assertIsPoisoned();
    229230        ASSERT_VALID_CODE_POINTER(m_value);
    230         return m_value.unpoisoned<T>();
     231        return bitwise_cast<T>(m_value ? removeCodePtrTag(m_value.unpoisoned()) : nullptr);
    231232    }
    232233#endif
     
    316317    }
    317318
    318     MacroAssemblerCodeRef(Ref<ExecutableMemoryHandle>&& executableMemory)
    319         : m_codePtr(executableMemory->start())
     319    MacroAssemblerCodeRef(Ref<ExecutableMemoryHandle>&& executableMemory, PtrTag tag)
     320        : m_codePtr(tagCodePtr(executableMemory->start(), tag))
    320321        , m_executableMemory(WTFMove(executableMemory))
    321322    {
     
    345346        return m_codePtr;
    346347    }
    347    
     348
     349    MacroAssemblerCodePtr retaggedCode(PtrTag oldTag, PtrTag newTag) const
     350    {
     351        return MacroAssemblerCodePtr(retagCodePtr(m_codePtr.executableAddress(), oldTag, newTag));
     352    }
     353
    348354    size_t size() const
    349355    {
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h

    r229087 r229609  
    17571757    }
    17581758
    1759     void jump(RegisterID target)
     1759    void jump(RegisterID target, PtrTag)
    17601760    {
    17611761        move(target, MIPSRegisters::t9);
     
    17641764    }
    17651765
    1766     void jump(Address address)
     1766    void jump(Address address, PtrTag)
    17671767    {
    17681768        m_fixedWidth = true;
     
    17731773    }
    17741774
    1775     void jump(AbsoluteAddress address)
     1775    void jump(AbsoluteAddress address, PtrTag)
    17761776    {
    17771777        m_fixedWidth = true;
     
    22512251    }
    22522252
    2253     Call call()
     2253    Call call(PtrTag)
    22542254    {
    22552255        m_assembler.lui(MIPSRegisters::t9, 0);
     
    22602260    }
    22612261
    2262     Call call(RegisterID target)
     2262    Call call(RegisterID target, PtrTag)
    22632263    {
    22642264        move(target, MIPSRegisters::t9);
     
    22682268    }
    22692269
    2270     Call call(Address address)
     2270    Call call(Address address, PtrTag)
    22712271    {
    22722272        m_fixedWidth = true;
     
    30793079    static FunctionPtr readCallTarget(CodeLocationCall call)
    30803080    {
    3081         return FunctionPtr(reinterpret_cast<void(*)()>(MIPSAssembler::readCallTarget(call.dataLocation())));
     3081        return FunctionPtr(reinterpret_cast<void(*)()>(MIPSAssembler::readCallTarget(call.dataLocation())), CodeEntryPtrTag);
    30823082    }
    30833083
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86.h

    r229391 r229609  
    11/*
    2  * Copyright (C) 2008, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    214214    }
    215215
    216     Call call()
     216    Call call(PtrTag)
    217217    {
    218218        return Call(m_assembler.call(), Call::Linkable);
     
    220220
    221221    // Address is a memory location containing the address to jump to
    222     void jump(AbsoluteAddress address)
     222    void jump(AbsoluteAddress address, PtrTag)
    223223    {
    224224        m_assembler.jmp_m(address.m_ptr);
     
    299299    {
    300300        intptr_t offset = reinterpret_cast<int32_t*>(call.dataLocation())[-1];
    301         return FunctionPtr(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(call.dataLocation()) + offset));
     301        return FunctionPtr(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(call.dataLocation()) + offset), CodeEntryPtrTag);
    302302    }
    303303
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp

    r221032 r229609  
    11/*
    2  * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    754754    push(RegisterID::ebx);
    755755    move(TrustedImmPtr(arg), RegisterID::ebx);
    756     call(RegisterID::eax);
     756    call(RegisterID::eax, CFunctionPtrTag);
    757757}
    758758#endif // ENABLE(MASM_PROBE)
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h

    r229391 r229609  
    26972697    }
    26982698
    2699     void jump(RegisterID target)
     2699    void jump(RegisterID target, PtrTag)
    27002700    {
    27012701        m_assembler.jmp_r(target);
     
    27032703
    27042704    // Address is a memory location containing the address to jump to
    2705     void jump(Address address)
     2705    void jump(Address address, PtrTag)
    27062706    {
    27072707        m_assembler.jmp_m(address.offset, address.base);
     
    27092709
    27102710    // Address is a memory location containing the address to jump to
    2711     void jump(BaseIndex address)
     2711    void jump(BaseIndex address, PtrTag)
    27122712    {
    27132713        m_assembler.jmp_m(address.offset, address.base, address.index, address.scale);
     
    28952895    }
    28962896
    2897     Call call(RegisterID target)
     2897    Call call(RegisterID target, PtrTag)
    28982898    {
    28992899        return Call(m_assembler.call(target), Call::None);
    29002900    }
    29012901
    2902     void call(Address address)
     2902    void call(Address address, PtrTag)
    29032903    {
    29042904        m_assembler.call_m(address.offset, address.base);
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h

    r229087 r229609  
    191191#endif
    192192
    193     Call call()
     193    Call call(PtrTag)
    194194    {
    195195#if OS(WINDOWS)
     
    225225
    226226    // Address is a memory location containing the address to jump to
    227     void jump(AbsoluteAddress address)
     227    void jump(AbsoluteAddress address, PtrTag tag)
    228228    {
    229229        move(TrustedImmPtr(address.m_ptr), scratchRegister());
    230         jump(Address(scratchRegister()));
     230        jump(Address(scratchRegister()), tag);
    231231    }
    232232
     
    18711871    static FunctionPtr readCallTarget(CodeLocationCall call)
    18721872    {
    1873         return FunctionPtr(X86Assembler::readPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation()));
     1873        return FunctionPtr(X86Assembler::readPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation()), CodeEntryPtrTag);
    18741874    }
    18751875
  • trunk/Source/JavaScriptCore/assembler/testmasm.cpp

    r229476 r229609  
    150150    generate(jit);
    151151    LinkBuffer linkBuffer(jit, nullptr);
    152     return FINALIZE_CODE(linkBuffer, "testmasm compilation");
     152    return FINALIZE_CODE(linkBuffer, JITCodePtrTag, "testmasm compilation");
    153153}
    154154
     
    156156T invoke(MacroAssemblerCodeRef code, Arguments... arguments)
    157157{
    158     T (*function)(Arguments...) = bitwise_cast<T(*)(Arguments...)>(code.code().executableAddress());
     158    void* executableAddress = untagCFunctionPtr(code.code().executableAddress(), JITCodePtrTag);
     159    T (*function)(Arguments...) = bitwise_cast<T(*)(Arguments...)>(executableAddress);
    159160    return function(arguments...);
    160161}
  • trunk/Source/JavaScriptCore/b3/B3Compile.cpp

    r229054 r229609  
    4949    LinkBuffer linkBuffer(jit, nullptr);
    5050
    51     return Compilation(FINALIZE_CODE(linkBuffer, "B3::Compilation"), proc.releaseByproducts());
     51    return Compilation(FINALIZE_CODE(linkBuffer, JITCodePtrTag, "B3::Compilation"), proc.releaseByproducts());
    5252}
    5353
  • trunk/Source/JavaScriptCore/b3/B3LowerMacros.cpp

    r227527 r229609  
    512512                        jit.load64(CCallHelpers::BaseIndex(scratch, index, CCallHelpers::timesPtr()), scratch);
    513513                        jit.xor64(poisonScratch, scratch);
    514                         jit.jump(scratch);
     514                        jit.jump(scratch, NoPtrTag);
    515515
    516516                        // These labels are guaranteed to be populated before either late paths or
  • trunk/Source/JavaScriptCore/b3/air/AirCCallSpecial.cpp

    r216306 r229609  
    11/*
    2  * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    135135    case Arg::BigImm:
    136136        jit.move(inst.args[calleeArgOffset].asTrustedImmPtr(), scratchRegister);
    137         jit.call(scratchRegister);
     137        jit.call(scratchRegister, NoPtrTag);
    138138        break;
    139139    case Arg::Tmp:
    140         jit.call(inst.args[calleeArgOffset].gpr());
     140        jit.call(inst.args[calleeArgOffset].gpr(), NoPtrTag);
    141141        break;
    142142    case Arg::Addr:
    143143    case Arg::ExtendedOffsetAddr:
    144         jit.call(inst.args[calleeArgOffset].asAddress());
     144        jit.call(inst.args[calleeArgOffset].asAddress(), NoPtrTag);
    145145        break;
    146146    default:
  • trunk/Source/JavaScriptCore/b3/air/testair.cpp

    r229054 r229609  
    9191
    9292    return std::make_unique<B3::Compilation>(
    93         FINALIZE_CODE(linkBuffer, "testair compilation"), proc.releaseByproducts());
     93        FINALIZE_CODE(linkBuffer, JITCodePtrTag, "testair compilation"), proc.releaseByproducts());
    9494}
    9595
     
    9797T invoke(const B3::Compilation& code, Arguments... arguments)
    9898{
    99     T (*function)(Arguments...) = bitwise_cast<T(*)(Arguments...)>(code.code().executableAddress());
     99    void* executableAddress = untagCFunctionPtr(code.code().executableAddress(), JITCodePtrTag);
     100    T (*function)(Arguments...) = bitwise_cast<T(*)(Arguments...)>(executableAddress);
    100101    return function(arguments...);
    101102}
  • trunk/Source/JavaScriptCore/b3/testb3.cpp

    r229517 r229609  
    128128T invoke(MacroAssemblerCodePtr ptr, Arguments... arguments)
    129129{
    130     T (*function)(Arguments...) = bitwise_cast<T(*)(Arguments...)>(ptr.executableAddress());
     130    void* executableAddress = untagCFunctionPtr(ptr.executableAddress(), JITCodePtrTag);
     131    T (*function)(Arguments...) = bitwise_cast<T(*)(Arguments...)>(executableAddress);
    131132    return function(arguments...);
    132133}
     
    1304313044            jit.load64(CCallHelpers::BaseIndex(scratch, params[0].gpr(), CCallHelpers::timesPtr()), scratch);
    1304413045            jit.xor64(poisonScratch, scratch);
    13045             jit.jump(scratch);
     13046            jit.jump(scratch, NoPtrTag);
    1304613047
    1304713048            jit.addLinkTask(
    1304813049                [&, jumpTable, labels] (LinkBuffer& linkBuffer) {
    1304913050                    for (unsigned i = labels.size(); i--;)
    13050                         jumpTable[i] = linkBuffer.locationOf(*labels[i]);
     13051                        jumpTable[i] = linkBuffer.locationOf(*labels[i], NoPtrTag);
    1305113052                });
    1305213053        });
     
    1329713298    generate(proc, jit);
    1329813299    LinkBuffer linkBuffer(jit, nullptr);
    13299     CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0));
    13300     CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1));
    13301     CodeLocationLabel labelThree = linkBuffer.locationOf(proc.entrypointLabel(2));
    13302    
    13303     MacroAssemblerCodeRef codeRef = FINALIZE_CODE(linkBuffer, "testb3 compilation");
    13304    
     13300    CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0), JITCodePtrTag);
     13301    CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1), JITCodePtrTag);
     13302    CodeLocationLabel labelThree = linkBuffer.locationOf(proc.entrypointLabel(2), JITCodePtrTag);
     13303
     13304    MacroAssemblerCodeRef codeRef = FINALIZE_CODE(linkBuffer, JITCodePtrTag, "testb3 compilation");
     13305
    1330513306    CHECK(invoke<int>(labelOne, 1, 2) == 3);
    1330613307    CHECK(invoke<int>(labelTwo, 1, 2) == -1);
     
    1333013331    generate(proc, jit);
    1333113332    LinkBuffer linkBuffer(jit, nullptr);
    13332     CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0));
    13333     CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1));
    13334     CodeLocationLabel labelThree = linkBuffer.locationOf(proc.entrypointLabel(2));
    13335    
    13336     MacroAssemblerCodeRef codeRef = FINALIZE_CODE(linkBuffer, "testb3 compilation");
    13337    
     13333    CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0), JITCodePtrTag);
     13334    CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1), JITCodePtrTag);
     13335    CodeLocationLabel labelThree = linkBuffer.locationOf(proc.entrypointLabel(2), JITCodePtrTag);
     13336
     13337    MacroAssemblerCodeRef codeRef = FINALIZE_CODE(linkBuffer, JITCodePtrTag, "testb3 compilation");
     13338
    1333813339    CHECK_EQ(invoke<int>(labelOne, 1, 2), 3);
    1333913340    CHECK_EQ(invoke<int>(labelTwo, 1, 2), 3);
     
    1341713418    generate(proc, jit);
    1341813419    LinkBuffer linkBuffer(jit, nullptr);
    13419     CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0));
    13420     CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1));
    13421     CodeLocationLabel labelThree = linkBuffer.locationOf(proc.entrypointLabel(2));
    13422    
    13423     MacroAssemblerCodeRef codeRef = FINALIZE_CODE(linkBuffer, "testb3 compilation");
    13424    
     13420    CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0), JITCodePtrTag);
     13421    CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1), JITCodePtrTag);
     13422    CodeLocationLabel labelThree = linkBuffer.locationOf(proc.entrypointLabel(2), JITCodePtrTag);
     13423
     13424    MacroAssemblerCodeRef codeRef = FINALIZE_CODE(linkBuffer, JITCodePtrTag, "testb3 compilation");
     13425
    1342513426    CHECK_EQ(invoke<int>(labelOne, 1, 2, 10), 3);
    1342613427    CHECK_EQ(invoke<int>(labelTwo, 1, 2, 10), -1);
     
    1353413535    generate(proc, jit);
    1353513536    LinkBuffer linkBuffer(jit, nullptr);
    13536     CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0));
    13537     CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1));
    13538     CodeLocationLabel labelThree = linkBuffer.locationOf(proc.entrypointLabel(2));
    13539    
    13540     MacroAssemblerCodeRef codeRef = FINALIZE_CODE(linkBuffer, "testb3 compilation");
    13541    
     13537    CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0), JITCodePtrTag);
     13538    CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1), JITCodePtrTag);
     13539    CodeLocationLabel labelThree = linkBuffer.locationOf(proc.entrypointLabel(2), JITCodePtrTag);
     13540
     13541    MacroAssemblerCodeRef codeRef = FINALIZE_CODE(linkBuffer, JITCodePtrTag, "testb3 compilation");
     13542
    1354213543    CHECK_EQ(invoke<int>(labelOne, 1, 2, 10, false), 3);
    1354313544    CHECK_EQ(invoke<int>(labelTwo, 1, 2, 10, false), -1);
     
    1361213613    generate(proc, jit);
    1361313614    LinkBuffer linkBuffer(jit, nullptr);
    13614     CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0));
    13615     CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1));
    13616    
    13617     MacroAssemblerCodeRef codeRef = FINALIZE_CODE(linkBuffer, "testb3 compilation");
     13615    CodeLocationLabel labelOne = linkBuffer.locationOf(proc.entrypointLabel(0), JITCodePtrTag);
     13616    CodeLocationLabel labelTwo = linkBuffer.locationOf(proc.entrypointLabel(1), JITCodePtrTag);
     13617
     13618    MacroAssemblerCodeRef codeRef = FINALIZE_CODE(linkBuffer, JITCodePtrTag, "testb3 compilation");
    1361813619
    1361913620    CHECK(invoke<int>(labelOne, 0) == 1);
  • trunk/Source/JavaScriptCore/bytecode/AccessCase.cpp

    r229518 r229609  
    864864            jit.storePtr(GPRInfo::callFrameRegister, &vm.topCallFrame);
    865865
    866             operationCall = jit.call();
     866            operationCall = jit.call(NoPtrTag);
    867867            jit.addLinkTask([=] (LinkBuffer& linkBuffer) {
    868868                linkBuffer.link(operationCall, FunctionPtr(this->as<GetterSetterAccessCase>().m_customAccessor.opaque));
     
    10081008                    jit.setupArguments<decltype(operationReallocateButterflyToHavePropertyStorageWithInitialCapacity)>(baseGPR);
    10091009                   
    1010                     CCallHelpers::Call operationCall = jit.call();
     1010                    CCallHelpers::Call operationCall = jit.call(NoPtrTag);
    10111011                    jit.addLinkTask([=] (LinkBuffer& linkBuffer) {
    10121012                        linkBuffer.link(
     
    10201020                        baseGPR, CCallHelpers::TrustedImm32(newSize / sizeof(JSValue)));
    10211021                   
    1022                     CCallHelpers::Call operationCall = jit.call();
     1022                    CCallHelpers::Call operationCall = jit.call(NoPtrTag);
    10231023                    jit.addLinkTask([=] (LinkBuffer& linkBuffer) {
    10241024                        linkBuffer.link(
  • trunk/Source/JavaScriptCore/bytecode/AccessCaseSnippetParams.cpp

    r229391 r229609  
    6262        jit.setupArguments<FunctionType>(std::get<ArgumentsIndex>(m_arguments)...);
    6363
    64         CCallHelpers::Call operationCall = jit.call();
     64        CCallHelpers::Call operationCall = jit.call(NoPtrTag);
    6565        auto function = m_function;
    6666        jit.addLinkTask([=] (LinkBuffer& linkBuffer) {
  • trunk/Source/JavaScriptCore/bytecode/InlineAccess.cpp

    r229054 r229609  
    136136        ASSERT(linkBuffer.isValid());
    137137        function(linkBuffer);
    138         FINALIZE_CODE(linkBuffer, "InlineAccessType: '%s'", name);
     138        FINALIZE_CODE(linkBuffer, JITCodePtrTag, "InlineAccessType: '%s'", name);
    139139        return true;
    140140    }
     
    291291    linkBuffer.link(jump, target);
    292292
    293     FINALIZE_CODE(linkBuffer, "InlineAccess: linking constant jump");
     293    FINALIZE_CODE(linkBuffer, JITCodePtrTag, "InlineAccess: linking constant jump");
    294294}
    295295
  • trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp

    r229391 r229609  
    200200    } else {
    201201        jit->setupArguments<decltype(lookupExceptionHandler)>(CCallHelpers::TrustedImmPtr(&m_vm), GPRInfo::callFrameRegister);
    202         CCallHelpers::Call lookupExceptionHandlerCall = jit->call();
     202        CCallHelpers::Call lookupExceptionHandlerCall = jit->call(NoPtrTag);
    203203        jit->addLinkTask(
    204204            [=] (LinkBuffer& linkBuffer) {
    205                 linkBuffer.link(lookupExceptionHandlerCall, lookupExceptionHandler);
     205                linkBuffer.link(lookupExceptionHandlerCall, lookupExceptionHandler, NoPtrTag);
    206206            });
    207207        jit->jumpToExceptionHandler(m_vm);
     
    539539
    540540                HandlerInfo handlerToRegister = oldHandler;
    541                 handlerToRegister.nativeCode = linkBuffer.locationOf(makeshiftCatchHandler);
     541                handlerToRegister.nativeCode = linkBuffer.locationOf(makeshiftCatchHandler, NoPtrTag);
    542542                handlerToRegister.start = newExceptionHandlingCallSite.bits();
    543543                handlerToRegister.end = newExceptionHandlingCallSite.bits() + 1;
     
    569569
    570570    MacroAssemblerCodeRef code = FINALIZE_CODE_FOR(
    571         codeBlock, linkBuffer,
     571        codeBlock, linkBuffer, NoPtrTag,
    572572        "%s", toCString("Access stub for ", *codeBlock, " ", stubInfo.codeOrigin, " with return point ", successLabel, ": ", listDump(cases)).data());
    573573
  • trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp

    r229444 r229609  
    162162        poke(GPRInfo::argumentGPR1, 1);
    163163#endif
    164         m_calls.append(CallLinkRecord(call(), lookupExceptionHandlerFromCallerFrame));
     164        m_calls.append(CallLinkRecord(call(NoPtrTag), lookupExceptionHandlerFromCallerFrame));
    165165
    166166        jumpToExceptionHandler(*vm());
     
    181181        poke(GPRInfo::argumentGPR1, 1);
    182182#endif
    183         m_calls.append(CallLinkRecord(call(), lookupExceptionHandler));
     183        m_calls.append(CallLinkRecord(call(NoPtrTag), lookupExceptionHandler));
    184184
    185185        jumpToExceptionHandler(*vm());
     
    215215        usedJumpTables.set(data.switchTableIndex);
    216216        SimpleJumpTable& table = m_codeBlock->switchJumpTable(data.switchTableIndex);
    217         table.ctiDefault = linkBuffer.locationOf(m_blockHeads[data.fallThrough.block->index]);
     217        table.ctiDefault = linkBuffer.locationOf(m_blockHeads[data.fallThrough.block->index], NoPtrTag);
    218218        table.ctiOffsets.grow(table.branchOffsets.size());
    219219        for (unsigned j = table.ctiOffsets.size(); j--;)
     
    222222            SwitchCase& myCase = data.cases[j];
    223223            table.ctiOffsets[myCase.value.switchLookupValue(data.kind) - table.min] =
    224                 linkBuffer.locationOf(m_blockHeads[myCase.target.block->index]);
     224                linkBuffer.locationOf(m_blockHeads[myCase.target.block->index], NoPtrTag);
    225225        }
    226226    }
     
    245245       
    246246        StringJumpTable& table = m_codeBlock->stringSwitchJumpTable(data.switchTableIndex);
    247         table.ctiDefault = linkBuffer.locationOf(m_blockHeads[data.fallThrough.block->index]);
     247        table.ctiDefault = linkBuffer.locationOf(m_blockHeads[data.fallThrough.block->index], NoPtrTag);
    248248        StringJumpTable::StringOffsetTable::iterator iter;
    249249        StringJumpTable::StringOffsetTable::iterator end = table.offsetTable.end();
     
    254254            iter = table.offsetTable.find(myCase.value.stringImpl());
    255255            RELEASE_ASSERT(iter != end);
    256             iter->value.ctiOffset = linkBuffer.locationOf(m_blockHeads[myCase.target.block->index]);
     256            iter->value.ctiOffset = linkBuffer.locationOf(m_blockHeads[myCase.target.block->index], NoPtrTag);
    257257        }
    258258    }
     
    276276
    277277        ptrdiff_t inlineSize = MacroAssembler::differenceBetweenCodePtr(
    278             start, linkBuffer.locationOf(m_ins[i].m_done));
     278            start, linkBuffer.locationOf(m_ins[i].m_done, NoPtrTag));
    279279        RELEASE_ASSERT(inlineSize >= 0);
    280280        info.patch.inlineSize = inlineSize;
     
    284284
    285285        info.patch.deltaFromStartToSlowPathStart = MacroAssembler::differenceBetweenCodePtr(
    286             start, linkBuffer.locationOf(m_ins[i].m_slowPathGenerator->label()));
     286            start, linkBuffer.locationOf(m_ins[i].m_slowPathGenerator->label(), NoPtrTag));
    287287    }
    288288   
     
    298298    for (JSDirectCallRecord& record : m_jsDirectCalls) {
    299299        CallLinkInfo& info = *record.info;
    300         linkBuffer.link(record.call, linkBuffer.locationOf(record.slowPath));
     300        linkBuffer.link(record.call, linkBuffer.locationOf(record.slowPath, NoPtrTag));
    301301        info.setCallLocations(
    302302            CodeLocationLabel(),
    303             linkBuffer.locationOf(record.slowPath),
     303            linkBuffer.locationOf(record.slowPath, NoPtrTag),
    304304            linkBuffer.locationOfNearCall(record.call));
    305305    }
     
    309309        info.setCallLocations(
    310310            linkBuffer.locationOf(record.patchableJump),
    311             linkBuffer.locationOf(record.slowPath),
     311            linkBuffer.locationOf(record.slowPath, NoPtrTag),
    312312            linkBuffer.locationOfNearCall(record.call));
    313313    }
     
    324324        if (info.m_replacementSource.isSet()) {
    325325            m_jitCode->common.jumpReplacements.append(JumpReplacement(
    326                 linkBuffer.locationOf(info.m_replacementSource),
    327                 linkBuffer.locationOf(info.m_replacementDestination)));
     326                linkBuffer.locationOf(info.m_replacementSource, NoPtrTag),
     327                linkBuffer.locationOf(info.m_replacementDestination, NoPtrTag)));
    328328        }
    329329    }
     
    335335            Vector<const void*> addresses;
    336336            for (unsigned j = 0; j < labels.size(); ++j)
    337                 addresses.append(linkBuffer.locationOf(labels[j]).executableAddress());
     337                addresses.append(linkBuffer.locationOf(labels[j], NoPtrTag).executableAddress());
    338338            m_graph.compilation()->addOSRExitSite(addresses);
    339339        }
     
    352352            // If this *is set*, it means we will be landing at this code location from genericUnwind from an
    353353            // exception thrown in a child call frame.
    354             CodeLocationLabel catchLabel = linkBuffer.locationOf(info.m_replacementDestination);
     354            CodeLocationLabel catchLabel = linkBuffer.locationOf(info.m_replacementDestination, NoPtrTag);
    355355            HandlerInfo newExceptionHandler = m_exceptionHandlerOSRExitCallSites[i].baselineExceptionHandler;
    356356            CallSiteIndex callSite = m_exceptionHandlerOSRExitCallSites[i].callSiteIndex;
     
    505505    emitStoreCodeOrigin(CodeOrigin(0));
    506506    move(GPRInfo::returnValueGPR, GPRInfo::argumentGPR0);
    507     m_callArityFixup = call();
     507    m_callArityFixup = call(NoPtrTag);
    508508    jump(fromArityCheck);
    509509   
     
    535535    disassemble(*linkBuffer);
    536536
    537     MacroAssemblerCodePtr withArityCheck = linkBuffer->locationOf(m_arityCheck);
     537    MacroAssemblerCodePtr withArityCheck = linkBuffer->locationOf(m_arityCheck, NoPtrTag);
    538538
    539539    m_graph.m_plan.finalizer = std::make_unique<JITFinalizer>(
     
    575575    RELEASE_ASSERT(basicBlock.isCatchEntrypoint);
    576576    RELEASE_ASSERT(basicBlock.intersectionOfCFAHasVisited); // An entrypoint is reachable by definition.
    577     m_jitCode->common.appendCatchEntrypoint(basicBlock.bytecodeBegin, linkBuffer.locationOf(blockHead).executableAddress(), WTFMove(argumentFormats));
     577    m_jitCode->common.appendCatchEntrypoint(basicBlock.bytecodeBegin, linkBuffer.locationOf(blockHead, NoPtrTag).executableAddress(), WTFMove(argumentFormats));
    578578}
    579579
  • trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.h

    r221196 r229609  
    159159    Call appendCall(const FunctionPtr& function)
    160160    {
    161         Call functionCall = call();
     161        Call functionCall = call(NoPtrTag);
    162162        m_calls.append(CallLinkRecord(functionCall, function));
    163163        return functionCall;
  • trunk/Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp

    r229054 r229609  
    11/*
    2  * Copyright (C) 2013, 2015-2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5858{
    5959    m_jitCode->initializeCodeRef(
    60         FINALIZE_DFG_CODE(*m_linkBuffer, "DFG JIT code for %s", toCString(CodeBlockWithJITType(m_plan.codeBlock, JITCode::DFGJIT)).data()),
     60        FINALIZE_DFG_CODE(*m_linkBuffer, NoPtrTag, "DFG JIT code for %s", toCString(CodeBlockWithJITType(m_plan.codeBlock, JITCode::DFGJIT)).data()),
    6161        MacroAssemblerCodePtr());
    6262   
     
    7272    RELEASE_ASSERT(!m_withArityCheck.isEmptyValue());
    7373    m_jitCode->initializeCodeRef(
    74         FINALIZE_DFG_CODE(*m_linkBuffer, "DFG JIT code for %s", toCString(CodeBlockWithJITType(m_plan.codeBlock, JITCode::DFGJIT)).data()),
     74        FINALIZE_DFG_CODE(*m_linkBuffer, NoPtrTag, "DFG JIT code for %s", toCString(CodeBlockWithJITType(m_plan.codeBlock, JITCode::DFGJIT)).data()),
    7575        m_withArityCheck);
    7676    m_plan.codeBlock->setJITCode(m_jitCode.copyRef());
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExit.cpp

    r229391 r229609  
    10011001            break;
    10021002        }
    1003         jit.call(GPRInfo::nonArgGPR0);
     1003        jit.call(GPRInfo::nonArgGPR0, NoPtrTag);
    10041004        jit.storeCell(GPRInfo::returnValueGPR, AssemblyHelpers::addressFor(operand));
    10051005
     
    10701070        exit.m_code = FINALIZE_CODE_IF(
    10711071            shouldDumpDisassembly() || Options::verboseOSR() || Options::verboseDFGOSRExit(),
    1072             patchBuffer,
     1072            patchBuffer, NoPtrTag,
    10731073            "DFG OSR exit #%u (%s, %s) from %s, with operands = %s",
    10741074                exitIndex, toCString(exit.m_codeOrigin).data(),
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompilerCommon.cpp

    r229391 r229609  
    111111#endif
    112112    jit.move(AssemblyHelpers::TrustedImmPtr(bitwise_cast<void*>(triggerReoptimizationNow)), GPRInfo::nonArgGPR0);
    113     jit.call(GPRInfo::nonArgGPR0);
     113    jit.call(GPRInfo::nonArgGPR0, NoPtrTag);
    114114    AssemblyHelpers::Jump doneAdjusting = jit.jump();
    115115   
     
    264264    jit.setupArguments<decltype(operationOSRWriteBarrier)>(owner);
    265265    jit.move(MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(operationOSRWriteBarrier)), scratch);
    266     jit.call(scratch);
     266    jit.call(scratch, NoPtrTag);
    267267
    268268#if CPU(X86)
     
    319319   
    320320    jit.move(AssemblyHelpers::TrustedImmPtr(jumpTarget), GPRInfo::regT2);
    321     jit.jump(GPRInfo::regT2);
     321    jit.jump(GPRInfo::regT2, NoPtrTag);
    322322}
    323323
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r229545 r229609  
    98909890    m_jit.xor64(poisonScratch, scratch);
    98919891#endif
    9892     m_jit.jump(scratch);
     9892    m_jit.jump(scratch, NoPtrTag);
    98939893    data->didUseJumpTable = true;
    98949894}
     
    99289928        callOperation(operationFindSwitchImmTargetForDouble, scratch, valueRegs.gpr(), data->switchTableIndex);
    99299929        silentFillAllRegisters();
    9930         m_jit.jump(scratch);
     9930        m_jit.jump(scratch, NoPtrTag);
    99319931#else
    99329932        JITCompiler::Jump notInt = m_jit.branch32(
     
    99439943        silentFillAllRegisters();
    99449944
    9945         m_jit.jump(scratch);
     9945        m_jit.jump(scratch, NoPtrTag);
    99469946#endif
    99479947        noResult(node, UseChildrenCalledExplicitly);
     
    1020710207            operationSwitchString, string, static_cast<size_t>(data->switchTableIndex), string);
    1020810208        m_jit.exceptionCheck();
    10209         m_jit.jump(string);
     10209        m_jit.jump(string, NoPtrTag);
    1021010210        return;
    1021110211    }
     
    1024510245    silentFillAllRegisters();
    1024610246    m_jit.exceptionCheck();
    10247     m_jit.jump(string);
     10247    m_jit.jump(string, NoPtrTag);
    1024810248}
    1024910249
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r229514 r229609  
    56835683            }
    56845684            m_jit.emitRestoreCalleeSaves();
    5685             m_jit.jump(tempGPR);
     5685            m_jit.jump(tempGPR, NoPtrTag);
    56865686        });
    56875687        break;
  • trunk/Source/JavaScriptCore/dfg/DFGThunks.cpp

    r229087 r229609  
    4646    jit.probe(OSRExit::executeOSRExit, vm);
    4747    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    48     return FINALIZE_CODE(patchBuffer, "DFG OSR exit thunk");
     48    return FINALIZE_CODE(patchBuffer, NoPtrTag, "DFG OSR exit thunk");
    4949}
    5050
     
    8383#endif
    8484
    85     MacroAssembler::Call functionCall = jit.call();
     85    MacroAssembler::Call functionCall = jit.call(NoPtrTag);
    8686
    8787    jit.move(MacroAssembler::TrustedImmPtr(scratchBuffer->addressOfActiveLength()), GPRInfo::regT0);
     
    9999#endif
    100100    }
    101    
    102     jit.jump(MacroAssembler::AbsoluteAddress(&vm->osrExitJumpDestination));
    103    
     101
     102    jit.jump(MacroAssembler::AbsoluteAddress(&vm->osrExitJumpDestination), NoPtrTag);
     103
    104104    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    105105   
    106     patchBuffer.link(functionCall, OSRExit::compileOSRExit);
     106    patchBuffer.link(functionCall, OSRExit::compileOSRExit, NoPtrTag);
    107107   
    108     return FINALIZE_CODE(patchBuffer, "DFG OSR exit generation thunk");
     108    return FINALIZE_CODE(patchBuffer, NoPtrTag, "DFG OSR exit generation thunk");
    109109}
    110110
     
    144144    jit.emitMaterializeTagCheckRegisters();
    145145
    146     jit.jump(GPRInfo::regT1);
     146    jit.jump(GPRInfo::regT1, NoPtrTag);
    147147   
    148148    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    149     return FINALIZE_CODE(patchBuffer, "DFG OSR entry thunk");
     149    return FINALIZE_CODE(patchBuffer, NoPtrTag, "DFG OSR entry thunk");
    150150}
    151151
  • trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp

    r225524 r229609  
    135135    jit.move(MacroAssembler::TrustedImmPtr(&vm), GPRInfo::argumentGPR0);
    136136    jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1);
    137     CCallHelpers::Call call = jit.call();
     137    CCallHelpers::Call call = jit.call(NoPtrTag);
    138138    jit.jumpToExceptionHandler(vm);
    139139    jit.addLinkTask(
  • trunk/Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp

    r229054 r229609  
    7676    jitCode->initializeB3Code(
    7777        FINALIZE_CODE_IF(
    78             dumpDisassembly, *b3CodeLinkBuffer,
     78            dumpDisassembly, *b3CodeLinkBuffer, CodeEntryPtrTag,
    7979            "FTL B3 code for %s", toCString(CodeBlockWithJITType(m_plan.codeBlock, JITCode::FTLJIT)).data()));
    8080
     
    8282        jitCode->initializeArityCheckEntrypoint(
    8383            FINALIZE_CODE_IF(
    84                 dumpDisassembly, *entrypointLinkBuffer,
     84                dumpDisassembly, *entrypointLinkBuffer, CodeEntryWithArityCheckPtrTag,
    8585                "FTL entrypoint thunk for %s with B3 generated code at %p", toCString(CodeBlockWithJITType(m_plan.codeBlock, JITCode::FTLJIT)).data(), function));
    8686    }
  • trunk/Source/JavaScriptCore/ftl/FTLLazySlowPath.cpp

    r229054 r229609  
    6868    if (m_exceptionTarget)
    6969        linkBuffer.link(exceptionJumps, m_exceptionTarget);
    70     m_stub = FINALIZE_CODE_FOR(codeBlock, linkBuffer, "Lazy slow path call stub");
     70    m_stub = FINALIZE_CODE_FOR(codeBlock, linkBuffer, NoPtrTag, "Lazy slow path call stub");
    7171
    7272    MacroAssembler::repatchJump(m_patchableJump, CodeLocationLabel(m_stub.code()));
  • trunk/Source/JavaScriptCore/ftl/FTLLink.cpp

    r225363 r229609  
    141141            jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
    142142            jit.storePtr(GPRInfo::callFrameRegister, &vm.topCallFrame);
    143             CCallHelpers::Call callArityCheck = jit.call();
     143            CCallHelpers::Call callArityCheck = jit.call(NoPtrTag);
    144144
    145145            auto noException = jit.branch32(CCallHelpers::GreaterThanOrEqual, GPRInfo::returnValueGPR, CCallHelpers::TrustedImm32(0));
     
    147147            jit.move(CCallHelpers::TrustedImmPtr(&vm), GPRInfo::argumentGPR0);
    148148            jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1);
    149             CCallHelpers::Call callLookupExceptionHandlerFromCallerFrame = jit.call();
     149            CCallHelpers::Call callLookupExceptionHandlerFromCallerFrame = jit.call(NoPtrTag);
    150150            jit.jumpToExceptionHandler(vm);
    151151            noException.link(&jit);
     
    160160            mainPathJumps.append(jit.branchTest32(CCallHelpers::Zero, GPRInfo::argumentGPR0));
    161161            jit.emitFunctionPrologue();
    162             CCallHelpers::Call callArityFixup = jit.call();
     162            CCallHelpers::Call callArityFixup = jit.call(NoPtrTag);
    163163            jit.emitFunctionEpilogue();
    164164            mainPathJumps.append(jit.jump());
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r229518 r229609  
    287287                    jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
    288288                    jit.move(CCallHelpers::TrustedImmPtr(jit.codeBlock()), GPRInfo::argumentGPR1);
    289                     CCallHelpers::Call throwCall = jit.call();
     289                    CCallHelpers::Call throwCall = jit.call(NoPtrTag);
    290290
    291291                    jit.move(CCallHelpers::TrustedImmPtr(vm), GPRInfo::argumentGPR0);
    292292                    jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1);
    293                     CCallHelpers::Call lookupExceptionHandlerCall = jit.call();
     293                    CCallHelpers::Call lookupExceptionHandlerCall = jit.call(NoPtrTag);
    294294                    jit.jumpToExceptionHandler(*vm);
    295295
     
    76377637                auto callWithExceptionCheck = [&] (void* callee) {
    76387638                    jit.move(CCallHelpers::TrustedImmPtr(callee), GPRInfo::nonPreservedNonArgumentGPR);
    7639                     jit.call(GPRInfo::nonPreservedNonArgumentGPR);
     7639                    jit.call(GPRInfo::nonPreservedNonArgumentGPR, NoPtrTag);
    76407640                    exceptions->append(jit.emitExceptionCheck(*vm, AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
    76417641                };
     
    79767976                auto callWithExceptionCheck = [&] (void* callee) {
    79777977                    jit.move(CCallHelpers::TrustedImmPtr(callee), GPRInfo::nonPreservedNonArgumentGPR);
    7978                     jit.call(GPRInfo::nonPreservedNonArgumentGPR);
     7978                    jit.call(GPRInfo::nonPreservedNonArgumentGPR, NoPtrTag);
    79797979                    exceptions->append(jit.emitExceptionCheck(*vm, AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
    79807980                };
     
    81648164                jit.setupArguments<decltype(operationCallEval)>(GPRInfo::regT1);
    81658165                jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(operationCallEval)), GPRInfo::nonPreservedNonArgumentGPR);
    8166                 jit.call(GPRInfo::nonPreservedNonArgumentGPR);
     8166                jit.call(GPRInfo::nonPreservedNonArgumentGPR, NoPtrTag);
    81678167                exceptions->append(jit.emitExceptionCheck(state->vm(), AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
    81688168               
  • trunk/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp

    r229391 r229609  
    340340                CCallHelpers::TrustedImmPtr(materializationArguments));
    341341            jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(operationMaterializeObjectInOSR)), GPRInfo::nonArgGPR0);
    342             jit.call(GPRInfo::nonArgGPR0);
     342            jit.call(GPRInfo::nonArgGPR0, NoPtrTag);
    343343            jit.storePtr(GPRInfo::returnValueGPR, materializationToPointer.get(materialization));
    344344
     
    368368            CCallHelpers::TrustedImmPtr(materializationArguments));
    369369        jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(operationPopulateObjectInOSR)), GPRInfo::nonArgGPR0);
    370         jit.call(GPRInfo::nonArgGPR0);
     370        jit.call(GPRInfo::nonArgGPR0, NoPtrTag);
    371371    }
    372372
     
    495495    exit.m_code = FINALIZE_CODE_IF(
    496496        shouldDumpDisassembly() || Options::verboseOSR() || Options::verboseFTLOSRExit(),
    497         patchBuffer,
     497        patchBuffer, NoPtrTag,
    498498        "FTL OSR exit #%u (%s, %s) from %s, with operands = %s",
    499499            exitID, toCString(exit.m_codeOrigin).data(),
     
    542542
    543543    prepareCodeOriginForOSRExit(exec, exit.m_codeOrigin);
    544    
     544
    545545    compileStub(exitID, jitCode, exit, &vm, codeBlock);
    546546
  • trunk/Source/JavaScriptCore/ftl/FTLSlowPathCall.cpp

    r214571 r229609  
    121121SlowPathCall SlowPathCallContext::makeCall(VM& vm, void* callTarget)
    122122{
    123     SlowPathCall result = SlowPathCall(m_jit.call(), keyWithTarget(callTarget));
     123    SlowPathCall result = SlowPathCall(m_jit.call(NoPtrTag), keyWithTarget(callTarget));
    124124
    125125    m_jit.addLinkTask(
  • trunk/Source/JavaScriptCore/ftl/FTLThunks.cpp

    r229087 r229609  
    8787        GPRInfo::argumentGPR1,
    8888        (stackMisalignment - MacroAssembler::pushToSaveByteOffset()) / sizeof(void*));
    89     MacroAssembler::Call functionCall = jit.call();
     89    MacroAssembler::Call functionCall = jit.call(NoPtrTag);
    9090   
    9191    // At this point we want to make a tail call to what was returned to us in the
     
    120120    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    121121    patchBuffer.link(functionCall, generationFunction);
    122     return FINALIZE_CODE(patchBuffer, "%s", name);
     122    return FINALIZE_CODE(patchBuffer, NoPtrTag, "%s", name);
    123123}
    124124
     
    127127    unsigned extraPopsToRestore = 0;
    128128    return genericGenerationThunkGenerator(
    129         vm, compileFTLOSRExit, "FTL OSR exit generation thunk", extraPopsToRestore, FrameAndStackAdjustmentRequirement::Needed);
     129        vm, FunctionPtr(compileFTLOSRExit, NoPtrTag), "FTL OSR exit generation thunk", extraPopsToRestore, FrameAndStackAdjustmentRequirement::Needed);
    130130}
    131131
     
    134134    unsigned extraPopsToRestore = 1;
    135135    return genericGenerationThunkGenerator(
    136         vm, compileFTLLazySlowPath, "FTL lazy slow path generation thunk", extraPopsToRestore, FrameAndStackAdjustmentRequirement::NotNeeded);
     136        vm, FunctionPtr(compileFTLLazySlowPath, NoPtrTag), "FTL lazy slow path generation thunk", extraPopsToRestore, FrameAndStackAdjustmentRequirement::NotNeeded);
    137137}
    138138
     
    198198    registerClobberCheck(jit, key.argumentRegisters());
    199199   
    200     AssemblyHelpers::Call call = jit.call();
     200    AssemblyHelpers::Call call = jit.call(NoPtrTag);
    201201
    202202    jit.loadPtr(AssemblyHelpers::Address(MacroAssembler::stackPointerRegister, key.offset()), GPRInfo::nonPreservedNonReturnGPR);
     
    225225    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    226226    patchBuffer.link(call, FunctionPtr(key.callTarget()));
    227     return FINALIZE_CODE(patchBuffer, "FTL slow path call thunk for %s", toCString(key).data());
     227    return FINALIZE_CODE(patchBuffer, NoPtrTag, "FTL slow path call thunk for %s", toCString(key).data());
    228228}
    229229
  • trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp

    r229391 r229609  
    347347    move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
    348348#endif
    349     move(TrustedImmPtr(bitwise_cast<void*>(operationExceptionFuzz)), GPRInfo::nonPreservedNonReturnGPR);
    350     call(GPRInfo::nonPreservedNonReturnGPR);
     349    move(TrustedImmPtr(tagCFunctionPtr(operationExceptionFuzz, SlowPathPtrTag)), GPRInfo::nonPreservedNonReturnGPR);
     350    call(GPRInfo::nonPreservedNonReturnGPR, SlowPathPtrTag);
    351351
    352352    for (unsigned i = 0; i < FPRInfo::numberOfRegisters; ++i) {
     
    941941#error "JIT not supported on this platform."
    942942#endif
    943     move(TrustedImmPtr(reinterpret_cast<void*>(function)), scratch);
    944     call(scratch);
     943    move(TrustedImmPtr(tagCFunctionPtr(function, SlowPathPtrTag)), scratch);
     944    call(scratch, SlowPathPtrTag);
    945945
    946946    move(TrustedImmPtr(scratchBuffer->addressOfActiveLength()), GPRInfo::regT0);
  • trunk/Source/JavaScriptCore/jit/CCallHelpers.cpp

    r229391 r229609  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6060    Jump ok = branchPtr(Below, shadowPacket, TrustedImmPtr(vm.shadowChicken().logEnd()));
    6161    setupArguments<decltype(operationProcessShadowChickenLog)>();
    62     move(TrustedImmPtr(bitwise_cast<void*>(operationProcessShadowChickenLog)), scratch1NonArgGPR);
    63     call(scratch1NonArgGPR);
     62    move(TrustedImmPtr(tagCFunctionPtr(operationProcessShadowChickenLog, SlowPathPtrTag)), scratch1NonArgGPR);
     63    call(scratch1NonArgGPR, SlowPathPtrTag);
    6464    move(TrustedImmPtr(vm.shadowChicken().addressOfLogCursor()), scratch1NonArgGPR);
    6565    loadPtr(Address(scratch1NonArgGPR), shadowPacket);
  • trunk/Source/JavaScriptCore/jit/CCallHelpers.h

    r229432 r229609  
    11/*
    2  * Copyright (C) 2011, 2015-2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    519519        // and the address of the handler in vm->targetMachinePCForThrow.
    520520        loadPtr(&vm.targetMachinePCForThrow, GPRInfo::regT1);
    521         jump(GPRInfo::regT1);
     521        jump(GPRInfo::regT1, ExceptionHandlerPtrTag);
    522522    }
    523523
  • trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp

    r229054 r229609  
    299299        // The second is we can't guarantee that the code is readable when using the
    300300        // asyncDisassembly option as our caller will set our pages execute only.
    301         return linkBuffer.finalizeCodeWithoutDisassembly();
     301        return linkBuffer.finalizeCodeWithoutDisassembly(NoPtrTag);
    302302    }
    303303#else // CPU(ARM64) && USE(EXECUTE_ONLY_JIT_WRITE_FUNCTION)
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r229444 r229609  
    110110    skipOptimize.append(branchTestPtr(Zero, returnValueGPR));
    111111    move(returnValueGPR2, stackPointerRegister);
    112     jump(returnValueGPR);
     112    jump(returnValueGPR, NoPtrTag);
    113113    skipOptimize.link(this);
    114114}
     
    777777            ASSERT(record.jumpTable.simpleJumpTable->branchOffsets.size() == record.jumpTable.simpleJumpTable->ctiOffsets.size());
    778778
    779             record.jumpTable.simpleJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeOffset + record.defaultOffset]);
     779            record.jumpTable.simpleJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeOffset + record.defaultOffset], NoPtrTag);
    780780
    781781            for (unsigned j = 0; j < record.jumpTable.simpleJumpTable->branchOffsets.size(); ++j) {
    782782                unsigned offset = record.jumpTable.simpleJumpTable->branchOffsets[j];
    783                 record.jumpTable.simpleJumpTable->ctiOffsets[j] = offset ? patchBuffer.locationOf(m_labels[bytecodeOffset + offset]) : record.jumpTable.simpleJumpTable->ctiDefault;
     783                record.jumpTable.simpleJumpTable->ctiOffsets[j] = offset ? patchBuffer.locationOf(m_labels[bytecodeOffset + offset], NoPtrTag) : record.jumpTable.simpleJumpTable->ctiDefault;
    784784            }
    785785        } else {
    786786            ASSERT(record.type == SwitchRecord::String);
    787787
    788             record.jumpTable.stringJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeOffset + record.defaultOffset]);
    789 
    790             for (auto& location : record.jumpTable.stringJumpTable->offsetTable.values()) {
     788            auto* stringJumpTable = record.jumpTable.stringJumpTable;
     789            stringJumpTable->ctiDefault =
     790                patchBuffer.locationOf(m_labels[bytecodeOffset + record.defaultOffset], NoPtrTag);
     791
     792            for (auto& location : stringJumpTable->offsetTable.values()) {
    791793                unsigned offset = location.branchOffset;
    792                 location.ctiOffset = offset ? patchBuffer.locationOf(m_labels[bytecodeOffset + offset]) : record.jumpTable.stringJumpTable->ctiDefault;
     794                location.ctiOffset = offset
     795                    ? patchBuffer.locationOf(m_labels[bytecodeOffset + offset], NoPtrTag)
     796                    : stringJumpTable->ctiDefault;
    793797            }
    794798        }
     
    797801    for (size_t i = 0; i < m_codeBlock->numberOfExceptionHandlers(); ++i) {
    798802        HandlerInfo& handler = m_codeBlock->exceptionHandler(i);
    799         handler.nativeCode = patchBuffer.locationOf(m_labels[handler.target]);
     803        handler.nativeCode = patchBuffer.locationOf(m_labels[handler.target], ExceptionHandlerPtrTag);
    800804    }
    801805
    802806    for (auto& record : m_calls) {
    803807        if (record.to)
    804             patchBuffer.link(record.from, FunctionPtr(record.to));
     808            patchBuffer.link(record.from, FunctionPtr(record.to, SlowPathPtrTag));
    805809    }
    806810
     
    813817
    814818    if (m_byValCompilationInfo.size()) {
    815         CodeLocationLabel exceptionHandler = patchBuffer.locationOf(m_exceptionHandler);
     819        CodeLocationLabel exceptionHandler = patchBuffer.locationOf(m_exceptionHandler, ExceptionHandlerPtrTag);
    816820
    817821        for (const auto& byValCompilationInfo : m_byValCompilationInfo) {
     
    821825                notIndexJump = CodeLocationJump(patchBuffer.locationOf(patchableNotIndexJump));
    822826            CodeLocationJump badTypeJump = CodeLocationJump(patchBuffer.locationOf(byValCompilationInfo.badTypeJump));
    823             CodeLocationLabel doneTarget = patchBuffer.locationOf(byValCompilationInfo.doneTarget);
    824             CodeLocationLabel nextHotPathTarget = patchBuffer.locationOf(byValCompilationInfo.nextHotPathTarget);
    825             CodeLocationLabel slowPathTarget = patchBuffer.locationOf(byValCompilationInfo.slowPathTarget);
     827            CodeLocationLabel doneTarget = patchBuffer.locationOf(byValCompilationInfo.doneTarget, NoPtrTag);
     828            CodeLocationLabel nextHotPathTarget = patchBuffer.locationOf(byValCompilationInfo.nextHotPathTarget, NoPtrTag);
     829            CodeLocationLabel slowPathTarget = patchBuffer.locationOf(byValCompilationInfo.slowPathTarget, NoPtrTag);
    826830            CodeLocationCall returnAddress = patchBuffer.locationOf(byValCompilationInfo.returnAddress);
    827831
     
    856860    MacroAssemblerCodePtr withArityCheck;
    857861    if (m_codeBlock->codeType() == FunctionCode)
    858         withArityCheck = patchBuffer.locationOf(m_arityCheck);
     862        withArityCheck = patchBuffer.locationOf(m_arityCheck, CodeEntryWithArityCheckPtrTag);
    859863
    860864    if (Options::dumpDisassembly()) {
     
    872876   
    873877    CodeRef result = FINALIZE_CODE(
    874         patchBuffer,
     878        patchBuffer, CodeEntryPtrTag,
    875879        "Baseline JIT code for %s", toCString(CodeBlockWithJITType(m_codeBlock, JITCode::BaselineJIT)).data());
    876880   
     
    914918        poke(GPRInfo::argumentGPR1, 1);
    915919#endif
    916         m_calls.append(CallRecord(call(), std::numeric_limits<unsigned>::max(), FunctionPtr(lookupExceptionHandlerFromCallerFrame).value()));
     920        m_calls.append(CallRecord(call(SlowPathPtrTag), std::numeric_limits<unsigned>::max(), FunctionPtr(lookupExceptionHandlerFromCallerFrame, SlowPathPtrTag).value()));
    917921        jumpToExceptionHandler(*vm());
    918922    }
     
    933937        poke(GPRInfo::argumentGPR1, 1);
    934938#endif
    935         m_calls.append(CallRecord(call(), std::numeric_limits<unsigned>::max(), FunctionPtr(lookupExceptionHandler).value()));
     939        m_calls.append(CallRecord(call(SlowPathPtrTag), std::numeric_limits<unsigned>::max(), FunctionPtr(lookupExceptionHandler, SlowPathPtrTag).value()));
    936940        jumpToExceptionHandler(*vm());
    937941    }
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r229391 r229609  
    270270        Call appendCall(const FunctionPtr& function)
    271271        {
    272             Call functionCall = call();
     272            Call functionCall = call(NoPtrTag);
    273273            m_calls.append(CallRecord(functionCall, m_bytecodeOffset, function.value()));
    274274            return functionCall;
  • trunk/Source/JavaScriptCore/jit/JITMathIC.h

    r229054 r229609  
    140140            RELEASE_ASSERT(linkBuffer.isValid());
    141141            linkBuffer.link(jump, CodeLocationLabel(m_code.code()));
    142             FINALIZE_CODE(linkBuffer, "JITMathIC: linking constant jump to out of line stub");
     142            FINALIZE_CODE(linkBuffer, NoPtrTag, "JITMathIC: linking constant jump to out of line stub");
    143143        };
    144144
     
    167167
    168168                    m_code = FINALIZE_CODE_FOR(
    169                         codeBlock, linkBuffer, "JITMathIC: generating out of line fast IC snippet");
     169                        codeBlock, linkBuffer, NoPtrTag, "JITMathIC: generating out of line fast IC snippet");
    170170
    171171                    if (!generationState.shouldSlowPathRepatch) {
     
    209209
    210210            m_code = FINALIZE_CODE_FOR(
    211                 codeBlock, linkBuffer, "JITMathIC: generating out of line IC snippet");
     211                codeBlock, linkBuffer, NoPtrTag, "JITMathIC: generating out of line IC snippet");
    212212        }
    213213
     
    217217    void finalizeInlineCode(const MathICGenerationState& state, LinkBuffer& linkBuffer)
    218218    {
    219         CodeLocationLabel start = linkBuffer.locationOf(state.fastPathStart);
     219        CodeLocationLabel start = linkBuffer.locationOf(state.fastPathStart, NoPtrTag);
    220220        m_inlineStart = start;
    221221
    222222        m_inlineSize = MacroAssembler::differenceBetweenCodePtr(
    223             start, linkBuffer.locationOf(state.fastPathEnd));
     223            start, linkBuffer.locationOf(state.fastPathEnd, NoPtrTag));
    224224        ASSERT(m_inlineSize > 0);
    225225
     
    227227            start, linkBuffer.locationOf(state.slowPathCall));
    228228        m_deltaFromStartToSlowPathStart = MacroAssembler::differenceBetweenCodePtr(
    229             start, linkBuffer.locationOf(state.slowPathStart));
     229            start, linkBuffer.locationOf(state.slowPathStart, SlowPathPtrTag));
    230230    }
    231231
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r229391 r229609  
    573573    auto skipOSREntry = branchTestPtr(Zero, returnValueGPR);
    574574    emitRestoreCalleeSaves();
    575     jump(returnValueGPR);
     575    jump(returnValueGPR, NoPtrTag);
    576576    skipOSREntry.link(this);
    577577    if (buffer && shouldEmitProfiling()) {
     
    611611    emitGetVirtualRegister(scrutinee, regT0);
    612612    callOperation(operationSwitchImmWithUnknownKeyType, regT0, tableIndex);
    613     jump(returnValueGPR);
     613    jump(returnValueGPR, NoPtrTag);
    614614}
    615615
     
    627627    emitGetVirtualRegister(scrutinee, regT0);
    628628    callOperation(operationSwitchCharWithUnknownKeyType, regT0, tableIndex);
    629     jump(returnValueGPR);
     629    jump(returnValueGPR, NoPtrTag);
    630630}
    631631
     
    642642    emitGetVirtualRegister(scrutinee, regT0);
    643643    callOperation(operationSwitchStringWithUnknownKeyType, regT0, tableIndex);
    644     jump(returnValueGPR);
     644    jump(returnValueGPR, NoPtrTag);
    645645}
    646646
     
    878878            ok.link(this);
    879879        }
    880         jump(returnValueGPR);
     880        jump(returnValueGPR, NoPtrTag);
    881881        noOptimizedEntry.link(this);
    882882
     
    10821082   
    10831083    byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB(
    1084         m_codeBlock, patchBuffer,
     1084        m_codeBlock, patchBuffer, NoPtrTag,
    10851085        "Baseline has_indexed_property stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value());
    10861086   
    10871087    MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
    1088     MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationHasIndexedPropertyGeneric));
     1088    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationHasIndexedPropertyGeneric, SlowPathPtrTag));
    10891089}
    10901090
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r229391 r229609  
    739739    auto skipOSREntry = branchTestPtr(Zero, returnValueGPR);
    740740    emitRestoreCalleeSaves();
    741     jump(returnValueGPR);
     741    jump(returnValueGPR, NoPtrTag);
    742742    skipOSREntry.link(this);
    743743    if (buffer && shouldEmitProfiling()) {
     
    777777    emitLoad(scrutinee, regT1, regT0);
    778778    callOperation(operationSwitchImmWithUnknownKeyType, JSValueRegs(regT1, regT0), tableIndex);
    779     jump(returnValueGPR);
     779    jump(returnValueGPR, NoPtrTag);
    780780}
    781781
     
    793793    emitLoad(scrutinee, regT1, regT0);
    794794    callOperation(operationSwitchCharWithUnknownKeyType, JSValueRegs(regT1, regT0), tableIndex);
    795     jump(returnValueGPR);
     795    jump(returnValueGPR, NoPtrTag);
    796796}
    797797
     
    808808    emitLoad(scrutinee, regT1, regT0);
    809809    callOperation(operationSwitchStringWithUnknownKeyType, JSValueRegs(regT1, regT0), tableIndex);
    810     jump(returnValueGPR);
     810    jump(returnValueGPR, NoPtrTag);
    811811}
    812812
     
    933933   
    934934    byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB(
    935         m_codeBlock, patchBuffer,
     935        m_codeBlock, patchBuffer, NoPtrTag,
    936936        "Baseline has_indexed_property stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value());
    937937   
    938938    MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
    939     MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationHasIndexedPropertyGeneric));
     939    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationHasIndexedPropertyGeneric, SlowPathPtrTag));
    940940}
    941941
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp

    r229518 r229609  
    9191   
    9292    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    93     return FINALIZE_CODE(patchBuffer, "String get_by_val stub");
     93    return FINALIZE_CODE(patchBuffer, NoPtrTag, "String get_by_val stub");
    9494}
    9595
     
    12661266   
    12671267    byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB(
    1268         m_codeBlock, patchBuffer,
     1268        m_codeBlock, patchBuffer, NoPtrTag,
    12691269        "Baseline get_by_val stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value());
    12701270   
    12711271    MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
    1272     MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationGetByValGeneric));
     1272    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationGetByValGeneric, SlowPathPtrTag));
    12731273}
    12741274
     
    12931293    for (const auto& callSite : m_calls) {
    12941294        if (callSite.to)
    1295             patchBuffer.link(callSite.from, FunctionPtr(callSite.to));
     1295            patchBuffer.link(callSite.from, FunctionPtr(callSite.to, SlowPathPtrTag));
    12961296    }
    12971297    gen.finalize(patchBuffer);
    12981298
    12991299    byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB(
    1300         m_codeBlock, patchBuffer,
     1300        m_codeBlock, patchBuffer, NoPtrTag,
    13011301        "Baseline get_by_val with cached property name '%s' stub for %s, return point %p", propertyName.impl()->utf8().data(), toCString(*m_codeBlock).data(), returnAddress.value());
    13021302    byValInfo->stubInfo = gen.stubInfo();
    13031303
    13041304    MacroAssembler::repatchJump(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
    1305     MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationGetByValGeneric));
     1305    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationGetByValGeneric, SlowPathPtrTag));
    13061306}
    13071307
     
    13471347    if (needsLinkForWriteBarrier) {
    13481348        ASSERT(m_calls.last().to == operationWriteBarrierSlowPath);
    1349         patchBuffer.link(m_calls.last().from, operationWriteBarrierSlowPath);
     1349        patchBuffer.link(m_calls.last().from, operationWriteBarrierSlowPath, SlowPathPtrTag);
    13501350    }
    13511351   
     
    13531353    if (!isDirect) {
    13541354        byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB(
    1355             m_codeBlock, patchBuffer,
     1355            m_codeBlock, patchBuffer, NoPtrTag,
    13561356            "Baseline put_by_val stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value());
    13571357       
    13581358    } else {
    13591359        byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB(
    1360             m_codeBlock, patchBuffer,
     1360            m_codeBlock, patchBuffer, NoPtrTag,
    13611361            "Baseline put_by_val_direct stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value());
    13621362    }
    13631363    MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
    1364     MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(isDirect ? operationDirectPutByValGeneric : operationPutByValGeneric));
     1364    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(isDirect ? operationDirectPutByValGeneric : operationPutByValGeneric, SlowPathPtrTag));
    13651365}
    13661366
     
    13831383    for (const auto& callSite : m_calls) {
    13841384        if (callSite.to)
    1385             patchBuffer.link(callSite.from, FunctionPtr(callSite.to));
     1385            patchBuffer.link(callSite.from, FunctionPtr(callSite.to, SlowPathPtrTag));
    13861386    }
    13871387    gen.finalize(patchBuffer);
    13881388
    13891389    byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB(
    1390         m_codeBlock, patchBuffer,
     1390        m_codeBlock, patchBuffer, NoPtrTag,
    13911391        "Baseline put_by_val%s with cached property name '%s' stub for %s, return point %p", (putKind == Direct) ? "_direct" : "", propertyName.impl()->utf8().data(), toCString(*m_codeBlock).data(), returnAddress.value());
    13921392    byValInfo->stubInfo = gen.stubInfo();
    13931393
    13941394    MacroAssembler::repatchJump(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
    1395     MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(putKind == Direct ? operationDirectPutByValGeneric : operationPutByValGeneric));
     1395    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(putKind == Direct ? operationDirectPutByValGeneric : operationPutByValGeneric, SlowPathPtrTag));
    13961396}
    13971397
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp

    r229518 r229609  
    179179   
    180180    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    181     return FINALIZE_CODE(patchBuffer, "String get_by_val stub");
     181    return FINALIZE_CODE(patchBuffer, NoPtrTag, "String get_by_val stub");
    182182}
    183183
  • trunk/Source/JavaScriptCore/jit/JITStubRoutine.h

    r229054 r229609  
    115115
    116116// Helper for the creation of simple stub routines that need no help from the GC.
    117 #define FINALIZE_CODE_FOR_STUB(codeBlock, patchBuffer, ...) \
    118     (adoptRef(new JITStubRoutine(FINALIZE_CODE_FOR((codeBlock), (patchBuffer), __VA_ARGS__))))
     117#define FINALIZE_CODE_FOR_STUB(codeBlock, patchBuffer, resultPtrTag, ...) \
     118    (adoptRef(new JITStubRoutine(FINALIZE_CODE_FOR((codeBlock), (patchBuffer), (resultPtrTag), __VA_ARGS__))))
    119119
    120120} // namespace JSC
  • trunk/Source/JavaScriptCore/jit/Repatch.cpp

    r229413 r229609  
    7474        return FunctionPtr(codeBlock->vm()->ftlThunks->keyForSlowPathCallThunk(
    7575            MacroAssemblerCodePtr::createFromExecutableAddress(
    76                 result.executableAddress())).callTarget());
     76                result.executableAddress())).callTarget(), CodeEntryPtrTag);
    7777    }
    7878#else
     
    387387static V_JITOperation_ESsiJJI appropriateOptimizingPutByIdFunction(const PutPropertySlot &slot, PutKind putKind)
    388388{
    389     if (slot.isStrictMode()) {
     389    auto pickSlowPath = [&] () -> V_JITOperation_ESsiJJI {
     390        if (slot.isStrictMode()) {
     391            if (putKind == Direct)
     392                return operationPutByIdDirectStrictOptimize;
     393            return operationPutByIdStrictOptimize;
     394        }
    390395        if (putKind == Direct)
    391             return operationPutByIdDirectStrictOptimize;
    392         return operationPutByIdStrictOptimize;
    393     }
    394     if (putKind == Direct)
    395         return operationPutByIdDirectNonStrictOptimize;
    396     return operationPutByIdNonStrictOptimize;
     396            return operationPutByIdDirectNonStrictOptimize;
     397        return operationPutByIdNonStrictOptimize;
     398    };
     399    return tagCFunctionPtr(pickSlowPath(), SlowPathPtrTag);
    397400}
    398401
     
    10691072        bool isTailCall = callToCodePtr.call.isFlagSet(CCallHelpers::Call::Tail);
    10701073        patchBuffer.link(
    1071             callToCodePtr.call, FunctionPtr(isTailCall ? callToCodePtr.codePtr.dataLocation() : callToCodePtr.codePtr.executableAddress()));
     1074            callToCodePtr.call, FunctionPtr(tagCodePtr(isTailCall ? callToCodePtr.codePtr.dataLocation() : callToCodePtr.codePtr.executableAddress(), CodeEntryPtrTag)));
    10721075    }
    10731076    if (isWebAssembly || JITCode::isOptimizingJIT(callerCodeBlock->jitType()))
     
    10791082    auto stubRoutine = adoptRef(*new PolymorphicCallStubRoutine(
    10801083        FINALIZE_CODE_FOR(
    1081             callerCodeBlock, patchBuffer,
     1084            callerCodeBlock, patchBuffer, NoPtrTag,
    10821085            "Polymorphic call stub for %s, return point %p, targets %s",
    10831086                isWebAssembly ? "WebAssembly" : toCString(*callerCodeBlock).data(), callLinkInfo.callReturnLocation().labelAtOffset(0).executableAddress(),
     
    11251128    }
    11261129
    1127     ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), optimizedFunction);
     1130    ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), tagCFunctionPtr(optimizedFunction, SlowPathPtrTag));
    11281131    InlineAccess::rewireStubAsJump(stubInfo, stubInfo.slowPathStartLocation());
    11291132}
  • trunk/Source/JavaScriptCore/jit/SlowPathCall.h

    r224626 r229609  
    6262        m_jit->move(JIT::TrustedImmPtr(m_pc), JIT::argumentGPR1);
    6363#endif
    64         JIT::Call call = m_jit->call();
     64        JIT::Call call = m_jit->call(NoPtrTag);
    6565        m_jit->m_calls.append(CallRecord(call, m_jit->m_bytecodeOffset, m_stub.value()));
    6666
  • trunk/Source/JavaScriptCore/jit/SpecializedThunkJIT.h

    r229054 r229609  
    171171            for (unsigned i = 0; i < m_calls.size(); i++)
    172172                patchBuffer.link(m_calls[i].first, m_calls[i].second);
    173             return FINALIZE_CODE(patchBuffer, "Specialized thunk for %s", thunkKind);
     173            return FINALIZE_CODE(patchBuffer, NoPtrTag, "Specialized thunk for %s", thunkKind);
    174174        }
    175175
     
    178178        void callDoubleToDouble(FunctionPtr function)
    179179        {
    180             m_calls.append(std::make_pair(call(), function));
     180            m_calls.append(std::make_pair(call(SlowPathPtrTag), function));
    181181        }
    182182       
  • trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp

    r229391 r229609  
    7272    jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(lookupExceptionHandler)), GPRInfo::nonArgGPR0);
    7373    emitPointerValidation(jit, GPRInfo::nonArgGPR0);
    74     jit.call(GPRInfo::nonArgGPR0);
     74    jit.call(GPRInfo::nonArgGPR0, NoPtrTag);
    7575    jit.jumpToExceptionHandler(*vm);
    7676
    7777    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    78     return FINALIZE_CODE(patchBuffer, "Throw exception from call slow path thunk");
     78    return FINALIZE_CODE(patchBuffer, NoPtrTag, "Throw exception from call slow path thunk");
    7979}
    8080
     
    9696    jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(slowPathFunction)), GPRInfo::nonArgGPR0);
    9797    emitPointerValidation(jit, GPRInfo::nonArgGPR0);
    98     jit.call(GPRInfo::nonArgGPR0);
     98    jit.call(GPRInfo::nonArgGPR0, NoPtrTag);
    9999    jit.loadPtr(CCallHelpers::Address(GPRInfo::returnValueGPR, 8), GPRInfo::returnValueGPR2);
    100100    jit.loadPtr(CCallHelpers::Address(GPRInfo::returnValueGPR), GPRInfo::returnValueGPR);
     
    106106    jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(slowPathFunction)), GPRInfo::nonArgGPR0);
    107107    emitPointerValidation(jit, GPRInfo::nonArgGPR0);
    108     jit.call(GPRInfo::nonArgGPR0);
     108    jit.call(GPRInfo::nonArgGPR0, NoPtrTag);
    109109    if (maxFrameExtentForSlowPathCall)
    110110        jit.addPtr(CCallHelpers::TrustedImm32(maxFrameExtentForSlowPathCall), CCallHelpers::stackPointerRegister);
     
    127127
    128128    doNotTrash.link(&jit);
    129     jit.jump(GPRInfo::returnValueGPR);
     129    jit.jump(GPRInfo::returnValueGPR, NoPtrTag);
    130130}
    131131
     
    142142   
    143143    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    144     return FINALIZE_CODE(patchBuffer, "Link call slow path thunk");
     144    return FINALIZE_CODE(patchBuffer, NoPtrTag, "Link call slow path thunk");
    145145}
    146146
     
    154154   
    155155    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    156     return FINALIZE_CODE(patchBuffer, "Link polymorphic call slow path thunk");
     156    return FINALIZE_CODE(patchBuffer, NoPtrTag, "Link polymorphic call slow path thunk");
    157157}
    158158
     
    227227        jit.prepareForTailCallSlow(GPRInfo::regT4);
    228228    }
    229     jit.jump(GPRInfo::regT4);
     229    jit.jump(GPRInfo::regT4, NoPtrTag);
    230230
    231231    notJSFunction.link(&jit);
     
    237237   
    238238    // Here we don't know anything, so revert to the full slow path.
    239    
    240239    slowPathFor(jit, vm, operationVirtualCall);
    241    
     240
    242241    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    243242    return FINALIZE_CODE(
    244         patchBuffer,
     243        patchBuffer, NoPtrTag,
    245244        "Virtual %s slow path thunk",
    246245        callLinkInfo.callMode() == CallMode::Regular ? "call" : callLinkInfo.callMode() == CallMode::Tail ? "tail call" : "construct");
     
    295294        jit.loadPtr(JSInterfaceJIT::Address(JSInterfaceJIT::regT1, JSFunction::offsetOfExecutable()), JSInterfaceJIT::regT1);
    296295        jit.xorPtr(JSInterfaceJIT::TrustedImmPtr(JSFunctionPoison::key()), JSInterfaceJIT::regT1);
    297         jit.call(JSInterfaceJIT::Address(JSInterfaceJIT::regT1, executableOffsetToFunction));
     296        jit.call(JSInterfaceJIT::Address(JSInterfaceJIT::regT1, executableOffsetToFunction), NoPtrTag);
    298297    } else
    299         jit.call(JSInterfaceJIT::Address(JSInterfaceJIT::regT1, InternalFunction::offsetOfNativeFunctionFor(kind)));
     298        jit.call(JSInterfaceJIT::Address(JSInterfaceJIT::regT1, InternalFunction::offsetOfNativeFunctionFor(kind)), NoPtrTag);
    300299
    301300    jit.addPtr(JSInterfaceJIT::TrustedImm32(8), JSInterfaceJIT::stackPointerRegister);
     
    316315    jit.move(JSInterfaceJIT::TrustedImm64(NativeCodePoison::key()), X86Registers::esi);
    317316    jit.xor64(X86Registers::esi, X86Registers::r9);
    318     jit.call(X86Registers::r9);
     317    jit.call(X86Registers::r9, NoPtrTag);
    319318
    320319#else
     
    331330        jit.loadPtr(JSInterfaceJIT::Address(X86Registers::edx, JSFunction::offsetOfExecutable()), X86Registers::r9);
    332331        jit.xorPtr(JSInterfaceJIT::TrustedImmPtr(JSFunctionPoison::key()), X86Registers::r9);
    333         jit.call(JSInterfaceJIT::Address(X86Registers::r9, executableOffsetToFunction));
     332        jit.call(JSInterfaceJIT::Address(X86Registers::r9, executableOffsetToFunction), NoPtrTag);
    334333    } else
    335         jit.call(JSInterfaceJIT::Address(X86Registers::edx, InternalFunction::offsetOfNativeFunctionFor(kind)));
     334        jit.call(JSInterfaceJIT::Address(X86Registers::edx, InternalFunction::offsetOfNativeFunctionFor(kind)), NoPtrTag);
    336335
    337336    jit.addPtr(JSInterfaceJIT::TrustedImm32(4 * sizeof(int64_t)), JSInterfaceJIT::stackPointerRegister);
     
    355354    jit.move(JSInterfaceJIT::TrustedImm64(NativeCodePoison::key()), ARM64Registers::x1);
    356355    jit.xor64(ARM64Registers::x1, ARM64Registers::x2);
    357     jit.call(ARM64Registers::x2);
     356    jit.call(ARM64Registers::x2, NoPtrTag);
    358357
    359358#elif CPU(ARM) || CPU(MIPS)
     
    371370        jit.loadPtr(JSInterfaceJIT::Address(JSInterfaceJIT::argumentGPR1, JSFunction::offsetOfExecutable()), JSInterfaceJIT::regT2);
    372371        jit.xorPtr(JSInterfaceJIT::TrustedImmPtr(JSFunctionPoison::key()), JSInterfaceJIT::regT2);
    373         jit.call(JSInterfaceJIT::Address(JSInterfaceJIT::regT2, executableOffsetToFunction));
     372        jit.call(JSInterfaceJIT::Address(JSInterfaceJIT::regT2, executableOffsetToFunction), NoPtrTag);
    374373    } else
    375         jit.call(JSInterfaceJIT::Address(JSInterfaceJIT::argumentGPR1, InternalFunction::offsetOfNativeFunctionFor(kind)));
     374        jit.call(JSInterfaceJIT::Address(JSInterfaceJIT::argumentGPR1, InternalFunction::offsetOfNativeFunctionFor(kind)), NoPtrTag);
    376375
    377376#if CPU(MIPS)
     
    417416    jit.move(JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::argumentGPR0);
    418417#endif
    419     jit.move(JSInterfaceJIT::TrustedImmPtr(FunctionPtr(operationVMHandleException).value()), JSInterfaceJIT::regT3);
    420     jit.call(JSInterfaceJIT::regT3);
     418    jit.move(JSInterfaceJIT::TrustedImmPtr(FunctionPtr(operationVMHandleException, NoPtrTag).value()), JSInterfaceJIT::regT3);
     419    jit.call(JSInterfaceJIT::regT3, NoPtrTag);
    421420#if CPU(X86) && USE(JSVALUE32_64)
    422421    jit.addPtr(JSInterfaceJIT::TrustedImm32(8), JSInterfaceJIT::stackPointerRegister);
     
    428427
    429428    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    430     return FINALIZE_CODE(patchBuffer, "%s %s%s trampoline", thunkFunctionType == ThunkFunctionType::JSFunction ? "native" : "internal", entryType == EnterViaJumpWithSavedTags ? "Tail With Saved Tags " : entryType == EnterViaJumpWithoutSavedTags ? "Tail Without Saved Tags " : "", toCString(kind).data());
     429    return FINALIZE_CODE(patchBuffer, NoPtrTag, "%s %s%s trampoline", thunkFunctionType == ThunkFunctionType::JSFunction ? "native" : "internal", entryType == EnterViaJumpWithSavedTags ? "Tail With Saved Tags " : entryType == EnterViaJumpWithoutSavedTags ? "Tail Without Saved Tags " : "", toCString(kind).data());
    431430}
    432431
     
    585584
    586585    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    587     return FINALIZE_CODE(patchBuffer, "fixup arity");
     586    return FINALIZE_CODE(patchBuffer, NoPtrTag, "fixup arity");
    588587}
    589588
     
    595594
    596595    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    597     return FINALIZE_CODE(patchBuffer, "unreachable thunk");
     596    return FINALIZE_CODE(patchBuffer, NoPtrTag, "unreachable thunk");
    598597}
    599598
     
    11831182#endif
    11841183    emitPointerValidation(jit, GPRInfo::regT0);
    1185     jit.call(GPRInfo::regT0);
     1184    jit.call(GPRInfo::regT0, NoPtrTag);
    11861185   
    11871186    jit.emitFunctionEpilogue();
     
    11911190    linkBuffer.link(noCode, CodeLocationLabel(vm->jitStubs->ctiNativeTailCallWithoutSavedTags(vm)));
    11921191    return FINALIZE_CODE(
    1193         linkBuffer, "Specialized thunk for bound function calls with no arguments");
     1192        linkBuffer, NoPtrTag, "Specialized thunk for bound function calls with no arguments");
    11941193}
    11951194
  • trunk/Source/JavaScriptCore/llint/LLIntThunks.cpp

    r229054 r229609  
    5252namespace LLInt {
    5353
    54 static MacroAssemblerCodeRef generateThunkWithJumpTo(VM* vm, void (*target)(), const char *thunkKind)
     54static MacroAssemblerCodeRef generateThunkWithJumpTo(VM* vm, OpcodeID opcodeID, PtrTag thunkTag, const char *thunkKind)
    5555{
    5656    JSInterfaceJIT jit(vm);
    57    
     57
    5858    // FIXME: there's probably a better way to do it on X86, but I'm not sure I care.
     59    LLIntCode target = LLInt::getCodeFunctionPtr(opcodeID);
    5960    jit.move(JSInterfaceJIT::TrustedImmPtr(bitwise_cast<void*>(target)), JSInterfaceJIT::regT0);
    60     jit.jump(JSInterfaceJIT::regT0);
    61    
     61    jit.jump(JSInterfaceJIT::regT0, ptrTag(BytecodeHelperPtrTag, opcodeID));
     62
    6263    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
    63     return FINALIZE_CODE(patchBuffer, "LLInt %s prologue thunk", thunkKind);
     64    return FINALIZE_CODE(patchBuffer, thunkTag, "LLInt %s prologue thunk", thunkKind);
    6465}
    6566
    6667MacroAssemblerCodeRef functionForCallEntryThunkGenerator(VM* vm)
    6768{
    68     return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_function_for_call_prologue), "function for call");
     69    return generateThunkWithJumpTo(vm, llint_function_for_call_prologue, CodeEntryPtrTag, "function for call");
    6970}
    7071
    7172MacroAssemblerCodeRef functionForConstructEntryThunkGenerator(VM* vm)
    7273{
    73     return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_function_for_construct_prologue), "function for construct");
     74    return generateThunkWithJumpTo(vm, llint_function_for_construct_prologue, CodeEntryPtrTag, "function for construct");
    7475}
    7576
    7677MacroAssemblerCodeRef functionForCallArityCheckThunkGenerator(VM* vm)
    7778{
    78     return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_function_for_call_arity_check), "function for call with arity check");
     79    return generateThunkWithJumpTo(vm, llint_function_for_call_arity_check, CodeEntryWithArityCheckPtrTag, "function for call with arity check");
    7980}
    8081
    8182MacroAssemblerCodeRef functionForConstructArityCheckThunkGenerator(VM* vm)
    8283{
    83     return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_function_for_construct_arity_check), "function for construct with arity check");
     84    return generateThunkWithJumpTo(vm, llint_function_for_construct_arity_check, CodeEntryWithArityCheckPtrTag, "function for construct with arity check");
    8485}
    8586
    8687MacroAssemblerCodeRef evalEntryThunkGenerator(VM* vm)
    8788{
    88     return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_eval_prologue), "eval");
     89    return generateThunkWithJumpTo(vm, llint_eval_prologue, CodeEntryPtrTag, "eval");
    8990}
    9091
    9192MacroAssemblerCodeRef programEntryThunkGenerator(VM* vm)
    9293{
    93     return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_program_prologue), "program");
     94    return generateThunkWithJumpTo(vm, llint_program_prologue, CodeEntryPtrTag, "program");
    9495}
    9596
    9697MacroAssemblerCodeRef moduleProgramEntryThunkGenerator(VM* vm)
    9798{
    98     return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_module_program_prologue), "module_program");
     99    return generateThunkWithJumpTo(vm, llint_module_program_prologue, CodeEntryPtrTag, "module_program");
    99100}
    100101
  • trunk/Source/JavaScriptCore/runtime/PtrTag.h

    r229551 r229609  
    3434    NearCallPtrTag,
    3535    NearJumpPtrTag,
     36
    3637    CFunctionPtrTag,
    3738
     
    4445    NativeCodePtrTag,
    4546    SlowPathPtrTag,
     47
     48    Yarr8BitPtrTag,
     49    Yarr16BitPtrTag,
     50    YarrMatchOnly8BitPtrTag,
     51    YarrMatchOnly16BitPtrTag,
     52    YarrBacktrackPtrTag,
    4653};
    4754
  • trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp

    r228966 r229609  
    11481148                patchpoint->setGenerator([returnType] (CCallHelpers& jit, const B3::StackmapGenerationParams& params) {
    11491149                    AllowMacroScratchRegisterUsage allowScratch(jit);
    1150                     jit.call(params[returnType == Void ? 0 : 1].gpr());
     1150                    jit.call(params[returnType == Void ? 0 : 1].gpr(), NoPtrTag);
    11511151                });
    11521152            });
     
    13311331            patchpoint->setGenerator([=] (CCallHelpers& jit, const B3::StackmapGenerationParams& params) {
    13321332                AllowMacroScratchRegisterUsage allowScratch(jit);
    1333                 jit.call(params[returnType == Void ? 0 : 1].gpr());
     1333                jit.call(params[returnType == Void ? 0 : 1].gpr(), NoPtrTag);
    13341334            });
    13351335        });
  • trunk/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp

    r229054 r229609  
    309309
    310310                m_wasmInternalFunctions[functionIndex]->entrypoint.compilation = std::make_unique<B3::Compilation>(
    311                     FINALIZE_CODE(linkBuffer, "WebAssembly function[%i] %s", functionIndex, SignatureInformation::get(signatureIndex).toString().ascii().data()),
     311                    FINALIZE_CODE(linkBuffer, NoPtrTag, "WebAssembly function[%i] %s", functionIndex, SignatureInformation::get(signatureIndex).toString().ascii().data()),
    312312                    WTFMove(context.wasmEntrypointByproducts));
    313313            }
     
    321321
    322322                embedderToWasmInternalFunction->entrypoint.compilation = std::make_unique<B3::Compilation>(
    323                     FINALIZE_CODE(linkBuffer, "Embedder->WebAssembly entrypoint[%i] %s", functionIndex, SignatureInformation::get(signatureIndex).toString().ascii().data()),
     323                    FINALIZE_CODE(linkBuffer, NoPtrTag, "Embedder->WebAssembly entrypoint[%i] %s", functionIndex, SignatureInformation::get(signatureIndex).toString().ascii().data()),
    324324                    WTFMove(context.embedderEntrypointByproducts));
    325325            }
  • trunk/Source/JavaScriptCore/wasm/WasmBinding.cpp

    r229054 r229609  
    7777    // Tail call into the callee WebAssembly function.
    7878    jit.loadPtr(scratch, scratch);
    79     jit.jump(scratch);
     79    jit.jump(scratch, NoPtrTag);
    8080
    8181    LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, JITCompilationCanFail);
     
    8383        return makeUnexpected(BindingFailure::OutOfMemory);
    8484
    85     return FINALIZE_CODE(patchBuffer, "WebAssembly->WebAssembly import[%i]", importIndex);
     85    return FINALIZE_CODE(patchBuffer, NoPtrTag, "WebAssembly->WebAssembly import[%i]", importIndex);
    8686}
    8787
  • trunk/Source/JavaScriptCore/wasm/WasmOMGPlan.cpp

    r229054 r229609  
    9999
    100100    omgEntrypoint.compilation = std::make_unique<B3::Compilation>(
    101         FINALIZE_CODE(linkBuffer, "WebAssembly OMG function[%i] %s", m_functionIndex, SignatureInformation::get(signatureIndex).toString().ascii().data()),
     101        FINALIZE_CODE(linkBuffer, NoPtrTag, "WebAssembly OMG function[%i] %s", m_functionIndex, SignatureInformation::get(signatureIndex).toString().ascii().data()),
    102102        WTFMove(context.wasmEntrypointByproducts));
    103103
  • trunk/Source/JavaScriptCore/wasm/WasmThunks.cpp

    r229054 r229609  
    5252    jit.copyCalleeSavesToEntryFrameCalleeSavesBuffer(GPRInfo::argumentGPR0);
    5353    jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
    54     CCallHelpers::Call call = jit.call();
    55     jit.jump(GPRInfo::returnValueGPR);
     54    CCallHelpers::Call call = jit.call(NoPtrTag);
     55    jit.jump(GPRInfo::returnValueGPR, NoPtrTag);
    5656    jit.breakpoint(); // We should not reach this.
    5757
     
    6060    LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
    6161    linkBuffer.link(call, FunctionPtr(throwWasmException));
    62     return FINALIZE_CODE(linkBuffer, "Throw exception from Wasm");
     62    return FINALIZE_CODE(linkBuffer, NoPtrTag, "Throw exception from Wasm");
    6363}
    6464
     
    7474    LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
    7575    linkBuffer.link(jumpToExceptionHandler, CodeLocationLabel(Thunks::singleton().stub(locker, throwExceptionFromWasmThunkGenerator).code()));
    76     return FINALIZE_CODE(linkBuffer, "Throw stack overflow from Wasm");
     76    return FINALIZE_CODE(linkBuffer, NoPtrTag, "Throw stack overflow from Wasm");
    7777}
    7878
     
    9393    Run run = OMGPlan::runForIndex;
    9494    jit.move(MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(run)), GPRInfo::argumentGPR2);
    95     jit.call(GPRInfo::argumentGPR2);
     95    jit.call(GPRInfo::argumentGPR2, NoPtrTag);
    9696
    9797    ScratchRegisterAllocator::restoreRegistersFromStackForCall(jit, registersToSpill, RegisterSet(), numberOfStackBytesUsedForRegisterPreservation, extraPaddingBytes);
     
    100100    jit.ret();
    101101    LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
    102     return FINALIZE_CODE(linkBuffer, "Trigger OMG tier up");
     102    return FINALIZE_CODE(linkBuffer, NoPtrTag, "Trigger OMG tier up");
    103103}
    104104
  • trunk/Source/JavaScriptCore/wasm/js/WasmToJS.cpp

    r229391 r229609  
    9494        jit.move(CCallHelpers::TrustedImm32(0), GPRInfo::argumentGPR3);
    9595
    96         auto call = jit.call();
     96        auto call = jit.call(NoPtrTag);
    9797        jit.jumpToExceptionHandler(*vm);
    9898
     
    117117
    118118        linkBuffer.link(call, throwBadI64);
    119         return FINALIZE_CODE(linkBuffer, "WebAssembly->JavaScript invalid i64 use in import[%i]", importIndex);
     119        return FINALIZE_CODE(linkBuffer, NoPtrTag, "WebAssembly->JavaScript invalid i64 use in import[%i]", importIndex);
    120120    }
    121121   
     
    303303        static_assert(GPRInfo::numberOfArgumentRegisters >= 4, "We rely on this with the call below.");
    304304        jit.setupArguments<decltype(callFunc)>(GPRInfo::argumentGPR1, CCallHelpers::TrustedImm32(signatureIndex), CCallHelpers::TrustedImmPtr(buffer));
    305         auto call = jit.call();
     305        auto call = jit.call(NoPtrTag);
    306306        auto noException = jit.emitExceptionCheck(*vm, AssemblyHelpers::InvertedExceptionCheck);
    307307
     
    315315            ASSERT(!!vm->callFrameForCatch);
    316316        };
    317         auto exceptionCall = jit.call();
     317        auto exceptionCall = jit.call(NoPtrTag);
    318318        jit.jumpToExceptionHandler(*vm);
    319319
     
    343343        linkBuffer.link(exceptionCall, doUnwinding);
    344344
    345         return FINALIZE_CODE(linkBuffer, "WebAssembly->JavaScript import[%i] %s", importIndex, signature.toString().ascii().data());
     345        return FINALIZE_CODE(linkBuffer, NoPtrTag, "WebAssembly->JavaScript import[%i] %s", importIndex, signature.toString().ascii().data());
    346346    }
    347347
     
    547547        slowPath.link(&jit);
    548548        jit.setupArguments<decltype(convertToI32)>(GPRInfo::returnValueGPR);
    549         auto call = jit.call();
     549        auto call = jit.call(NoPtrTag);
    550550        exceptionChecks.append(jit.emitJumpIfException(*vm));
    551551
     
    582582        notANumber.link(&jit);
    583583        jit.setupArguments<decltype(convertToF32)>(GPRInfo::returnValueGPR);
    584         auto call = jit.call();
     584        auto call = jit.call(NoPtrTag);
    585585        exceptionChecks.append(jit.emitJumpIfException(*vm));
    586586
     
    616616        notANumber.link(&jit);
    617617        jit.setupArguments<decltype(convertToF64)>(GPRInfo::returnValueGPR);
    618         auto call = jit.call();
     618        auto call = jit.call(NoPtrTag);
    619619        exceptionChecks.append(jit.emitJumpIfException(*vm));
    620620
     
    635635        jit.copyCalleeSavesToEntryFrameCalleeSavesBuffer(vm->topEntryFrame);
    636636        jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
    637         auto call = jit.call();
     637        auto call = jit.call(NoPtrTag);
    638638        jit.jumpToExceptionHandler(*vm);
    639639
     
    660660    callLinkInfo->setCallLocations(callReturnLocation, hotPathBegin, hotPathOther);
    661661
    662     return FINALIZE_CODE(patchBuffer, "WebAssembly->JavaScript import[%i] %s", importIndex, signature.toString().ascii().data());
     662    return FINALIZE_CODE(patchBuffer, NoPtrTag, "WebAssembly->JavaScript import[%i] %s", importIndex, signature.toString().ascii().data());
    663663}
    664664
  • trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp

    r229444 r229609  
    4242template<YarrJITCompileMode compileMode>
    4343class YarrGenerator : private MacroAssembler {
    44     friend void jitCompile(VM*, YarrCodeBlock& jitObject, const String& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase, bool multiline);
     44    friend void jitCompile(VM*, YarrCodeBlock&, const String& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase, bool multiline);
    4545
    4646#if CPU(ARM)
     
    605605    void loadFromFrameAndJump(unsigned frameLocation)
    606606    {
    607         jump(Address(stackPointerRegister, frameLocation * sizeof(void*)));
     607        jump(Address(stackPointerRegister, frameLocation * sizeof(void*)), ptrTag(YarrBacktrackPtrTag, &m_codeBlock));
    608608    }
    609609
     
    928928
    929929        // Called at the end of code generation to link all return addresses.
    930         void linkDataLabels(LinkBuffer& linkBuffer)
     930        void linkDataLabels(LinkBuffer& linkBuffer, YarrCodeBlock& codeBlock)
    931931        {
    932932            ASSERT(isEmpty());
    933933            for (unsigned i = 0; i < m_backtrackRecords.size(); ++i)
    934                 linkBuffer.patch(m_backtrackRecords[i].m_dataLabel, linkBuffer.locationOf(m_backtrackRecords[i].m_backtrackLocation));
     934                linkBuffer.patch(m_backtrackRecords[i].m_dataLabel, linkBuffer.locationOf(m_backtrackRecords[i].m_backtrackLocation, ptrTag(YarrBacktrackPtrTag, &codeBlock)));
    935935        }
    936936
     
    32833283        m_tryReadUnicodeCharacterEntry = label();
    32843284
     3285#if CPU(ARM64)
     3286        tagPtr(linkRegister, stackPointerRegister);
     3287#endif
     3288
    32853289        tryReadUnicodeCharImpl(regT0);
    32863290
     
    33443348    #endif
    33453349#elif CPU(ARM64)
     3350        tagPtr(linkRegister, stackPointerRegister);
    33463351        if (m_decodeSurrogatePairs) {
    33473352            pushPair(framePointerRegister, linkRegister);
     
    34183423
    34193424public:
    3420     YarrGenerator(VM* vm, YarrPattern& pattern, YarrCharSize charSize)
     3425    YarrGenerator(VM* vm, YarrPattern& pattern, YarrCodeBlock& codeBlock, YarrCharSize charSize)
    34213426        : m_vm(vm)
    34223427        , m_pattern(pattern)
     3428        , m_codeBlock(codeBlock)
    34233429        , m_charSize(charSize)
    34243430        , m_decodeSurrogatePairs(m_charSize == Char16 && m_pattern.unicode())
     
    34323438    }
    34333439
    3434     void compile(YarrCodeBlock& jitObject)
    3435     {
     3440    void compile()
     3441    {
     3442        YarrCodeBlock& codeBlock = m_codeBlock;
     3443
    34363444#ifndef JIT_UNICODE_EXPRESSIONS
    34373445        if (m_decodeSurrogatePairs) {
    3438             jitObject.setFallBackWithFailureReason(JITFailureReason::DecodeSurrogatePair);
     3446            codeBlock.setFallBackWithFailureReason(JITFailureReason::DecodeSurrogatePair);
    34393447            return;
    34403448        }
     
    34433451#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
    34443452        if (m_containsNestedSubpatterns)
    3445             jitObject.setUsesPaternContextBuffer();
     3453            codeBlock.setUsesPaternContextBuffer();
    34463454#endif
    34473455
     
    34513459       
    34523460        if (m_failureReason) {
    3453             jitObject.setFallBackWithFailureReason(*m_failureReason);
     3461            codeBlock.setFallBackWithFailureReason(*m_failureReason);
    34543462            return;
    34553463        }
     
    34983506        LinkBuffer linkBuffer(*this, REGEXP_CODE_ID, JITCompilationCanFail);
    34993507        if (linkBuffer.didFailToAllocate()) {
    3500             jitObject.setFallBackWithFailureReason(JITFailureReason::ExecutableMemoryAllocationFailure);
     3508            codeBlock.setFallBackWithFailureReason(JITFailureReason::ExecutableMemoryAllocationFailure);
    35013509            return;
    35023510        }
    35033511
    35043512        if (!m_tryReadUnicodeCharacterCalls.isEmpty()) {
    3505             CodeLocationLabel tryReadUnicodeCharacterHelper = linkBuffer.locationOf(m_tryReadUnicodeCharacterEntry);
     3513            CodeLocationLabel tryReadUnicodeCharacterHelper = linkBuffer.locationOf(m_tryReadUnicodeCharacterEntry, NearCallPtrTag);
    35063514
    35073515            for (auto call : m_tryReadUnicodeCharacterCalls)
     
    35093517        }
    35103518
    3511         m_backtrackingState.linkDataLabels(linkBuffer);
     3519        m_backtrackingState.linkDataLabels(linkBuffer, codeBlock);
    35123520
    35133521        if (compileMode == MatchOnly) {
    35143522            if (m_charSize == Char8)
    3515                 jitObject.set8BitCodeMatchOnly(FINALIZE_CODE(linkBuffer, "Match-only 8-bit regular expression"));
     3523                codeBlock.set8BitCodeMatchOnly(FINALIZE_CODE(linkBuffer, ptrTag(YarrMatchOnly8BitPtrTag, &codeBlock), "Match-only 8-bit regular expression"));
    35163524            else
    3517                 jitObject.set16BitCodeMatchOnly(FINALIZE_CODE(linkBuffer, "Match-only 16-bit regular expression"));
     3525                codeBlock.set16BitCodeMatchOnly(FINALIZE_CODE(linkBuffer, ptrTag(YarrMatchOnly16BitPtrTag, &codeBlock), "Match-only 16-bit regular expression"));
    35183526        } else {
    35193527            if (m_charSize == Char8)
    3520                 jitObject.set8BitCode(FINALIZE_CODE(linkBuffer, "8-bit regular expression"));
     3528                codeBlock.set8BitCode(FINALIZE_CODE(linkBuffer, ptrTag(Yarr8BitPtrTag, &codeBlock), "8-bit regular expression"));
    35213529            else
    3522                 jitObject.set16BitCode(FINALIZE_CODE(linkBuffer, "16-bit regular expression"));
     3530                codeBlock.set16BitCode(FINALIZE_CODE(linkBuffer, ptrTag(Yarr16BitPtrTag, &codeBlock), "16-bit regular expression"));
    35233531        }
    35243532        if (m_failureReason)
    3525             jitObject.setFallBackWithFailureReason(*m_failureReason);
     3533            codeBlock.setFallBackWithFailureReason(*m_failureReason);
    35263534    }
    35273535
     
    35313539    YarrPattern& m_pattern;
    35323540
     3541    YarrCodeBlock& m_codeBlock;
    35333542    YarrCharSize m_charSize;
    35343543
     
    35923601}
    35933602
    3594 void jitCompile(YarrPattern& pattern, YarrCharSize charSize, VM* vm, YarrCodeBlock& jitObject, YarrJITCompileMode mode)
     3603void jitCompile(YarrPattern& pattern, YarrCharSize charSize, VM* vm, YarrCodeBlock& codeBlock, YarrJITCompileMode mode)
    35953604{
    35963605    if (mode == MatchOnly)
    3597         YarrGenerator<MatchOnly>(vm, pattern, charSize).compile(jitObject);
     3606        YarrGenerator<MatchOnly>(vm, pattern, codeBlock, charSize).compile();
    35983607    else
    3599         YarrGenerator<IncludeSubpatterns>(vm, pattern, charSize).compile(jitObject);
    3600 
    3601     if (auto failureReason = jitObject.failureReason()) {
     3608        YarrGenerator<IncludeSubpatterns>(vm, pattern, codeBlock, charSize).compile();
     3609
     3610    if (auto failureReason = codeBlock.failureReason()) {
    36023611        if (Options::dumpCompiledRegExpPatterns())
    36033612            dumpCompileFailure(*failureReason);
  • trunk/Source/JavaScriptCore/yarr/YarrJIT.h

    r228481 r229609  
    11/*
    2  * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    102102    {
    103103        ASSERT(has8BitCode());
    104         return MatchResult(reinterpret_cast<YarrJITCode8>(m_ref8.code().executableAddress())(input, start, length, output, freeParenContext, parenContextSize));
     104        return MatchResult(untagCFunctionPtr<YarrJITCode8>(m_ref8.code().executableAddress(), ptrTag(Yarr8BitPtrTag, this))(input, start, length, output, freeParenContext, parenContextSize));
    105105    }
    106106
     
    108108    {
    109109        ASSERT(has16BitCode());
    110         return MatchResult(reinterpret_cast<YarrJITCode16>(m_ref16.code().executableAddress())(input, start, length, output, freeParenContext, parenContextSize));
     110        return MatchResult(untagCFunctionPtr<YarrJITCode16>(m_ref16.code().executableAddress(), ptrTag(Yarr16BitPtrTag, this))(input, start, length, output, freeParenContext, parenContextSize));
    111111    }
    112112
     
    114114    {
    115115        ASSERT(has8BitCodeMatchOnly());
    116         return MatchResult(reinterpret_cast<YarrJITCodeMatchOnly8>(m_matchOnly8.code().executableAddress())(input, start, length, 0, freeParenContext, parenContextSize));
     116        return MatchResult(untagCFunctionPtr<YarrJITCodeMatchOnly8>(m_matchOnly8.code().executableAddress(), ptrTag(YarrMatchOnly8BitPtrTag, this))(input, start, length, 0, freeParenContext, parenContextSize));
    117117    }
    118118
     
    120120    {
    121121        ASSERT(has16BitCodeMatchOnly());
    122         return MatchResult(reinterpret_cast<YarrJITCodeMatchOnly16>(m_matchOnly16.code().executableAddress())(input, start, length, 0, freeParenContext, parenContextSize));
     122        return MatchResult(untagCFunctionPtr<YarrJITCodeMatchOnly16>(m_matchOnly16.code().executableAddress(), ptrTag(YarrMatchOnly16BitPtrTag, this))(input, start, length, 0, freeParenContext, parenContextSize));
    123123    }
    124124#else
  • trunk/Source/WebCore/ChangeLog

    r229603 r229609  
     12018-03-14  Mark Lam  <mark.lam@apple.com>
     2
     3        Enhance the MacroAssembler and LinkBuffer to support pointer profiling.
     4        https://bugs.webkit.org/show_bug.cgi?id=183623
     5        <rdar://problem/38443314>
     6
     7        Reviewed by Michael Saboff.
     8
     9        No new tests.  Just adding PtrTags required by new MacroAssembler API.
     10
     11        * cssjit/FunctionCall.h:
     12        (WebCore::FunctionCall::prepareAndCall):
     13        * cssjit/SelectorCompiler.cpp:
     14        (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
     15
    1162018-03-14  Chris Fleizach  <cfleizach@apple.com>
    217
  • trunk/Source/WebCore/cssjit/FunctionCall.h

    r208646 r229609  
    148148        }
    149149
    150         JSC::MacroAssembler::Call call = m_assembler.call();
     150        JSC::MacroAssembler::Call call = m_assembler.call(JSC::CFunctionPtrTag);
    151151        m_callRegistry.append(std::make_pair(call, m_functionAddress));
    152152    }
  • trunk/Source/WebCore/cssjit/SelectorCompiler.cpp

    r229537 r229609  
    12451245
    12461246#if CSS_SELECTOR_JIT_DEBUGGING
    1247     codeRef = linkBuffer.finalizeCodeWithDisassembly("CSS Selector JIT for \"%s\"", m_originalSelector->selectorText().utf8().data());
     1247    codeRef = linkBuffer.finalizeCodeWithDisassembly(JSC::NoPtrTag, "CSS Selector JIT for \"%s\"", m_originalSelector->selectorText().utf8().data());
    12481248#else
    1249     codeRef = FINALIZE_CODE(linkBuffer, "CSS Selector JIT");
     1249    codeRef = FINALIZE_CODE(linkBuffer, JSC::NoPtrTag, "CSS Selector JIT");
    12501250#endif
    12511251
Note: See TracChangeset for help on using the changeset viewer.