Changeset 230444 in webkit
- Timestamp:
- Apr 9, 2018, 10:42:01 AM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r230403 r230444 1 2018-04-08 Mark Lam <mark.lam@apple.com> 2 3 Add pointer profiling to the FTL and supporting code. 4 https://bugs.webkit.org/show_bug.cgi?id=184395 5 <rdar://problem/39264019> 6 7 Reviewed by Michael Saboff and Filip Pizlo. 8 9 * assembler/CodeLocation.h: 10 (JSC::CodeLocationLabel::retagged): 11 (JSC::CodeLocationJump::retagged): 12 * assembler/LinkBuffer.h: 13 (JSC::LinkBuffer::locationOf): 14 * dfg/DFGJITCompiler.cpp: 15 (JSC::DFG::JITCompiler::linkOSRExits): 16 (JSC::DFG::JITCompiler::link): 17 * ftl/FTLCompile.cpp: 18 (JSC::FTL::compile): 19 * ftl/FTLExceptionTarget.cpp: 20 (JSC::FTL::ExceptionTarget::label): 21 (JSC::FTL::ExceptionTarget::jumps): 22 * ftl/FTLExceptionTarget.h: 23 * ftl/FTLJITCode.cpp: 24 (JSC::FTL::JITCode::executableAddressAtOffset): 25 * ftl/FTLLazySlowPath.cpp: 26 (JSC::FTL::LazySlowPath::~LazySlowPath): 27 (JSC::FTL::LazySlowPath::initialize): 28 (JSC::FTL::LazySlowPath::generate): 29 (JSC::FTL::LazySlowPath::LazySlowPath): Deleted. 30 * ftl/FTLLazySlowPath.h: 31 * ftl/FTLLink.cpp: 32 (JSC::FTL::link): 33 * ftl/FTLLowerDFGToB3.cpp: 34 (JSC::FTL::DFG::LowerDFGToB3::lower): 35 (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstruct): 36 (JSC::FTL::DFG::LowerDFGToB3::compileDirectCallOrConstruct): 37 (JSC::FTL::DFG::LowerDFGToB3::compileTailCall): 38 (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread): 39 (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs): 40 (JSC::FTL::DFG::LowerDFGToB3::compileCallEval): 41 (JSC::FTL::DFG::LowerDFGToB3::lazySlowPath): 42 * ftl/FTLOSRExitCompiler.cpp: 43 (JSC::FTL::compileStub): 44 (JSC::FTL::compileFTLOSRExit): 45 * ftl/FTLOSRExitHandle.cpp: 46 (JSC::FTL::OSRExitHandle::emitExitThunk): 47 * ftl/FTLOperations.cpp: 48 (JSC::FTL::compileFTLLazySlowPath): 49 * ftl/FTLOutput.h: 50 (JSC::FTL::Output::callWithoutSideEffects): 51 (JSC::FTL::Output::operation): 52 * ftl/FTLPatchpointExceptionHandle.cpp: 53 (JSC::FTL::PatchpointExceptionHandle::scheduleExitCreationForUnwind): 54 * ftl/FTLSlowPathCall.cpp: 55 (JSC::FTL::SlowPathCallContext::makeCall): 56 * ftl/FTLSlowPathCallKey.h: 57 (JSC::FTL::SlowPathCallKey::withCallTarget): 58 (JSC::FTL::SlowPathCallKey::callPtrTag const): 59 * ftl/FTLThunks.cpp: 60 (JSC::FTL::genericGenerationThunkGenerator): 61 (JSC::FTL::osrExitGenerationThunkGenerator): 62 (JSC::FTL::lazySlowPathGenerationThunkGenerator): 63 (JSC::FTL::slowPathCallThunkGenerator): 64 * jit/JITMathIC.h: 65 (JSC::isProfileEmpty): 66 * jit/Repatch.cpp: 67 (JSC::readPutICCallTarget): 68 (JSC::ftlThunkAwareRepatchCall): 69 (JSC::tryCacheGetByID): 70 (JSC::repatchGetByID): 71 (JSC::tryCachePutByID): 72 (JSC::repatchPutByID): 73 (JSC::repatchIn): 74 (JSC::resetGetByID): 75 (JSC::resetPutByID): 76 (JSC::readCallTarget): Deleted. 77 * jit/Repatch.h: 78 * runtime/PtrTag.h: 79 1 80 2018-04-08 Yusuke Suzuki <utatane.tea@gmail.com> 2 81 -
trunk/Source/JavaScriptCore/assembler/CodeLocation.h
r225363 r230444 1 1 /* 2 * Copyright (C) 2009-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2009-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 94 94 explicit CodeLocationLabel(void* location) 95 95 : CodeLocationCommon(MacroAssemblerCodePtr(location)) {} 96 97 CodeLocationLabel retagged(PtrTag oldTag, PtrTag newTag) { return CodeLocationLabel(MacroAssemblerCodePtr::retagged(oldTag, newTag)); } 96 98 }; 97 99 … … 103 105 explicit CodeLocationJump(void* location) 104 106 : CodeLocationCommon(MacroAssemblerCodePtr(location)) {} 107 108 CodeLocationJump retagged(PtrTag oldTag, PtrTag newTag) { return CodeLocationJump(MacroAssemblerCodePtr::retagged(oldTag, newTag)); } 105 109 }; 106 110 -
trunk/Source/JavaScriptCore/assembler/LinkBuffer.h
r230129 r230444 187 187 } 188 188 189 CodeLocationLabel locationOf(PatchableJump jump )190 { 191 return CodeLocationLabel(MacroAssembler::getLinkerAddress(code(), applyOffset(jump.m_jump.m_label) ));189 CodeLocationLabel locationOf(PatchableJump jump, PtrTag tag = NoPtrTag) 190 { 191 return CodeLocationLabel(MacroAssembler::getLinkerAddress(code(), applyOffset(jump.m_jump.m_label), tag)); 192 192 } 193 193 -
trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
r230294 r230444 1 1 /* 2 * Copyright (C) 2011-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2011-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 87 87 88 88 MacroAssemblerCodeRef osrExitThunk = vm()->getCTIStub(osrExitThunkGenerator); 89 CodeLocationLabel osrExitThunkLabel = CodeLocationLabel(osrExitThunk.code()); 89 PtrTag osrExitThunkTag = ptrTag(DFGOSRExitPtrTag, vm()); 90 CodeLocationLabel osrExitThunkLabel = CodeLocationLabel(osrExitThunk.retaggedCode(osrExitThunkTag, NearJumpPtrTag)); 90 91 for (unsigned i = 0; i < m_jitCode->osrExit.size(); ++i) { 91 92 OSRExitCompilationInfo& info = m_exitCompilationInfo[i]; … … 321 322 322 323 MacroAssemblerCodeRef osrExitThunk = vm()->getCTIStub(osrExitGenerationThunkGenerator); 323 CodeLocationLabel target = CodeLocationLabel(osrExitThunk.code()); 324 PtrTag osrExitThunkTag = ptrTag(DFGOSRExitPtrTag, vm()); 325 CodeLocationLabel target = CodeLocationLabel(osrExitThunk.retaggedCode(osrExitThunkTag, NearJumpPtrTag)); 324 326 for (unsigned i = 0; i < m_jitCode->osrExit.size(); ++i) { 325 327 OSRExitCompilationInfo& info = m_exitCompilationInfo[i]; -
trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp
r229609 r230444 1 1 /* 2 * Copyright (C) 2015-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2015-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 80 80 std::make_unique<RegisterAtOffsetList>(state.proc->calleeSaveRegisterAtOffsetList()); 81 81 if (shouldDumpDisassembly()) 82 dataLog("Unwind info for ", CodeBlockWithJITType( state.graph.m_codeBlock, JITCode::FTLJIT), ": ", *registerOffsets, "\n");83 state.graph.m_codeBlock->setCalleeSaveRegisters(WTFMove(registerOffsets));82 dataLog("Unwind info for ", CodeBlockWithJITType(codeBlock, JITCode::FTLJIT), ": ", *registerOffsets, "\n"); 83 codeBlock->setCalleeSaveRegisters(WTFMove(registerOffsets)); 84 84 ASSERT(!(state.proc->frameSize() % sizeof(EncodedJSValue))); 85 85 state.jitCode->common.frameRegisterCount = state.proc->frameSize() / sizeof(EncodedJSValue); … … 135 135 jit.move(MacroAssembler::TrustedImmPtr(&vm), GPRInfo::argumentGPR0); 136 136 jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1); 137 CCallHelpers::Call call = jit.call(NoPtrTag); 137 PtrTag callTag = ptrTag(FTLOperationPtrTag, nextPtrTagID()); 138 CCallHelpers::Call call = jit.call(callTag); 138 139 jit.jumpToExceptionHandler(vm); 139 140 jit.addLinkTask( 140 141 [=] (LinkBuffer& linkBuffer) { 141 linkBuffer.link(call, FunctionPtr(lookupExceptionHandler ));142 linkBuffer.link(call, FunctionPtr(lookupExceptionHandler, callTag)); 142 143 }); 143 144 … … 153 154 codeBlock->setPCToCodeOriginMap(std::make_unique<PCToCodeOriginMap>(PCToCodeOriginMapBuilder(vm, WTFMove(originMap)), *state.finalizer->b3CodeLinkBuffer)); 154 155 155 CodeLocationLabel label = state.finalizer->b3CodeLinkBuffer->locationOf(state.proc->entrypointLabel(0)); 156 PtrTag entryTag = ptrTag(FTLCodePtrTag, codeBlock); 157 CodeLocationLabel label = state.finalizer->b3CodeLinkBuffer->locationOf(state.proc->entrypointLabel(0), entryTag); 156 158 state.generatedFunction = label.executableAddress<GeneratedFunction>(); 157 159 state.jitCode->initializeB3Byproducts(state.proc->releaseByproducts()); … … 162 164 Vector<FlushFormat> argumentFormats = state.graph.m_argumentFormats[entrypointIndex]; 163 165 state.jitCode->common.appendCatchEntrypoint( 164 catchBytecodeOffset, state.finalizer->b3CodeLinkBuffer->locationOf(state.proc->entrypointLabel(entrypointIndex) ).executableAddress(), WTFMove(argumentFormats));166 catchBytecodeOffset, state.finalizer->b3CodeLinkBuffer->locationOf(state.proc->entrypointLabel(entrypointIndex), ExceptionHandlerPtrTag).executableAddress(), WTFMove(argumentFormats)); 165 167 } 166 168 state.jitCode->common.finalizeCatchEntrypoints(); -
trunk/Source/JavaScriptCore/ftl/FTLExceptionTarget.cpp
r196729 r230444 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 37 37 } 38 38 39 CodeLocationLabel ExceptionTarget::label(LinkBuffer& linkBuffer )39 CodeLocationLabel ExceptionTarget::label(LinkBuffer& linkBuffer, PtrTag handlerTag) 40 40 { 41 41 if (m_isDefaultHandler) 42 return linkBuffer.locationOf(*m_defaultHandler );43 return linkBuffer.locationOf(m_handle->label );42 return linkBuffer.locationOf(*m_defaultHandler, handlerTag); 43 return linkBuffer.locationOf(m_handle->label, handlerTag); 44 44 } 45 45 … … 51 51 jit.addLinkTask( 52 52 [=] (LinkBuffer& linkBuffer) { 53 linkBuffer.link(*result, linkBuffer.locationOf(*defaultHandler ));53 linkBuffer.link(*result, linkBuffer.locationOf(*defaultHandler, ExceptionHandlerPtrTag)); 54 54 }); 55 55 } else { … … 57 57 jit.addLinkTask( 58 58 [=] (LinkBuffer& linkBuffer) { 59 linkBuffer.link(*result, linkBuffer.locationOf(handle->label ));59 linkBuffer.link(*result, linkBuffer.locationOf(handle->label, DFGOSRExitPtrTag)); 60 60 }); 61 61 } -
trunk/Source/JavaScriptCore/ftl/FTLExceptionTarget.h
r206525 r230444 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 44 44 45 45 // It's OK to call this during linking, but not any sooner. 46 CodeLocationLabel label(LinkBuffer& );46 CodeLocationLabel label(LinkBuffer&, PtrTag handlerTag); 47 47 48 48 // Or, you can get a JumpList at any time. Anything you add to this JumpList will be linked to -
trunk/Source/JavaScriptCore/ftl/FTLJITCode.cpp
r225363 r230444 1 1 /* 2 * Copyright (C) 2013 , 2015-2016Apple Inc. All rights reserved.2 * Copyright (C) 2013-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 31 31 #include "FTLState.h" 32 #include "PtrTag.h" 32 33 33 34 namespace JSC { namespace FTL { … … 86 87 { 87 88 return m_addressForCall.executableAddress<char*>() + offset; 89 assertIsTaggedWith(m_addressForCall.executableAddress(), CodeEntryPtrTag); 90 if (!offset) 91 return m_addressForCall.executableAddress(); 92 93 char* executableAddress = untagCodePtr<char*>(m_addressForCall.executableAddress(), CodeEntryPtrTag); 94 return tagCodePtr(executableAddress + offset, CodeEntryPtrTag); 88 95 } 89 96 -
trunk/Source/JavaScriptCore/ftl/FTLLazySlowPath.cpp
r229609 r230444 34 34 namespace JSC { namespace FTL { 35 35 36 LazySlowPath::LazySlowPath( 36 LazySlowPath::~LazySlowPath() 37 { 38 } 39 40 void LazySlowPath::initialize( 37 41 CodeLocationJump patchableJump, CodeLocationLabel done, 38 42 CodeLocationLabel exceptionTarget, 39 43 const RegisterSet& usedRegisters, CallSiteIndex callSiteIndex, RefPtr<Generator> generator 40 44 ) 41 : m_patchableJump(patchableJump)42 , m_done(done)43 , m_exceptionTarget(exceptionTarget)44 , m_usedRegisters(usedRegisters)45 , m_callSiteIndex(callSiteIndex)46 , m_generator(generator)47 45 { 48 } 49 50 LazySlowPath::~LazySlowPath() 51 { 46 m_patchableJump = patchableJump; 47 m_done = done; 48 m_exceptionTarget = exceptionTarget; 49 m_usedRegisters = usedRegisters; 50 m_callSiteIndex = callSiteIndex; 51 m_generator = generator; 52 52 } 53 53 … … 64 64 m_generator->run(jit, params); 65 65 66 PtrTag slowPathTag = ptrTag(FTLLazySlowPathPtrTag, bitwise_cast<PtrTag>(this)); 66 67 LinkBuffer linkBuffer(jit, codeBlock, JITCompilationMustSucceed); 67 linkBuffer.link(params.doneJumps, m_done );68 linkBuffer.link(params.doneJumps, m_done.retagged(slowPathTag, NearJumpPtrTag)); 68 69 if (m_exceptionTarget) 69 linkBuffer.link(exceptionJumps, m_exceptionTarget );70 m_stub = FINALIZE_CODE_FOR(codeBlock, linkBuffer, NoPtrTag, "Lazy slow path call stub");70 linkBuffer.link(exceptionJumps, m_exceptionTarget.retagged(slowPathTag, NearJumpPtrTag)); 71 m_stub = FINALIZE_CODE_FOR(codeBlock, linkBuffer, slowPathTag, "Lazy slow path call stub"); 71 72 72 MacroAssembler::repatchJump(m_patchableJump , CodeLocationLabel(m_stub.code()));73 MacroAssembler::repatchJump(m_patchableJump.retagged(slowPathTag, NearJumpPtrTag), CodeLocationLabel(m_stub.retaggedCode(slowPathTag, NearJumpPtrTag))); 73 74 } 74 75 -
trunk/Source/JavaScriptCore/ftl/FTLLazySlowPath.h
r206525 r230444 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 64 64 return createSharedTask<GeneratorFunction>(functor); 65 65 } 66 67 LazySlowPath( 66 67 LazySlowPath() = default; 68 69 ~LazySlowPath(); 70 71 void initialize( 68 72 CodeLocationJump patchableJump, CodeLocationLabel done, 69 73 CodeLocationLabel exceptionTarget, const RegisterSet& usedRegisters, 70 74 CallSiteIndex, RefPtr<Generator> 71 75 ); 72 73 ~LazySlowPath();74 76 75 77 CodeLocationJump patchableJump() const { return m_patchableJump; } -
trunk/Source/JavaScriptCore/ftl/FTLLink.cpp
r229609 r230444 1 1 /* 2 * Copyright (C) 2013-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2013-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 141 141 jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); 142 142 jit.storePtr(GPRInfo::callFrameRegister, &vm.topCallFrame); 143 CCallHelpers::Call callArityCheck = jit.call(NoPtrTag); 143 PtrTag callTag = ptrTag(FTLOperationPtrTag, nextPtrTagID()); 144 CCallHelpers::Call callArityCheck = jit.call(callTag); 144 145 145 146 auto noException = jit.branch32(CCallHelpers::GreaterThanOrEqual, GPRInfo::returnValueGPR, CCallHelpers::TrustedImm32(0)); … … 147 148 jit.move(CCallHelpers::TrustedImmPtr(&vm), GPRInfo::argumentGPR0); 148 149 jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1); 149 CCallHelpers::Call callLookupExceptionHandlerFromCallerFrame = jit.call(NoPtrTag); 150 PtrTag lookupTag = ptrTag(FTLOperationPtrTag, nextPtrTagID()); 151 CCallHelpers::Call callLookupExceptionHandlerFromCallerFrame = jit.call(lookupTag); 150 152 jit.jumpToExceptionHandler(vm); 151 153 noException.link(&jit); … … 158 160 jit.move(GPRInfo::returnValueGPR, GPRInfo::argumentGPR0); 159 161 jit.emitFunctionEpilogue(); 162 jit.untagReturnAddress(); 160 163 mainPathJumps.append(jit.branchTest32(CCallHelpers::Zero, GPRInfo::argumentGPR0)); 161 164 jit.emitFunctionPrologue(); 162 CCallHelpers::Call callArityFixup = jit. call(NoPtrTag);165 CCallHelpers::Call callArityFixup = jit.nearCall(); 163 166 jit.emitFunctionEpilogue(); 167 jit.untagReturnAddress(); 164 168 mainPathJumps.append(jit.jump()); 165 169 … … 169 173 return; 170 174 } 171 linkBuffer->link(callArityCheck, codeBlock->m_isConstructor ? operationConstructArityCheck : operationCallArityCheck);172 linkBuffer->link(callLookupExceptionHandlerFromCallerFrame, lookupExceptionHandlerFromCallerFrame);173 linkBuffer->link(callArityFixup, FunctionPtr( (vm.getCTIStub(arityFixupGenerator)).code()));175 linkBuffer->link(callArityCheck, FunctionPtr(codeBlock->m_isConstructor ? operationConstructArityCheck : operationCallArityCheck, callTag)); 176 linkBuffer->link(callLookupExceptionHandlerFromCallerFrame, FunctionPtr(lookupExceptionHandlerFromCallerFrame, lookupTag)); 177 linkBuffer->link(callArityFixup, FunctionPtr(vm.getCTIStub(arityFixupGenerator).retaggedCode(ptrTag(ArityFixupPtrTag, &vm), NearCallPtrTag))); 174 178 linkBuffer->link(mainPathJumps, CodeLocationLabel(bitwise_cast<void*>(state.generatedFunction))); 175 179 } 176 180 177 state.jitCode->initializeAddressForCall(MacroAssemblerCodePtr(bitwise_cast<void*>(state.generatedFunction))); 181 PtrTag entryTag = ptrTag(FTLCodePtrTag, codeBlock); 182 state.jitCode->initializeAddressForCall(MacroAssemblerCodePtr(retagCodePtr<void*>(state.generatedFunction, entryTag, CodeEntryPtrTag))); 178 183 break; 179 184 } … … 186 191 CCallHelpers::Label start = jit.label(); 187 192 jit.emitFunctionEpilogue(); 193 jit.untagReturnAddress(); 188 194 CCallHelpers::Jump mainPathJump = jit.jump(); 189 195 … … 195 201 linkBuffer->link(mainPathJump, CodeLocationLabel(bitwise_cast<void*>(state.generatedFunction))); 196 202 197 state.jitCode->initializeAddressForCall(linkBuffer->locationOf(start ));203 state.jitCode->initializeAddressForCall(linkBuffer->locationOf(start, CodeEntryPtrTag)); 198 204 break; 199 205 } -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r230376 r230444 287 287 jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); 288 288 jit.move(CCallHelpers::TrustedImmPtr(jit.codeBlock()), GPRInfo::argumentGPR1); 289 CCallHelpers::Call throwCall = jit.call(NoPtrTag); 289 PtrTag throwTag = ptrTag(FTLOperationPtrTag, nextPtrTagID()); 290 CCallHelpers::Call throwCall = jit.call(throwTag); 290 291 291 292 jit.move(CCallHelpers::TrustedImmPtr(vm), GPRInfo::argumentGPR0); 292 293 jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1); 293 CCallHelpers::Call lookupExceptionHandlerCall = jit.call(NoPtrTag); 294 PtrTag lookupTag = ptrTag(FTLOperationPtrTag, nextPtrTagID()); 295 CCallHelpers::Call lookupExceptionHandlerCall = jit.call(lookupTag); 294 296 jit.jumpToExceptionHandler(*vm); 295 297 296 298 jit.addLinkTask( 297 299 [=] (LinkBuffer& linkBuffer) { 298 linkBuffer.link(throwCall, FunctionPtr(operationThrowStackOverflowError ));299 linkBuffer.link(lookupExceptionHandlerCall, FunctionPtr(lookupExceptionHandlerFromCallerFrame ));300 linkBuffer.link(throwCall, FunctionPtr(operationThrowStackOverflowError, throwTag)); 301 linkBuffer.link(lookupExceptionHandlerCall, FunctionPtr(lookupExceptionHandlerFromCallerFrame, lookupTag)); 300 302 }); 301 303 }); … … 364 366 jit.addLinkTask( 365 367 [=] (LinkBuffer& linkBuffer) { 366 linkBuffer.link(jump, linkBuffer.locationOf(*exceptionHandler ));368 linkBuffer.link(jump, linkBuffer.locationOf(*exceptionHandler, ExceptionHandlerPtrTag)); 367 369 }); 368 370 }); … … 7146 7148 jit.addLinkTask( 7147 7149 [=] (LinkBuffer& linkBuffer) { 7150 PtrTag linkTag = ptrTag(LinkCallPtrTag, vm); 7148 7151 MacroAssemblerCodePtr linkCall = 7149 vm->getCTIStub(linkCallThunkGenerator). code();7152 vm->getCTIStub(linkCallThunkGenerator).retaggedCode(linkTag, NearCallPtrTag); 7150 7153 linkBuffer.link(slowCall, FunctionPtr(linkCall)); 7151 7154 … … 7295 7298 CodeLocationLabel patchableJumpLocation = linkBuffer.locationOf(patchableJump); 7296 7299 CodeLocationNearCall callLocation = linkBuffer.locationOfNearCall(call); 7297 CodeLocationLabel slowPathLocation = linkBuffer.locationOf(slowPath );7300 CodeLocationLabel slowPathLocation = linkBuffer.locationOf(slowPath, SlowPathPtrTag); 7298 7301 7299 7302 callLinkInfo->setCallLocations( … … 7343 7346 [=] (LinkBuffer& linkBuffer) { 7344 7347 CodeLocationNearCall callLocation = linkBuffer.locationOfNearCall(call); 7345 CodeLocationLabel slowPathLocation = linkBuffer.locationOf(slowPath );7348 CodeLocationLabel slowPathLocation = linkBuffer.locationOf(slowPath, NearCallPtrTag); 7346 7349 7347 7350 linkBuffer.link(call, slowPathLocation); … … 7467 7470 jit.addLinkTask( 7468 7471 [=] (LinkBuffer& linkBuffer) { 7472 PtrTag linkTag = ptrTag(LinkCallPtrTag, vm); 7469 7473 MacroAssemblerCodePtr linkCall = 7470 vm->getCTIStub(linkCallThunkGenerator). code();7474 vm->getCTIStub(linkCallThunkGenerator).retaggedCode(linkTag, NearCallPtrTag); 7471 7475 linkBuffer.link(slowCall, FunctionPtr(linkCall)); 7472 7476 … … 7611 7615 7612 7616 auto callWithExceptionCheck = [&] (void* callee) { 7613 jit.move(CCallHelpers::TrustedImmPtr(callee), GPRInfo::nonPreservedNonArgumentGPR0); 7614 jit.call(GPRInfo::nonPreservedNonArgumentGPR0, NoPtrTag); 7617 PtrTag tag = ptrTag(FTLOperationPtrTag, nextPtrTagID()); 7618 jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr(callee, tag)), GPRInfo::nonPreservedNonArgumentGPR0); 7619 jit.call(GPRInfo::nonPreservedNonArgumentGPR0, tag); 7615 7620 exceptions->append(jit.emitExceptionCheck(*vm, AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth)); 7616 7621 }; … … 7766 7771 jit.addLinkTask( 7767 7772 [=] (LinkBuffer& linkBuffer) { 7773 PtrTag linkTag = ptrTag(LinkCallPtrTag, vm); 7768 7774 MacroAssemblerCodePtr linkCall = 7769 vm->getCTIStub(linkCallThunkGenerator). code();7775 vm->getCTIStub(linkCallThunkGenerator).retaggedCode(linkTag, NearCallPtrTag); 7770 7776 linkBuffer.link(slowCall, FunctionPtr(linkCall)); 7771 7777 … … 7950 7956 7951 7957 auto callWithExceptionCheck = [&] (void* callee) { 7952 jit.move(CCallHelpers::TrustedImmPtr(callee), GPRInfo::nonPreservedNonArgumentGPR0); 7953 jit.call(GPRInfo::nonPreservedNonArgumentGPR0, NoPtrTag); 7958 PtrTag tag = ptrTag(FTLOperationPtrTag, nextPtrTagID()); 7959 jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr(callee, tag)), GPRInfo::nonPreservedNonArgumentGPR0); 7960 jit.call(GPRInfo::nonPreservedNonArgumentGPR0, tag); 7954 7961 exceptions->append(jit.emitExceptionCheck(*vm, AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth)); 7955 7962 }; … … 8049 8056 jit.addLinkTask( 8050 8057 [=] (LinkBuffer& linkBuffer) { 8058 PtrTag linkTag = ptrTag(LinkCallPtrTag, vm); 8051 8059 MacroAssemblerCodePtr linkCall = 8052 vm->getCTIStub(linkCallThunkGenerator). code();8060 vm->getCTIStub(linkCallThunkGenerator).retaggedCode(linkTag, NearCallPtrTag); 8053 8061 linkBuffer.link(slowCall, FunctionPtr(linkCall)); 8054 8062 … … 8138 8146 jit.subPtr(CCallHelpers::TrustedImm32(requiredBytes), CCallHelpers::stackPointerRegister); 8139 8147 jit.setupArguments<decltype(operationCallEval)>(GPRInfo::regT1); 8140 jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(operationCallEval)), GPRInfo::nonPreservedNonArgumentGPR0); 8141 jit.call(GPRInfo::nonPreservedNonArgumentGPR0, NoPtrTag); 8148 PtrTag tag = ptrTag(FTLOperationPtrTag, nextPtrTagID()); 8149 jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr(operationCallEval, tag)), GPRInfo::nonPreservedNonArgumentGPR0); 8150 jit.call(GPRInfo::nonPreservedNonArgumentGPR0, tag); 8142 8151 exceptions->append(jit.emitExceptionCheck(state->vm(), AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth)); 8143 8152 … … 13958 13967 jit.addLinkTask( 13959 13968 [=] (LinkBuffer& linkBuffer) { 13969 PtrTag thunkTag = ptrTag(FTLLazySlowPathPtrTag, vm); 13960 13970 linkBuffer.link( 13961 13971 generatorJump, CodeLocationLabel( 13962 13972 vm->getCTIStub( 13963 lazySlowPathGenerationThunkGenerator). code()));13973 lazySlowPathGenerationThunkGenerator).retaggedCode(thunkTag, NearJumpPtrTag))); 13964 13974 13975 std::unique_ptr<LazySlowPath> lazySlowPath = std::make_unique<LazySlowPath>(); 13976 13977 PtrTag slowPathTag = ptrTag(FTLLazySlowPathPtrTag, bitwise_cast<PtrTag>(lazySlowPath.get())); 13965 13978 CodeLocationJump linkedPatchableJump = CodeLocationJump( 13966 linkBuffer.locationOf(patchableJump)); 13967 CodeLocationLabel linkedDone = linkBuffer.locationOf(done); 13979 linkBuffer.locationOf(patchableJump, slowPathTag)); 13980 13981 CodeLocationLabel linkedDone = linkBuffer.locationOf(done, slowPathTag); 13968 13982 13969 13983 CallSiteIndex callSiteIndex = 13970 13984 jitCode->common.addUniqueCallSiteIndex(origin); 13971 13985 13972 std::unique_ptr<LazySlowPath> lazySlowPath = 13973 std::make_unique<LazySlowPath>( 13986 lazySlowPath->initialize( 13974 13987 linkedPatchableJump, linkedDone, 13975 exceptionTarget->label(linkBuffer ), usedRegisters,13988 exceptionTarget->label(linkBuffer, slowPathTag), usedRegisters, 13976 13989 callSiteIndex, generator); 13977 13990 -
trunk/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
r229609 r230444 177 177 178 178 static void compileStub( 179 unsigned exitID, JITCode* jitCode, OSRExit& exit, VM* vm, CodeBlock* codeBlock )179 unsigned exitID, JITCode* jitCode, OSRExit& exit, VM* vm, CodeBlock* codeBlock, PtrTag exitSiteTag) 180 180 { 181 181 // This code requires framePointerRegister is the same as callFrameRegister … … 339 339 CCallHelpers::TrustedImmPtr(materialization), 340 340 CCallHelpers::TrustedImmPtr(materializationArguments)); 341 jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(operationMaterializeObjectInOSR)), GPRInfo::nonArgGPR0); 342 jit.call(GPRInfo::nonArgGPR0, NoPtrTag); 341 PtrTag tag = ptrTag(FTLOperationPtrTag, nextPtrTagID()); 342 jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr(operationMaterializeObjectInOSR, tag)), GPRInfo::nonArgGPR0); 343 jit.call(GPRInfo::nonArgGPR0, tag); 343 344 jit.storePtr(GPRInfo::returnValueGPR, materializationToPointer.get(materialization)); 344 345 … … 367 368 CCallHelpers::TrustedImmPtr(materializationToPointer.get(materialization)), 368 369 CCallHelpers::TrustedImmPtr(materializationArguments)); 369 jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(operationPopulateObjectInOSR)), GPRInfo::nonArgGPR0); 370 jit.call(GPRInfo::nonArgGPR0, NoPtrTag); 370 PtrTag tag = ptrTag(FTLOperationPtrTag, nextPtrTagID()); 371 jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr(operationPopulateObjectInOSR, tag)), GPRInfo::nonArgGPR0); 372 jit.call(GPRInfo::nonArgGPR0, tag); 371 373 } 372 374 … … 495 497 exit.m_code = FINALIZE_CODE_IF( 496 498 shouldDumpDisassembly() || Options::verboseOSR() || Options::verboseFTLOSRExit(), 497 patchBuffer, NoPtrTag,499 patchBuffer, exitSiteTag, 498 500 "FTL OSR exit #%u (%s, %s) from %s, with operands = %s", 499 501 exitID, toCString(exit.m_codeOrigin).data(), … … 543 545 prepareCodeOriginForOSRExit(exec, exit.m_codeOrigin); 544 546 545 compileStub(exitID, jitCode, exit, &vm, codeBlock); 547 PtrTag thunkTag = ptrTag(FTLOSRExitPtrTag, &exit); 548 compileStub(exitID, jitCode, exit, &vm, codeBlock, thunkTag); 546 549 547 550 MacroAssembler::repatchJump( 548 exit.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code. code()));549 550 return exit.m_code. code().executableAddress();551 exit.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code.retaggedCode(thunkTag, NearJumpPtrTag))); 552 553 return exit.m_code.retaggedCode(thunkTag, bitwise_cast<PtrTag>(exec)).executableAddress(); 551 554 } 552 555 -
trunk/Source/JavaScriptCore/ftl/FTLOSRExitHandle.cpp
r214571 r230444 1 1 /* 2 * Copyright (C) 2015-201 6Apple Inc. All rights reserved.2 * Copyright (C) 2015-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 50 50 self->exit.m_patchableJump = CodeLocationJump(linkBuffer.locationOf(jump)); 51 51 52 PtrTag thunkTag = ptrTag(FTLOSRExitPtrTag, &vm); 52 53 linkBuffer.link( 53 54 jump.m_jump, 54 CodeLocationLabel(vm.getCTIStub(osrExitGenerationThunkGenerator). code()));55 CodeLocationLabel(vm.getCTIStub(osrExitGenerationThunkGenerator).retaggedCode(thunkTag, NearJumpPtrTag))); 55 56 if (compilation) 56 57 compilation->addOSRExitSite({ linkBuffer.locationOf(myLabel).executableAddress() }); -
trunk/Source/JavaScriptCore/ftl/FTLOperations.cpp
r229842 r230444 1 1 /* 2 * Copyright (C) 2014-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2014-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 582 582 lazySlowPath.generate(codeBlock); 583 583 584 return lazySlowPath.stub().code().executableAddress(); 584 PtrTag slowPathTag = ptrTag(FTLLazySlowPathPtrTag, bitwise_cast<PtrTag>(&lazySlowPath)); 585 return lazySlowPath.stub().retaggedCode(slowPathTag, bitwise_cast<PtrTag>(exec)).executableAddress(); 585 586 } 586 587 -
trunk/Source/JavaScriptCore/ftl/FTLOutput.h
r228420 r230444 1 1 /* 2 * Copyright (C) 2013-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2013-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 402 402 { 403 403 return m_block->appendNew<B3::CCallValue>(m_proc, type, origin(), B3::Effects::none(), 404 constIntPtr(bitwise_cast<void*>(function)), arg1, args...); 405 } 406 404 constIntPtr(tagCFunctionPtr<void*>(function, B3CCallPtrTag)), arg1, args...); 405 } 406 407 // FIXME: Consider enhancing this to allow the client to choose the target PtrTag to use. 408 // https://bugs.webkit.org/show_bug.cgi?id=184324 407 409 template<typename FunctionType> 408 LValue operation(FunctionType function) { return constIntPtr( bitwise_cast<void*>(function)); }410 LValue operation(FunctionType function) { return constIntPtr(tagCFunctionPtr<void*>(function, B3CCallPtrTag)); } 409 411 410 412 void jump(LBasicBlock); -
trunk/Source/JavaScriptCore/ftl/FTLPatchpointExceptionHandle.cpp
r196729 r230444 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 92 92 newHandler.start = callSiteIndex.bits(); 93 93 newHandler.end = callSiteIndex.bits() + 1; 94 newHandler.nativeCode = linkBuffer.locationOf(handle->label );94 newHandler.nativeCode = linkBuffer.locationOf(handle->label, ExceptionHandlerPtrTag); 95 95 codeBlock->appendExceptionHandler(newHandler); 96 96 }); -
trunk/Source/JavaScriptCore/ftl/FTLSlowPathCall.cpp
r229767 r230444 123 123 void* executableAddress = callTarget.executableAddress(); 124 124 assertIsCFunctionPtr(executableAddress); 125 SlowPathCall result = SlowPathCall(m_jit.call(NoPtrTag), keyWithTarget(executableAddress)); 125 SlowPathCallKey key = keyWithTarget(executableAddress); 126 PtrTag callTag = key.callPtrTag(); 127 SlowPathCall result = SlowPathCall(m_jit.call(callTag), key); 126 128 127 129 m_jit.addLinkTask( -
trunk/Source/JavaScriptCore/ftl/FTLSlowPathCallKey.h
r206525 r230444 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 #if ENABLE(FTL_JIT) 29 29 30 #include "PtrTag.h" 30 31 #include "RegisterSet.h" 31 32 … … 67 68 SlowPathCallKey withCallTarget(void* callTarget) 68 69 { 70 assertIsTaggedWith(callTarget, CFunctionPtrTag); 69 71 return SlowPathCallKey(usedRegisters(), callTarget, argumentRegisters(), offset()); 70 72 } … … 103 105 } 104 106 107 PtrTag callPtrTag() const 108 { 109 // We should only include factors which are invariant for the same slow path site. 110 // m_callTarget can vary and should be excluded. 111 return ptrTag(FTLSlowPathPtrTag, m_usedRegisters.hash(), m_offset); 112 } 113 105 114 private: 106 115 RegisterSet m_usedRegisters; -
trunk/Source/JavaScriptCore/ftl/FTLThunks.cpp
r229767 r230444 48 48 49 49 static MacroAssemblerCodeRef genericGenerationThunkGenerator( 50 VM* vm, FunctionPtr generationFunction, const char* name, unsigned extraPopsToRestore, FrameAndStackAdjustmentRequirement frameAndStackAdjustmentRequirement)50 VM* vm, FunctionPtr generationFunction, PtrTag resultThunkTag, const char* name, unsigned extraPopsToRestore, FrameAndStackAdjustmentRequirement frameAndStackAdjustmentRequirement) 51 51 { 52 52 AssemblyHelpers jit(nullptr); … … 87 87 GPRInfo::argumentGPR1, 88 88 (stackMisalignment - MacroAssembler::pushToSaveByteOffset()) / sizeof(void*)); 89 MacroAssembler::Call functionCall = jit.call(NoPtrTag); 89 PtrTag generatorCallTag = ptrTag(FTLOperationPtrTag, nextPtrTagID()); 90 MacroAssembler::Call functionCall = jit.call(generatorCallTag); 90 91 91 92 // At this point we want to make a tail call to what was returned to us in the … … 116 117 restoreAllRegisters(jit, buffer); 117 118 119 #if CPU(ARM64) && USE(POINTER_PROFILING) 120 jit.untagPtr(AssemblyHelpers::linkRegister, GPRInfo::callFrameRegister); 121 jit.tagReturnAddress(); 122 #endif 118 123 jit.ret(); 119 124 120 125 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID); 121 patchBuffer.link(functionCall, generationFunction);122 return FINALIZE_CODE(patchBuffer, NoPtrTag, "%s", name);126 patchBuffer.link(functionCall, FunctionPtr(generationFunction, generatorCallTag)); 127 return FINALIZE_CODE(patchBuffer, resultThunkTag, "%s", name); 123 128 } 124 129 … … 126 131 { 127 132 unsigned extraPopsToRestore = 0; 128 PtrTag t ag = ptrTag(JITThunkPtrTag, nextPtrTagID());133 PtrTag thunkTag = ptrTag(FTLOSRExitPtrTag, vm); 129 134 return genericGenerationThunkGenerator( 130 vm, FunctionPtr(compileFTLOSRExit , tag), "FTL OSR exit generation thunk", extraPopsToRestore, FrameAndStackAdjustmentRequirement::Needed);135 vm, FunctionPtr(compileFTLOSRExit), thunkTag, "FTL OSR exit generation thunk", extraPopsToRestore, FrameAndStackAdjustmentRequirement::Needed); 131 136 } 132 137 … … 134 139 { 135 140 unsigned extraPopsToRestore = 1; 136 PtrTag t ag = ptrTag(JITThunkPtrTag, nextPtrTagID());141 PtrTag thunkTag = ptrTag(FTLLazySlowPathPtrTag, vm); 137 142 return genericGenerationThunkGenerator( 138 vm, FunctionPtr(compileFTLLazySlowPath , tag), "FTL lazy slow path generation thunk", extraPopsToRestore, FrameAndStackAdjustmentRequirement::NotNeeded);143 vm, FunctionPtr(compileFTLLazySlowPath), thunkTag, "FTL lazy slow path generation thunk", extraPopsToRestore, FrameAndStackAdjustmentRequirement::NotNeeded); 139 144 } 140 145 … … 170 175 { 171 176 AssemblyHelpers jit(nullptr); 172 177 jit.tagReturnAddress(); 178 173 179 // We want to save the given registers at the given offset, then we want to save the 174 180 // old return address somewhere past that offset, and then finally we want to make the … … 200 206 registerClobberCheck(jit, key.argumentRegisters()); 201 207 202 PtrTag callTag = ptrTag( JITThunkPtrTag, nextPtrTagID());208 PtrTag callTag = ptrTag(FTLOperationPtrTag, nextPtrTagID()); 203 209 AssemblyHelpers::Call call = jit.call(callTag); 204 210 … … 228 234 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID); 229 235 patchBuffer.link(call, FunctionPtr(key.callTarget(), callTag)); 230 return FINALIZE_CODE(patchBuffer, NoPtrTag, "FTL slow path call thunk for %s", toCString(key).data());236 return FINALIZE_CODE(patchBuffer, key.callPtrTag(), "FTL slow path call thunk for %s", toCString(key).data()); 231 237 } 232 238 -
trunk/Source/JavaScriptCore/jit/JITMathIC.h
r230294 r230444 145 145 146 146 auto replaceCall = [&] () { 147 PtrTag tag = ptrTag(MathICPtrTag, m_instruction);148 ftlThunkAwareRepatchCall(codeBlock, slowPathCallLocation(), FunctionPtr(callReplacement, tag));147 PtrTag callTag = ptrTag(MathICPtrTag, m_instruction); 148 ftlThunkAwareRepatchCall(codeBlock, slowPathCallLocation(), callReplacement, callTag); 149 149 }; 150 150 … … 229 229 start, linkBuffer.locationOf(state.slowPathCall)); 230 230 m_deltaFromStartToSlowPathStart = MacroAssembler::differenceBetweenCodePtr( 231 start, linkBuffer.locationOf(state.slowPathStart , NoPtrTag));231 start, linkBuffer.locationOf(state.slowPathStart)); 232 232 } 233 233 -
trunk/Source/JavaScriptCore/jit/Repatch.cpp
r230376 r230444 67 67 namespace JSC { 68 68 69 static FunctionPtr read CallTarget(CodeBlock* codeBlock, CodeLocationCall call)70 { 71 FunctionPtr result = MacroAssembler::readCallTarget(call);69 static FunctionPtr readPutICCallTarget(CodeBlock* codeBlock, CodeLocationCall call) 70 { 71 FunctionPtr target = MacroAssembler::readCallTarget(call); 72 72 #if ENABLE(FTL_JIT) 73 73 if (codeBlock->jitType() == JITCode::FTLJIT) { 74 return FunctionPtr(codeBlock->vm()->ftlThunks->keyForSlowPathCallThunk(75 MacroAssemblerCodePtr::createFromExecutableAddress(76 result.executableAddress())).callTarget(), CodeEntryPtrTag);74 MacroAssemblerCodePtr slowPathThunk = MacroAssemblerCodePtr::createFromExecutableAddress(target.executableAddress()); 75 auto* callTarget = codeBlock->vm()->ftlThunks->keyForSlowPathCallThunk(slowPathThunk).callTarget(); 76 return FunctionPtr(callTarget, CFunctionPtrTag); 77 77 } 78 78 #else 79 79 UNUSED_PARAM(codeBlock); 80 80 #endif // ENABLE(FTL_JIT) 81 return result;82 } 83 84 void ftlThunkAwareRepatchCall(CodeBlock* codeBlock, CodeLocationCall call, FunctionPtr newCalleeFunction )81 return FunctionPtr(untagCFunctionPtr(target.executableAddress(), PutPropertyPtrTag), CFunctionPtrTag); 82 } 83 84 void ftlThunkAwareRepatchCall(CodeBlock* codeBlock, CodeLocationCall call, FunctionPtr newCalleeFunction, PtrTag callTag) 85 85 { 86 86 #if ENABLE(FTL_JIT) … … 88 88 VM& vm = *codeBlock->vm(); 89 89 FTL::Thunks& thunks = *vm.ftlThunks; 90 F TL::SlowPathCallKey key = thunks.keyForSlowPathCallThunk(91 MacroAssemblerCodePtr::createFromExecutableAddress(92 MacroAssembler::readCallTarget(call).executableAddress()));90 FunctionPtr target = MacroAssembler::readCallTarget(call); 91 MacroAssemblerCodePtr slowPathThunk = MacroAssemblerCodePtr::createFromExecutableAddress(target.executableAddress()); 92 FTL::SlowPathCallKey key = thunks.keyForSlowPathCallThunk(slowPathThunk); 93 93 key = key.withCallTarget(newCalleeFunction.executableAddress()); 94 94 newCalleeFunction = FunctionPtr(thunks.getSlowPathCallThunk(key).code()); 95 assertIsTaggedWith(newCalleeFunction.executableAddress(), key.callPtrTag()); 96 MacroAssembler::repatchCall(call, newCalleeFunction); 97 return; 95 98 } 96 99 #else // ENABLE(FTL_JIT) 97 100 UNUSED_PARAM(codeBlock); 98 101 #endif // ENABLE(FTL_JIT) 99 MacroAssembler::repatchCall(call, newCalleeFunction);102 MacroAssembler::repatchCall(call, FunctionPtr(newCalleeFunction, callTag)); 100 103 } 101 104 … … 208 211 bool generatedCodeInline = InlineAccess::generateArrayLength(stubInfo, jsCast<JSArray*>(baseCell)); 209 212 if (generatedCodeInline) { 210 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), FunctionPtr(appropriateOptimizingGetByIdFunction(kind), GetPropertyPtrTag));213 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), appropriateOptimizingGetByIdFunction(kind), GetPropertyPtrTag); 211 214 stubInfo.initArrayLength(); 212 215 return RetryCacheLater; … … 265 268 LOG_IC((ICEvent::GetByIdSelfPatch, structure->classInfo(), propertyName)); 266 269 structure->startWatchingPropertyForReplacements(vm, slot.cachedOffset()); 267 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), FunctionPtr(appropriateOptimizingGetByIdFunction(kind), GetPropertyPtrTag));270 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), appropriateOptimizingGetByIdFunction(kind), GetPropertyPtrTag); 268 271 stubInfo.initGetByIdSelf(codeBlock, structure, slot.cachedOffset()); 269 272 return RetryCacheLater; … … 389 392 if (tryCacheGetByID(exec, baseValue, propertyName, slot, stubInfo, kind) == GiveUpOnCache) { 390 393 CodeBlock* codeBlock = exec->codeBlock(); 391 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), FunctionPtr(appropriateGetByIdFunction(kind), GetPropertyPtrTag));394 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), appropriateGetByIdFunction(kind), GetPropertyPtrTag); 392 395 } 393 396 } … … 461 464 if (generatedCodeInline) { 462 465 LOG_IC((ICEvent::PutByIdSelfPatch, structure->classInfo(), ident)); 463 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), FunctionPtr(appropriateOptimizingPutByIdFunction(slot, putKind), PutPropertyPtrTag));466 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), appropriateOptimizingPutByIdFunction(slot, putKind), PutPropertyPtrTag); 464 467 stubInfo.initPutByIdReplace(codeBlock, structure, slot.cachedOffset()); 465 468 return RetryCacheLater; … … 595 598 if (tryCachePutByID(exec, baseValue, structure, propertyName, slot, stubInfo, putKind) == GiveUpOnCache) { 596 599 CodeBlock* codeBlock = exec->codeBlock(); 597 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), FunctionPtr(appropriateGenericPutByIdFunction(slot, putKind), PutPropertyPtrTag));600 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), appropriateGenericPutByIdFunction(slot, putKind), PutPropertyPtrTag); 598 601 } 599 602 } … … 684 687 SuperSamplerScope superSamplerScope(false); 685 688 if (tryCacheIn(exec, base, ident, wasFound, slot, stubInfo) == GiveUpOnCache) 686 ftlThunkAwareRepatchCall(exec->codeBlock(), stubInfo.slowPathCallLocation(), operationIn );689 ftlThunkAwareRepatchCall(exec->codeBlock(), stubInfo.slowPathCallLocation(), operationIn, CFunctionPtrTag); 687 690 } 688 691 … … 1137 1140 void resetGetByID(CodeBlock* codeBlock, StructureStubInfo& stubInfo, GetByIDKind kind) 1138 1141 { 1139 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), FunctionPtr(appropriateOptimizingGetByIdFunction(kind), GetPropertyPtrTag));1142 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), appropriateOptimizingGetByIdFunction(kind), GetPropertyPtrTag); 1140 1143 InlineAccess::rewireStubAsJump(stubInfo, stubInfo.slowPathStartLocation()); 1141 1144 } … … 1143 1146 void resetPutByID(CodeBlock* codeBlock, StructureStubInfo& stubInfo) 1144 1147 { 1145 V_JITOperation_ESsiJJI unoptimizedFunction = untagCFunctionPtr<V_JITOperation_ESsiJJI>(readCallTarget(codeBlock, stubInfo.slowPathCallLocation()).executableAddress(), PutPropertyPtrTag);1148 V_JITOperation_ESsiJJI unoptimizedFunction = reinterpret_cast<V_JITOperation_ESsiJJI>(readPutICCallTarget(codeBlock, stubInfo.slowPathCallLocation()).executableAddress()); 1146 1149 V_JITOperation_ESsiJJI optimizedFunction; 1147 1150 if (unoptimizedFunction == operationPutByIdStrict || unoptimizedFunction == operationPutByIdStrictOptimize) … … 1156 1159 } 1157 1160 1158 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), FunctionPtr(optimizedFunction, PutPropertyPtrTag));1161 ftlThunkAwareRepatchCall(codeBlock, stubInfo.slowPathCallLocation(), optimizedFunction, PutPropertyPtrTag); 1159 1162 InlineAccess::rewireStubAsJump(stubInfo, stubInfo.slowPathStartLocation()); 1160 1163 } -
trunk/Source/JavaScriptCore/jit/Repatch.h
r230376 r230444 55 55 void resetPutByID(CodeBlock*, StructureStubInfo&); 56 56 void resetIn(CodeBlock*, StructureStubInfo&); 57 void ftlThunkAwareRepatchCall(CodeBlock*, CodeLocationCall, FunctionPtr newCalleeFunction );57 void ftlThunkAwareRepatchCall(CodeBlock*, CodeLocationCall, FunctionPtr newCalleeFunction, PtrTag callTag); 58 58 59 59 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/PtrTag.h
r230294 r230444 46 46 v(DFGOperationPtrTag) \ 47 47 v(ExceptionHandlerPtrTag) \ 48 v(FTLCodePtrTag) \ 49 v(FTLLazySlowPathPtrTag) \ 50 v(FTLOSRExitPtrTag) \ 51 v(FTLOperationPtrTag) \ 52 v(FTLSlowPathPtrTag) \ 48 53 v(GetPropertyPtrTag) \ 49 54 v(GetterSetterPtrTag) \ … … 67 72 v(SwitchTablePtrTag) \ 68 73 v(ThrowExceptionPtrTag) \ 69 \70 74 v(Yarr8BitPtrTag) \ 71 75 v(Yarr16BitPtrTag) \ … … 73 77 v(YarrMatchOnly16BitPtrTag) \ 74 78 v(YarrBacktrackPtrTag) \ 75 \76 79 v(WasmCallPtrTag) \ 77 80 v(WasmHelperPtrTag) \
Note:
See TracChangeset
for help on using the changeset viewer.