Changeset 286769 in webkit
- Timestamp:
- Dec 9, 2021, 12:47:07 AM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 26 edited
-
ChangeLog (modified) (1 diff)
-
bytecode/AccessCase.cpp (modified) (1 diff)
-
bytecode/BytecodeList.rb (modified) (12 diffs)
-
bytecode/CallLinkInfo.cpp (modified) (17 diffs)
-
bytecode/CallLinkInfo.h (modified) (11 diffs)
-
bytecode/CallLinkStatus.cpp (modified) (1 diff)
-
bytecode/CodeBlock.cpp (modified) (5 diffs)
-
bytecode/GetterSetterAccessCase.h (modified) (2 diffs)
-
bytecode/PolymorphicAccess.h (modified) (1 diff)
-
bytecode/Repatch.cpp (modified) (2 diffs)
-
bytecode/Repatch.h (modified) (2 diffs)
-
dfg/DFGCommonData.h (modified) (2 diffs)
-
dfg/DFGJITCompiler.cpp (modified) (2 diffs)
-
dfg/DFGJITCompiler.h (modified) (4 diffs)
-
dfg/DFGOperations.cpp (modified) (1 diff)
-
dfg/DFGOperations.h (modified) (2 diffs)
-
dfg/DFGSpeculativeJIT32_64.cpp (modified) (1 diff)
-
dfg/DFGSpeculativeJIT64.cpp (modified) (1 diff)
-
ftl/FTLLowerDFGToB3.cpp (modified) (7 diffs)
-
jit/CallFrameShuffleData.cpp (modified) (2 diffs)
-
jit/GCAwareJITStubRoutine.cpp (modified) (3 diffs)
-
jit/GCAwareJITStubRoutine.h (modified) (5 diffs)
-
jit/JITCall.cpp (modified) (7 diffs)
-
wasm/js/JSWebAssemblyCodeBlock.h (modified) (1 diff)
-
wasm/js/WasmToJS.cpp (modified) (2 diffs)
-
wasm/js/WasmToJS.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r286703 r286769 1 2021-12-09 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Introduce BaselineCallLinkInfo and OptimizingCallLinkInfo to shrink sizeof(BaselineCallLinkInfo) 4 https://bugs.webkit.org/show_bug.cgi?id=233985 5 6 Reviewed by Mark Lam. 7 8 This patch introduces BaselineCallLinkInfo and OptimizingCallLinkInfo to shrink sizeof(BaselineCallLinkInfo). 9 BaselineCallLinkInfo is included in metadata, and allocated for LLInt and Baseline. So shrinking it can make 10 metadata small for LLInt and Baseline, which exists for all live functions. 11 12 We also reorder OpIteratorOpen::Metadata and OpIteratorNext::Metadata to shrink sizes. 13 14 sizeof(BaselineCallLinkInfo) becomes 88, while the old sizeof(CallLinkInfo) was 120. 15 16 * bytecode/AccessCase.cpp: 17 (JSC::AccessCase::generateImpl): 18 * bytecode/BytecodeList.rb: 19 * bytecode/CallLinkInfo.cpp: 20 (JSC::CallLinkInfo::setMonomorphicCallee): 21 (JSC::CallLinkInfo::emitFastPathImpl): 22 (JSC::OptimizingCallLinkInfo::emitFastPath): 23 (JSC::OptimizingCallLinkInfo::emitTailCallFastPath): 24 (JSC::OptimizingCallLinkInfo::emitSlowPath): 25 (JSC::CallLinkInfo::emitDataICSlowPath): 26 (JSC::OptimizingCallLinkInfo::slowPathStart): 27 (JSC::OptimizingCallLinkInfo::fastPathStart): 28 (JSC::OptimizingCallLinkInfo::emitDirectFastPath): 29 (JSC::OptimizingCallLinkInfo::emitDirectTailCallFastPath): 30 (JSC::OptimizingCallLinkInfo::initializeDirectCall): 31 (JSC::OptimizingCallLinkInfo::setDirectCallTarget): 32 (JSC::BaselineCallLinkInfo::initialize): 33 (JSC::CallLinkInfo::slowPathStart): Deleted. 34 (JSC::CallLinkInfo::fastPathStart): Deleted. 35 (JSC::CallLinkInfo::emitFastPath): Deleted. 36 (JSC::CallLinkInfo::emitTailCallFastPath): Deleted. 37 (JSC::CallLinkInfo::emitSlowPath): Deleted. 38 (JSC::CallLinkInfo::initializeDataIC): Deleted. 39 (JSC::CallLinkInfo::emitDirectFastPath): Deleted. 40 (JSC::CallLinkInfo::emitDirectTailCallFastPath): Deleted. 41 (JSC::CallLinkInfo::initializeDirectCall): Deleted. 42 (JSC::CallLinkInfo::setDirectCallTarget): Deleted. 43 * bytecode/CallLinkInfo.h: 44 (JSC::CallLinkInfo::type const): 45 (JSC::CallLinkInfo::CallLinkInfo): 46 (JSC::CallLinkInfo::calleeGPR const): 47 (JSC::CallLinkInfo::callLinkInfoGPR const): 48 (JSC::CallLinkInfo::setCallLinkInfoGPR): 49 (JSC::CallLinkInfo::setUpCall): Deleted. 50 (JSC::CallLinkInfo::setCodeLocations): Deleted. 51 (JSC::CallLinkInfo::calleeGPR): Deleted. 52 * bytecode/CallLinkStatus.cpp: 53 (JSC::CallLinkStatus::computeFor): 54 * bytecode/CodeBlock.cpp: 55 (JSC::CodeBlock::finishCreation): 56 (JSC::CodeBlock::setupWithUnlinkedBaselineCode): 57 (JSC::CodeBlock::finalizeUnconditionally): 58 (JSC::CodeBlock::getICStatusMap): 59 (JSC::CodeBlock::jettison): 60 * bytecode/GetterSetterAccessCase.h: 61 * bytecode/PolymorphicAccess.h: 62 * bytecode/Repatch.cpp: 63 (JSC::revertCall): 64 (JSC::linkDirectCall): 65 * bytecode/Repatch.h: 66 * dfg/DFGCommonData.h: 67 (JSC::DFG::CommonData::addCallLinkInfo): 68 * dfg/DFGJITCompiler.cpp: 69 (JSC::DFG::JITCompiler::link): 70 * dfg/DFGJITCompiler.h: 71 (JSC::DFG::JITCompiler::addJSCall): 72 (JSC::DFG::JITCompiler::addJSDirectCall): 73 (JSC::DFG::JITCompiler::JSCallRecord::JSCallRecord): 74 (JSC::DFG::JITCompiler::JSDirectCallRecord::JSDirectCallRecord): 75 * dfg/DFGOperations.cpp: 76 (JSC::DFG::JSC_DEFINE_JIT_OPERATION): 77 * dfg/DFGOperations.h: 78 * dfg/DFGSpeculativeJIT32_64.cpp: 79 (JSC::DFG::SpeculativeJIT::emitCall): 80 * dfg/DFGSpeculativeJIT64.cpp: 81 (JSC::DFG::SpeculativeJIT::emitCall): 82 * ftl/FTLLowerDFGToB3.cpp: 83 (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): 84 * jit/CallFrameShuffleData.cpp: 85 (JSC::CallFrameShuffleData::createForBaselineOrLLIntTailCall): 86 * jit/GCAwareJITStubRoutine.cpp: 87 (JSC::MarkingGCAwareJITStubRoutine::MarkingGCAwareJITStubRoutine): 88 (JSC::GCAwareJITStubRoutineWithExceptionHandler::GCAwareJITStubRoutineWithExceptionHandler): 89 (JSC::createICJITStubRoutine): 90 * jit/GCAwareJITStubRoutine.h: 91 * jit/JITCall.cpp: 92 (JSC::JIT::compileCallEvalSlowCase): 93 (JSC::JIT::compileTailCall): 94 (JSC::JIT::compileOpCall): 95 (): Deleted. 96 * wasm/js/JSWebAssemblyCodeBlock.h: 97 * wasm/js/WasmToJS.cpp: 98 (JSC::Wasm::wasmToJS): 99 * wasm/js/WasmToJS.h: 100 1 101 2021-12-08 Asumu Takikawa <asumu@igalia.com> 2 102 -
trunk/Source/JavaScriptCore/bytecode/AccessCase.cpp
r286667 r286769 1998 1998 1999 1999 RELEASE_ASSERT(!access.callLinkInfo()); 2000 CallLinkInfo* callLinkInfo = state.m_callLinkInfos.add(stubInfo.codeOrigin);2000 auto* callLinkInfo = state.m_callLinkInfos.add(stubInfo.codeOrigin); 2001 2001 access.m_callLinkInfo = callLinkInfo; 2002 2002 -
trunk/Source/JavaScriptCore/bytecode/BytecodeList.rb
r286635 r286769 27 27 :BasicBlockLocation, 28 28 :BoundLabel, 29 : CallLinkInfo,29 :BaselineCallLinkInfo, 30 30 :DebugHookType, 31 31 :ECMAMode, … … 843 843 }, 844 844 metadata: { 845 callLinkInfo: CallLinkInfo,845 callLinkInfo: BaselineCallLinkInfo, 846 846 arrayProfile: ArrayProfile, 847 847 profile: ValueProfile, … … 856 856 }, 857 857 metadata: { 858 callLinkInfo: CallLinkInfo,858 callLinkInfo: BaselineCallLinkInfo, 859 859 arrayProfile: ArrayProfile, 860 860 profile: ValueProfile, … … 870 870 }, 871 871 metadata: { 872 callLinkInfo: CallLinkInfo,872 callLinkInfo: BaselineCallLinkInfo, 873 873 arrayProfile: ArrayProfile, 874 874 profile: ValueProfile, … … 885 885 }, 886 886 metadata: { 887 callLinkInfo: CallLinkInfo,887 callLinkInfo: BaselineCallLinkInfo, 888 888 arrayProfile: ArrayProfile, 889 889 profile: ValueProfile, … … 907 907 }, 908 908 metadata: { 909 callLinkInfo: CallLinkInfo,909 callLinkInfo: BaselineCallLinkInfo, 910 910 arrayProfile: ArrayProfile, 911 911 profile: ValueProfile, … … 929 929 }, 930 930 metadata: { 931 callLinkInfo: CallLinkInfo,931 callLinkInfo: BaselineCallLinkInfo, 932 932 arrayProfile: ArrayProfile, 933 933 profile: ValueProfile, … … 942 942 }, 943 943 metadata: { 944 callLinkInfo: CallLinkInfo,944 callLinkInfo: BaselineCallLinkInfo, 945 945 arrayProfile: ArrayProfile, 946 946 profile: ValueProfile, … … 957 957 }, 958 958 metadata: { 959 callLinkInfo: CallLinkInfo,959 callLinkInfo: BaselineCallLinkInfo, 960 960 arrayProfile: ArrayProfile, 961 961 profile: ValueProfile, … … 1258 1258 }, 1259 1259 metadata: { 1260 iterationMetadata: IterationModeMetadata,1261 1260 iterableProfile: ValueProfile, 1262 callLinkInfo: CallLinkInfo, 1263 arrayProfile: ArrayProfile, 1261 callLinkInfo: BaselineCallLinkInfo, 1264 1262 iteratorProfile: ValueProfile, 1265 1263 modeMetadata: GetByIdModeMetadata, 1266 1264 nextProfile: ValueProfile, 1265 arrayProfile: ArrayProfile, 1266 iterationMetadata: IterationModeMetadata, 1267 1267 }, 1268 1268 checkpoints: { … … 1282 1282 }, 1283 1283 metadata: { 1284 iterationMetadata: IterationModeMetadata, 1285 iterableProfile: ArrayProfile, 1286 callLinkInfo: CallLinkInfo, 1287 arrayProfile: ArrayProfile, 1284 callLinkInfo: BaselineCallLinkInfo, 1288 1285 nextResultProfile: ValueProfile, 1289 1286 doneModeMetadata: GetByIdModeMetadata, … … 1291 1288 valueModeMetadata: GetByIdModeMetadata, 1292 1289 valueProfile: ValueProfile, 1290 arrayProfile: ArrayProfile, 1291 iterableProfile: ArrayProfile, 1292 iterationMetadata: IterationModeMetadata, 1293 1293 }, 1294 1294 tmps: { -
trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp
r285795 r286769 103 103 } 104 104 105 CodeLocationLabel<JSInternalPtrTag> CallLinkInfo::slowPathStart()106 {107 RELEASE_ASSERT(!isDataIC());108 return u.codeIC.m_slowPathStart;109 }110 111 105 CodeLocationLabel<JSInternalPtrTag> CallLinkInfo::doneLocation() 112 106 { … … 125 119 else { 126 120 #if ENABLE(JIT) 127 MacroAssembler::repatchNearCall( u.codeIC.m_callLocation, CodeLocationLabel<JSEntryPtrTag>(codePtr));121 MacroAssembler::repatchNearCall(static_cast<OptimizingCallLinkInfo*>(this)->m_callLocation, CodeLocationLabel<JSEntryPtrTag>(codePtr)); 128 122 MacroAssembler::repatchPointer(u.codeIC.m_calleeLocation, callee); 129 123 #else … … 214 208 RELEASE_ASSERT(value); 215 209 m_maxArgumentCountIncludingThis = value; 216 }217 218 CodeLocationLabel<JSInternalPtrTag> CallLinkInfo::fastPathStart()219 {220 RELEASE_ASSERT(isDirect() && isTailCall());221 return CodeLocationDataLabelPtr<JSInternalPtrTag>(u.codeIC.m_fastPathStart);222 210 } 223 211 … … 293 281 } 294 282 295 #if ENABLE(JIT) 283 void CallLinkInfo::setSlowPathCallDestination(MacroAssemblerCodePtr<JSEntryPtrTag> codePtr) 284 { 285 m_slowPathCallDestination = codePtr; 286 } 287 288 void CallLinkInfo::revertCallToStub() 289 { 290 RELEASE_ASSERT(stub()); 291 // The start of our JIT code is now a jump to the polymorphic stub. Rewrite the first instruction 292 // to be what we need for non stub ICs. 293 294 // this runs into some branch compaction crap I'd like to avoid for now. Essentially, the branch 295 // doesn't know if it can be compacted or not. So we end up with 28 bytes of machine code, for 296 // what in all likelihood fits in 24. So we just splat out the first instruction. Long term, we 297 // need something cleaner. But this works on arm64 for now. 298 299 if (isDataIC()) { 300 m_calleeOrCodeBlock.clear(); 301 u.dataIC.m_monomorphicCallDestination = nullptr; 302 } else { 303 #if ENABLE(JIT) 304 CCallHelpers::revertJumpReplacementToBranchPtrWithPatch( 305 CCallHelpers::startOfBranchPtrWithPatchOnRegister(u.codeIC.m_calleeLocation), calleeGPR(), nullptr); 306 #else 307 RELEASE_ASSERT_NOT_REACHED(); 308 #endif 309 } 310 } 311 312 void BaselineCallLinkInfo::initialize(VM& vm, CallType callType, BytecodeIndex bytecodeIndex, CallFrameShuffleData* frameShuffleData) 313 { 314 UNUSED_PARAM(frameShuffleData); 315 m_type = static_cast<unsigned>(Type::Baseline); 316 ASSERT(Type::Baseline == type()); 317 m_codeOrigin = CodeOrigin(bytecodeIndex); 318 m_callType = callType; 319 #if ENABLE(JIT) 320 if (frameShuffleData) { 321 // FIXME: It'd be nice if this were a refcounted data structure. 322 m_frameShuffleData = makeUnique<CallFrameShuffleData>(*frameShuffleData); 323 } 324 #endif 325 setUsesDataICs(UseDataIC::Yes); 326 setSlowPathCallDestination(vm.getCTILinkCall().code()); 327 // If JIT is disabled, we should not support dynamically generated call IC. 328 if (!Options::useJIT()) 329 disallowStubs(); 330 } 331 332 #if ENABLE(JIT) 333 296 334 void CallLinkInfo::setFrameShuffleData(const CallFrameShuffleData& shuffleData) 297 335 { … … 337 375 RELEASE_ASSERT(callLinkInfo); 338 376 jit.addLinkTask([=] (LinkBuffer& linkBuffer) { 339 callLinkInfo->u.codeIC.m_callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call);377 static_cast<OptimizingCallLinkInfo*>(callLinkInfo)->m_callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call); 340 378 callLinkInfo->u.codeIC.m_calleeLocation = linkBuffer.locationOf<JSInternalPtrTag>(calleeCheck); 341 379 }); … … 345 383 } 346 384 347 CCallHelpers::JumpList CallLinkInfo::emitFastPath(CCallHelpers& jit, GPRReg calleeGPR, GPRReg callLinkInfoGPR, UseDataIC useDataIC) 385 MacroAssembler::JumpList CallLinkInfo::emitDataICFastPath(CCallHelpers& jit, GPRReg calleeGPR, GPRReg callLinkInfoGPR) 386 { 387 RELEASE_ASSERT(callLinkInfoGPR != InvalidGPRReg); 388 return emitFastPathImpl(nullptr, jit, calleeGPR, callLinkInfoGPR, UseDataIC::Yes, false, nullptr); 389 } 390 391 MacroAssembler::JumpList CallLinkInfo::emitTailCallDataICFastPath(CCallHelpers& jit, GPRReg calleeGPR, GPRReg callLinkInfoGPR, ScopedLambda<void()>&& prepareForTailCall) 392 { 393 RELEASE_ASSERT(callLinkInfoGPR != InvalidGPRReg); 394 return emitFastPathImpl(nullptr, jit, calleeGPR, callLinkInfoGPR, UseDataIC::Yes, true, WTFMove(prepareForTailCall)); 395 } 396 397 void CallLinkInfo::setStub(Ref<PolymorphicCallStubRoutine>&& newStub) 398 { 399 clearStub(); 400 m_stub = WTFMove(newStub); 401 402 m_calleeOrCodeBlock.clear(); 403 404 if (isDataIC()) { 405 *bitwise_cast<uintptr_t*>(m_calleeOrCodeBlock.slot()) = polymorphicCalleeMask; 406 u.dataIC.m_monomorphicCallDestination = m_stub->code().code().retagged<JSEntryPtrTag>(); 407 } else { 408 MacroAssembler::replaceWithJump( 409 MacroAssembler::startOfBranchPtrWithPatchOnRegister(u.codeIC.m_calleeLocation), 410 CodeLocationLabel<JITStubRoutinePtrTag>(m_stub->code().code())); 411 } 412 } 413 414 void CallLinkInfo::emitDataICSlowPath(VM&, CCallHelpers& jit, GPRReg callLinkInfoGPR) 415 { 416 jit.move(callLinkInfoGPR, GPRInfo::regT2); 417 jit.call(CCallHelpers::Address(GPRInfo::regT2, offsetOfSlowPathCallDestination()), JSEntryPtrTag); 418 } 419 420 CCallHelpers::JumpList OptimizingCallLinkInfo::emitFastPath(CCallHelpers& jit, GPRReg calleeGPR, GPRReg callLinkInfoGPR, UseDataIC useDataIC) 348 421 { 349 422 RELEASE_ASSERT(!isTailCall()); … … 353 426 RELEASE_ASSERT(callLinkInfoGPR != GPRReg::InvalidGPRReg); 354 427 jit.move(CCallHelpers::TrustedImmPtr(this), callLinkInfoGPR); 355 u.dataIC.m_callLinkInfoGPR = callLinkInfoGPR;428 setCallLinkInfoGPR(callLinkInfoGPR); 356 429 } 357 430 … … 359 432 } 360 433 361 MacroAssembler::JumpList CallLinkInfo::emitTailCallFastPath(CCallHelpers& jit, GPRReg calleeGPR, ScopedLambda<void()>&& prepareForTailCall)434 MacroAssembler::JumpList OptimizingCallLinkInfo::emitTailCallFastPath(CCallHelpers& jit, GPRReg calleeGPR, ScopedLambda<void()>&& prepareForTailCall) 362 435 { 363 436 RELEASE_ASSERT(isTailCall()); … … 365 438 return emitFastPathImpl(this, jit, calleeGPR, InvalidGPRReg, UseDataIC::No, isTailCall(), WTFMove(prepareForTailCall)); 366 439 } 367 368 MacroAssembler::JumpList CallLinkInfo::emitDataICFastPath(CCallHelpers& jit, GPRReg calleeGPR, GPRReg callLinkInfoGPR) 369 { 370 RELEASE_ASSERT(callLinkInfoGPR != InvalidGPRReg); 371 return emitFastPathImpl(nullptr, jit, calleeGPR, callLinkInfoGPR, UseDataIC::Yes, false, nullptr); 372 } 373 374 MacroAssembler::JumpList CallLinkInfo::emitTailCallDataICFastPath(CCallHelpers& jit, GPRReg calleeGPR, GPRReg callLinkInfoGPR, ScopedLambda<void()>&& prepareForTailCall) 375 { 376 RELEASE_ASSERT(callLinkInfoGPR != InvalidGPRReg); 377 return emitFastPathImpl(nullptr, jit, calleeGPR, callLinkInfoGPR, UseDataIC::Yes, true, WTFMove(prepareForTailCall)); 378 } 379 380 void CallLinkInfo::emitSlowPath(VM& vm, CCallHelpers& jit) 440 void OptimizingCallLinkInfo::emitSlowPath(VM& vm, CCallHelpers& jit) 381 441 { 382 442 setSlowPathCallDestination(vm.getCTILinkCall().code()); … … 385 445 } 386 446 387 void CallLinkInfo::emitDataICSlowPath(VM&, CCallHelpers& jit, GPRReg callLinkInfoGPR) 388 { 389 jit.move(callLinkInfoGPR, GPRInfo::regT2); 390 jit.call(CCallHelpers::Address(GPRInfo::regT2, offsetOfSlowPathCallDestination()), JSEntryPtrTag); 391 } 392 #endif 393 394 void CallLinkInfo::initializeDataIC(VM& vm, CallType callType, BytecodeIndex bytecodeIndex, CallFrameShuffleData* frameShuffleData) 395 { 396 UNUSED_PARAM(frameShuffleData); 397 m_codeOrigin = CodeOrigin(bytecodeIndex); 398 m_callType = callType; 399 #if ENABLE(JIT) 400 GPRReg calleeGPR = GPRInfo::regT0; 401 GPRReg callLinkInfoGPR = GPRInfo::regT2; 402 m_calleeGPR = calleeGPR; 403 if (frameShuffleData) { 404 // FIXME: It'd be nice if this were a refcounted data structure. 405 m_frameShuffleData = makeUnique<CallFrameShuffleData>(*frameShuffleData); 406 } 407 u.dataIC.m_callLinkInfoGPR = callLinkInfoGPR; 408 #endif 409 setUsesDataICs(UseDataIC::Yes); 410 setSlowPathCallDestination(vm.getCTILinkCall().code()); 411 // If JIT is disabled, we should not support dynamically generated call IC. 412 if (!Options::useJIT()) 413 disallowStubs(); 414 } 415 416 #if ENABLE(JIT) 417 void CallLinkInfo::emitDirectFastPath(CCallHelpers& jit) 447 CodeLocationLabel<JSInternalPtrTag> OptimizingCallLinkInfo::slowPathStart() 448 { 449 RELEASE_ASSERT(!isDataIC()); 450 return m_slowPathStart; 451 } 452 453 CodeLocationLabel<JSInternalPtrTag> OptimizingCallLinkInfo::fastPathStart() 454 { 455 RELEASE_ASSERT(isDirect() && isTailCall()); 456 return CodeLocationDataLabelPtr<JSInternalPtrTag>(m_fastPathStart); 457 } 458 459 void OptimizingCallLinkInfo::emitDirectFastPath(CCallHelpers& jit) 418 460 { 419 461 RELEASE_ASSERT(!isTailCall()); … … 423 465 auto call = jit.nearCall(); 424 466 jit.addLinkTask([=] (LinkBuffer& linkBuffer) { 425 u.codeIC.m_callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call);467 m_callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call); 426 468 }); 427 469 jit.addLateLinkTask([this] (LinkBuffer&) { … … 430 472 } 431 473 432 void CallLinkInfo::emitDirectTailCallFastPath(CCallHelpers& jit, ScopedLambda<void()>&& prepareForTailCall)474 void OptimizingCallLinkInfo::emitDirectTailCallFastPath(CCallHelpers& jit, ScopedLambda<void()>&& prepareForTailCall) 433 475 { 434 476 RELEASE_ASSERT(isTailCall()); … … 438 480 auto fastPathStart = jit.label(); 439 481 jit.addLinkTask([=] (LinkBuffer& linkBuffer) { 440 u.codeIC.m_fastPathStart = linkBuffer.locationOf<JSInternalPtrTag>(fastPathStart);482 m_fastPathStart = linkBuffer.locationOf<JSInternalPtrTag>(fastPathStart); 441 483 }); 442 484 … … 448 490 auto call = jit.nearTailCall(); 449 491 jit.addLinkTask([=] (LinkBuffer& linkBuffer) { 450 u.codeIC.m_callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call);492 m_callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call); 451 493 }); 452 494 jit.addLateLinkTask([this] (LinkBuffer&) { … … 455 497 } 456 498 457 void CallLinkInfo::initializeDirectCall()458 { 459 RELEASE_ASSERT(isDirect()); 460 ASSERT( u.codeIC.m_callLocation);499 void OptimizingCallLinkInfo::initializeDirectCall() 500 { 501 RELEASE_ASSERT(isDirect()); 502 ASSERT(m_callLocation); 461 503 if (isTailCall()) { 462 504 RELEASE_ASSERT(fastPathStart()); … … 468 510 }), "initialize direct call"); 469 511 } else 470 MacroAssembler::repatchNearCall( u.codeIC.m_callLocation, slowPathStart());471 } 472 473 void CallLinkInfo::setDirectCallTarget(CodeLocationLabel<JSEntryPtrTag> target)512 MacroAssembler::repatchNearCall(m_callLocation, slowPathStart()); 513 } 514 515 void OptimizingCallLinkInfo::setDirectCallTarget(CodeLocationLabel<JSEntryPtrTag> target) 474 516 { 475 517 RELEASE_ASSERT(isDirect()); … … 484 526 } 485 527 486 MacroAssembler::repatchNearCall(u.codeIC.m_callLocation, target); 487 } 488 #endif 489 490 void CallLinkInfo::setSlowPathCallDestination(MacroAssemblerCodePtr<JSEntryPtrTag> codePtr) 491 { 492 m_slowPathCallDestination = codePtr; 493 } 494 495 void CallLinkInfo::revertCallToStub() 496 { 497 RELEASE_ASSERT(stub()); 498 // The start of our JIT code is now a jump to the polymorphic stub. Rewrite the first instruction 499 // to be what we need for non stub ICs. 500 501 // this runs into some branch compaction crap I'd like to avoid for now. Essentially, the branch 502 // doesn't know if it can be compacted or not. So we end up with 28 bytes of machine code, for 503 // what in all likelihood fits in 24. So we just splat out the first instruction. Long term, we 504 // need something cleaner. But this works on arm64 for now. 505 506 if (isDataIC()) { 507 m_calleeOrCodeBlock.clear(); 508 u.dataIC.m_monomorphicCallDestination = nullptr; 509 } else { 510 #if ENABLE(JIT) 511 CCallHelpers::revertJumpReplacementToBranchPtrWithPatch( 512 CCallHelpers::startOfBranchPtrWithPatchOnRegister(u.codeIC.m_calleeLocation), calleeGPR(), nullptr); 513 #else 514 RELEASE_ASSERT_NOT_REACHED(); 515 #endif 516 } 517 } 518 519 #if ENABLE(JIT) 520 void CallLinkInfo::setStub(Ref<PolymorphicCallStubRoutine>&& newStub) 521 { 522 clearStub(); 523 m_stub = WTFMove(newStub); 524 525 m_calleeOrCodeBlock.clear(); 526 527 if (isDataIC()) { 528 *bitwise_cast<uintptr_t*>(m_calleeOrCodeBlock.slot()) = polymorphicCalleeMask; 529 u.dataIC.m_monomorphicCallDestination = m_stub->code().code().retagged<JSEntryPtrTag>(); 530 } else { 531 MacroAssembler::replaceWithJump( 532 MacroAssembler::startOfBranchPtrWithPatchOnRegister(u.codeIC.m_calleeLocation), 533 CodeLocationLabel<JITStubRoutinePtrTag>(m_stub->code().code())); 534 } 535 } 528 MacroAssembler::repatchNearCall(m_callLocation, target); 529 } 530 536 531 #endif 537 532 -
trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h
r285795 r286769 48 48 struct UnlinkedCallLinkInfo; 49 49 50 #if ENABLE(JIT) 51 namespace BaselineCallRegisters { 52 constexpr JSValueRegs calleeJSR { JSRInfo::jsRegT10 }; 53 constexpr GPRReg calleeGPR { GPRInfo::regT0 }; 54 constexpr GPRReg callLinkInfoGPR { GPRInfo::regT2 }; 55 } 56 #endif 57 50 58 class CallLinkInfo : public PackedRawSentinelNode<CallLinkInfo> { 51 59 public: 52 60 friend class LLIntOffsetsExtractor; 61 62 enum class Type : uint8_t { 63 Baseline, 64 Optimizing, 65 }; 53 66 54 67 enum CallType : uint8_t { … … 80 93 return false; 81 94 } 82 }83 84 CallLinkInfo(CodeOrigin codeOrigin)85 : m_codeOrigin(codeOrigin)86 , m_hasSeenShouldRepatch(false)87 , m_hasSeenClosure(false)88 , m_clearedByGC(false)89 , m_clearedByVirtual(false)90 , m_allowStubs(true)91 , m_clearedByJettison(false)92 , m_callType(None)93 , m_useDataIC(static_cast<unsigned>(UseDataIC::Yes))94 {95 }96 97 CallLinkInfo()98 : CallLinkInfo(CodeOrigin { })99 {100 95 } 101 96 … … 184 179 void unlink(VM&); 185 180 186 #if ENABLE(JIT)187 void setUpCall(CallType callType, GPRReg calleeGPR)188 {189 m_callType = callType;190 m_calleeGPR = calleeGPR;191 }192 193 GPRReg calleeGPR() const { return m_calleeGPR; }194 #endif195 196 void initializeDataIC(VM&, CallType, BytecodeIndex, CallFrameShuffleData*);197 198 181 enum class UseDataIC : uint8_t { 199 182 Yes, … … 202 185 203 186 #if ENABLE(JIT) 204 pr ivate:187 protected: 205 188 static MacroAssembler::JumpList emitFastPathImpl(CallLinkInfo*, CCallHelpers&, GPRReg calleeGPR, GPRReg callLinkInfoGPR, UseDataIC, bool isTailCall, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN; 206 189 public: 207 190 static MacroAssembler::JumpList emitDataICFastPath(CCallHelpers&, GPRReg calleeGPR, GPRReg callLinkInfoGPR) WARN_UNUSED_RETURN; 208 191 static MacroAssembler::JumpList emitTailCallDataICFastPath(CCallHelpers&, GPRReg calleeGPR, GPRReg callLinkInfoGPR, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN; 209 MacroAssembler::JumpList emitFastPath(CCallHelpers&, GPRReg calleeGPR, GPRReg callLinkInfoGPR, UseDataIC) WARN_UNUSED_RETURN;210 MacroAssembler::JumpList emitTailCallFastPath(CCallHelpers&, GPRReg calleeGPR, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;211 void emitDirectFastPath(CCallHelpers&);212 void emitDirectTailCallFastPath(CCallHelpers&, ScopedLambda<void()>&& prepareForTailCall);213 void emitSlowPath(VM&, CCallHelpers&);214 192 static void emitDataICSlowPath(VM&, CCallHelpers&, GPRReg callLinkInfoGPR); 215 216 void initializeDirectCall();217 void setDirectCallTarget(CodeLocationLabel<JSEntryPtrTag>);218 193 #endif 219 194 … … 223 198 void setUsesDataICs(UseDataIC useDataIC) { m_useDataIC = static_cast<unsigned>(useDataIC); } 224 199 225 void setCodeLocations(226 CodeLocationLabel<JSInternalPtrTag> slowPathStart,227 CodeLocationLabel<JSInternalPtrTag> doneLocation)228 {229 if (!isDataIC())230 u.codeIC.m_slowPathStart = slowPathStart;231 m_doneLocation = doneLocation;232 }233 234 235 200 bool allowStubs() const { return m_allowStubs; } 236 201 … … 240 205 } 241 206 242 CodeLocationLabel<JSInternalPtrTag> slowPathStart();243 207 CodeLocationLabel<JSInternalPtrTag> doneLocation(); 244 208 … … 372 336 373 337 #if ENABLE(JIT) 374 GPRReg calleeGPR() 375 { 376 return m_calleeGPR; 377 } 338 GPRReg calleeGPR() const; 339 GPRReg callLinkInfoGPR() const; 378 340 #endif 379 341 … … 419 381 #endif 420 382 421 private: 422 423 CodeLocationLabel<JSInternalPtrTag> fastPathStart(); 383 Type type() const { return static_cast<Type>(m_type); } 384 385 protected: 386 CallLinkInfo(Type type, CodeOrigin codeOrigin) 387 : m_codeOrigin(codeOrigin) 388 , m_hasSeenShouldRepatch(false) 389 , m_hasSeenClosure(false) 390 , m_clearedByGC(false) 391 , m_clearedByVirtual(false) 392 , m_allowStubs(true) 393 , m_clearedByJettison(false) 394 , m_callType(None) 395 , m_useDataIC(static_cast<unsigned>(UseDataIC::Yes)) 396 , m_type(static_cast<unsigned>(type)) 397 { 398 ASSERT(type == this->type()); 399 } 400 401 CallLinkInfo(Type type) 402 : CallLinkInfo(type, CodeOrigin { }) 403 { 404 } 405 406 #if ENABLE(JIT) 407 void setCallLinkInfoGPR(GPRReg); 408 #endif 424 409 425 410 uint32_t m_maxArgumentCountIncludingThis { 0 }; // For varargs: the profiled maximum number of arguments. For direct: the number of stack slots allocated for arguments. … … 427 412 MacroAssemblerCodePtr<JSEntryPtrTag> m_slowPathCallDestination; 428 413 union UnionType { 429 UnionType() 430 #if ENABLE(JIT) 431 : dataIC { nullptr, InvalidGPRReg } 432 #else 414 UnionType() 433 415 : dataIC { nullptr } 434 #endif435 416 { } 417 436 418 struct DataIC { 437 419 MacroAssemblerCodePtr<JSEntryPtrTag> m_monomorphicCallDestination; 438 #if ENABLE(JIT)439 GPRReg m_callLinkInfoGPR;440 #endif441 420 } dataIC; 442 421 443 422 struct { 444 CodeLocationNearCall<JSInternalPtrTag> m_callLocation;445 423 CodeLocationDataLabelPtr<JSInternalPtrTag> m_calleeLocation; 446 CodeLocationLabel<JSInternalPtrTag> m_slowPathStart;447 CodeLocationLabel<JSInternalPtrTag> m_fastPathStart;448 424 } codeIC; 449 425 } u; … … 464 440 unsigned m_callType : 4; // CallType 465 441 unsigned m_useDataIC : 1; // UseDataIC 442 unsigned m_type : 1; // Type 466 443 #if ENABLE(JIT) 467 444 GPRReg m_calleeGPR { InvalidGPRReg }; 445 GPRReg m_callLinkInfoGPR { InvalidGPRReg }; 468 446 #endif 469 447 uint32_t m_slowPathCount { 0 }; 448 }; 449 450 class BaselineCallLinkInfo final : public CallLinkInfo { 451 public: 452 BaselineCallLinkInfo() 453 : CallLinkInfo(Type::Baseline) 454 { 455 } 456 457 void initialize(VM&, CallType, BytecodeIndex, CallFrameShuffleData*); 458 459 void setCodeLocations(CodeLocationLabel<JSInternalPtrTag> doneLocation) 460 { 461 m_doneLocation = doneLocation; 462 } 463 464 #if ENABLE(JIT) 465 static constexpr GPRReg calleeGPR() { return BaselineCallRegisters::calleeGPR; } 466 static constexpr GPRReg callLinkInfoGPR() { return BaselineCallRegisters::callLinkInfoGPR; } 467 void setCallLinkInfoGPR(GPRReg callLinkInfoGPR) { RELEASE_ASSERT(callLinkInfoGPR == BaselineCallRegisters::callLinkInfoGPR); } 468 #endif 470 469 }; 471 470 … … 480 479 }; 481 480 481 #if ENABLE(JIT) 482 483 class OptimizingCallLinkInfo final : public CallLinkInfo { 484 public: 485 friend class CallLinkInfo; 486 487 OptimizingCallLinkInfo(CodeOrigin codeOrigin) 488 : CallLinkInfo(Type::Optimizing, codeOrigin) 489 { 490 } 491 492 void setUpCall(CallType callType, GPRReg calleeGPR) 493 { 494 m_callType = callType; 495 m_calleeGPR = calleeGPR; 496 } 497 498 void setCodeLocations( 499 CodeLocationLabel<JSInternalPtrTag> slowPathStart, 500 CodeLocationLabel<JSInternalPtrTag> doneLocation) 501 { 502 if (!isDataIC()) 503 m_slowPathStart = slowPathStart; 504 m_doneLocation = doneLocation; 505 } 506 507 CodeLocationLabel<JSInternalPtrTag> fastPathStart(); 508 CodeLocationLabel<JSInternalPtrTag> slowPathStart(); 509 510 GPRReg calleeGPR() const { return m_calleeGPR; } 511 GPRReg callLinkInfoGPR() const { return m_callLinkInfoGPR; } 512 void setCallLinkInfoGPR(GPRReg callLinkInfoGPR) { m_callLinkInfoGPR = callLinkInfoGPR; } 513 514 void emitDirectFastPath(CCallHelpers&); 515 void emitDirectTailCallFastPath(CCallHelpers&, ScopedLambda<void()>&& prepareForTailCall); 516 void initializeDirectCall(); 517 void setDirectCallTarget(CodeLocationLabel<JSEntryPtrTag>); 518 void emitSlowPath(VM&, CCallHelpers&); 519 520 MacroAssembler::JumpList emitFastPath(CCallHelpers&, GPRReg calleeGPR, GPRReg callLinkInfoGPR, UseDataIC) WARN_UNUSED_RETURN; 521 MacroAssembler::JumpList emitTailCallFastPath(CCallHelpers&, GPRReg calleeGPR, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN; 522 523 private: 524 CodeLocationNearCall<JSInternalPtrTag> m_callLocation; 525 CodeLocationLabel<JSInternalPtrTag> m_slowPathStart; 526 CodeLocationLabel<JSInternalPtrTag> m_fastPathStart; 527 }; 528 529 inline GPRReg CallLinkInfo::calleeGPR() const 530 { 531 switch (type()) { 532 case Type::Baseline: 533 return static_cast<const BaselineCallLinkInfo*>(this)->calleeGPR(); 534 case Type::Optimizing: 535 return static_cast<const OptimizingCallLinkInfo*>(this)->calleeGPR(); 536 } 537 return InvalidGPRReg; 538 } 539 540 inline GPRReg CallLinkInfo::callLinkInfoGPR() const 541 { 542 switch (type()) { 543 case Type::Baseline: 544 return static_cast<const BaselineCallLinkInfo*>(this)->callLinkInfoGPR(); 545 case Type::Optimizing: 546 return static_cast<const OptimizingCallLinkInfo*>(this)->callLinkInfoGPR(); 547 } 548 return InvalidGPRReg; 549 } 550 551 inline void CallLinkInfo::setCallLinkInfoGPR(GPRReg callLinkInfoGPR) 552 { 553 switch (type()) { 554 case Type::Baseline: 555 return static_cast<BaselineCallLinkInfo*>(this)->setCallLinkInfoGPR(callLinkInfoGPR); 556 case Type::Optimizing: 557 return static_cast<OptimizingCallLinkInfo*>(this)->setCallLinkInfoGPR(callLinkInfoGPR); 558 } 559 } 560 561 #endif 562 482 563 } // namespace JSC -
trunk/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp
r285795 r286769 325 325 return CallLinkStatus(); 326 326 327 if (CallLinkStatusInternal::verbose) 328 dataLog("Have CallLinkInfo with CodeOrigin = ", status.callLinkInfo->codeOrigin(), "\n"); 327 dataLogLnIf(CallLinkStatusInternal::verbose, "Have CallLinkInfo with CodeOrigin = ", codeOrigin, "\n"); 329 328 CallLinkStatus result; 330 329 { -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r286635 r286769 446 446 if constexpr (decltype(bytecode)::opcodeID == op_tail_call) { 447 447 CallFrameShuffleData shuffleData = CallFrameShuffleData::createForBaselineOrLLIntTailCall(bytecode, numParameters()); 448 metadata.m_callLinkInfo.initialize DataIC(vm, CallLinkInfo::callTypeFor(decltype(bytecode)::opcodeID), instruction.index(), &shuffleData);448 metadata.m_callLinkInfo.initialize(vm, CallLinkInfo::callTypeFor(decltype(bytecode)::opcodeID), instruction.index(), &shuffleData); 449 449 return; 450 450 } 451 451 #endif 452 metadata.m_callLinkInfo.initialize DataIC(vm, CallLinkInfo::callTypeFor(decltype(bytecode)::opcodeID), instruction.index(), nullptr);452 metadata.m_callLinkInfo.initialize(vm, CallLinkInfo::callTypeFor(decltype(bytecode)::opcodeID), instruction.index(), nullptr); 453 453 }; 454 454 … … 793 793 CallLinkInfo* callLinkInfo = getCallLinkInfoForBytecodeIndex(locker, unlinkedCallLinkInfo.bytecodeIndex); 794 794 ASSERT(callLinkInfo); 795 callLinkInfo->setCodeLocations({ },unlinkedCallLinkInfo.doneLocation);795 static_cast<BaselineCallLinkInfo*>(callLinkInfo)->setCodeLocations(unlinkedCallLinkInfo.doneLocation); 796 796 } 797 797 … … 1626 1626 finalizeLLIntInlineCaches(); 1627 1627 // If the CodeBlock is DFG or FTL, CallLinkInfo in metadata is not related. 1628 forEachLLIntOrBaselineCallLinkInfo([&]( CallLinkInfo& callLinkInfo) {1628 forEachLLIntOrBaselineCallLinkInfo([&](BaselineCallLinkInfo& callLinkInfo) { 1629 1629 callLinkInfo.visitWeak(vm); 1630 1630 }); … … 1694 1694 { 1695 1695 if (JITCode::couldBeInterpreted(jitType())) { 1696 forEachLLIntOrBaselineCallLinkInfo([&]( CallLinkInfo& callLinkInfo) {1696 forEachLLIntOrBaselineCallLinkInfo([&](BaselineCallLinkInfo& callLinkInfo) { 1697 1697 result.add(callLinkInfo.codeOrigin(), ICStatus()).iterator->value.callLinkInfo = &callLinkInfo; 1698 1698 }); … … 2325 2325 #endif 2326 2326 } else { 2327 forEachLLIntOrBaselineCallLinkInfo([&]( CallLinkInfo& callLinkInfo) {2327 forEachLLIntOrBaselineCallLinkInfo([&](BaselineCallLinkInfo& callLinkInfo) { 2328 2328 callLinkInfo.setClearedByJettison(); 2329 2329 }); -
trunk/Source/JavaScriptCore/bytecode/GetterSetterAccessCase.h
r282664 r286769 45 45 // while we are executing GCAwareJITStubRoutine. It is not possible that GetterSetterAccessCase is alive while 46 46 // GCAwareJITStubRoutine is destroyed. 47 CallLinkInfo* callLinkInfo() const { return m_callLinkInfo; }47 OptimizingCallLinkInfo* callLinkInfo() const { return m_callLinkInfo; } 48 48 JSObject* customSlotBase() const { return m_customSlotBase.get(); } 49 49 std::optional<DOMAttributeAnnotation> domAttribute() const { return m_domAttribute; } … … 76 76 77 77 WriteBarrier<JSObject> m_customSlotBase; 78 CallLinkInfo* m_callLinkInfo { nullptr };78 OptimizingCallLinkInfo* m_callLinkInfo { nullptr }; 79 79 FunctionPtr<CustomAccessorPtrTag> m_customAccessor; 80 80 std::optional<DOMAttributeAnnotation> m_domAttribute; -
trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.h
r283954 r286769 225 225 std::unique_ptr<WatchpointsOnStructureStubInfo> watchpoints; 226 226 Vector<StructureID> weakStructures; 227 Bag< CallLinkInfo> m_callLinkInfos;227 Bag<OptimizingCallLinkInfo> m_callLinkInfos; 228 228 bool m_doesJSGetterSetterCalls : 1; 229 229 bool m_doesCalls : 1; -
trunk/Source/JavaScriptCore/bytecode/Repatch.cpp
r286095 r286769 143 143 callLinkInfo.clearCodeBlock(); 144 144 if (!callLinkInfo.clearedByJettison()) 145 callLinkInfo.initializeDirectCall();145 static_cast<OptimizingCallLinkInfo&>(callLinkInfo).initializeDirectCall(); 146 146 #endif 147 147 } else { … … 1551 1551 1552 1552 void linkDirectCall( 1553 CallFrame* callFrame, CallLinkInfo& callLinkInfo, CodeBlock* calleeCodeBlock,1553 CallFrame* callFrame, OptimizingCallLinkInfo& callLinkInfo, CodeBlock* calleeCodeBlock, 1554 1554 MacroAssemblerCodePtr<JSEntryPtrTag> codePtr) 1555 1555 { -
trunk/Source/JavaScriptCore/bytecode/Repatch.h
r286347 r286769 33 33 34 34 class CallLinkInfo; 35 class OptimizingCallLinkInfo; 35 36 class StructureStubInfo; 36 37 … … 72 73 void repatchInstanceOf(JSGlobalObject*, CodeBlock*, JSValue, JSValue prototype, StructureStubInfo&, bool wasFound); 73 74 void linkMonomorphicCall(VM&, CallFrame*, CallLinkInfo&, CodeBlock*, JSObject* callee, MacroAssemblerCodePtr<JSEntryPtrTag>); 74 void linkDirectCall(CallFrame*, CallLinkInfo&, CodeBlock*, MacroAssemblerCodePtr<JSEntryPtrTag>);75 void linkDirectCall(CallFrame*, OptimizingCallLinkInfo&, CodeBlock*, MacroAssemblerCodePtr<JSEntryPtrTag>); 75 76 void linkSlowFor(CallFrame*, CallLinkInfo&); 76 77 void unlinkCall(VM&, CallLinkInfo&); -
trunk/Source/JavaScriptCore/dfg/DFGCommonData.h
r285651 r286769 112 112 void clearWatchpoints(); 113 113 114 CallLinkInfo* addCallLinkInfo(CodeOrigin codeOrigin)114 OptimizingCallLinkInfo* addCallLinkInfo(CodeOrigin codeOrigin) 115 115 { 116 116 return m_callLinkInfos.add(codeOrigin); … … 132 132 Vector<JumpReplacement> m_jumpReplacements; 133 133 Bag<StructureStubInfo> m_stubInfos; 134 Bag< CallLinkInfo> m_callLinkInfos;134 Bag<OptimizingCallLinkInfo> m_callLinkInfos; 135 135 Yarr::YarrBoyerMoyerData m_boyerMooreData; 136 136 -
trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
r283139 r286769 261 261 262 262 for (auto& record : m_jsCalls) { 263 CallLinkInfo& info = *record.info;263 auto& info = *record.info; 264 264 info.setCodeLocations( 265 265 linkBuffer.locationOf<JSInternalPtrTag>(record.slowPathStart), … … 268 268 269 269 for (auto& record : m_jsDirectCalls) { 270 CallLinkInfo& info = *record.info;270 auto& info = *record.info; 271 271 info.setCodeLocations( 272 272 linkBuffer.locationOf<JSInternalPtrTag>(record.slowPath), -
trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.h
r286345 r286769 235 235 } 236 236 237 void addJSCall(Label slowPathStart, Label doneLocation, CallLinkInfo* info)237 void addJSCall(Label slowPathStart, Label doneLocation, OptimizingCallLinkInfo* info) 238 238 { 239 239 m_jsCalls.append(JSCallRecord(slowPathStart, doneLocation, info)); 240 240 } 241 241 242 void addJSDirectCall(Label slowPath, CallLinkInfo* info)242 void addJSDirectCall(Label slowPath, OptimizingCallLinkInfo* info) 243 243 { 244 244 m_jsDirectCalls.append(JSDirectCallRecord(slowPath, info)); … … 339 339 340 340 struct JSCallRecord { 341 JSCallRecord(Label slowPathStart, Label doneLocation, CallLinkInfo* info)341 JSCallRecord(Label slowPathStart, Label doneLocation, OptimizingCallLinkInfo* info) 342 342 : slowPathStart(slowPathStart) 343 343 , doneLocation(doneLocation) … … 348 348 Label slowPathStart; 349 349 Label doneLocation; 350 CallLinkInfo* info;350 OptimizingCallLinkInfo* info; 351 351 }; 352 352 353 353 struct JSDirectCallRecord { 354 JSDirectCallRecord(Label slowPath, CallLinkInfo* info)354 JSDirectCallRecord(Label slowPath, OptimizingCallLinkInfo* info) 355 355 : slowPath(slowPath) 356 356 , info(info) … … 359 359 360 360 Label slowPath; 361 CallLinkInfo* info;361 OptimizingCallLinkInfo* info; 362 362 }; 363 363 -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r285687 r286769 3680 3680 } 3681 3681 3682 JSC_DEFINE_JIT_OPERATION(operationLinkDirectCall, void, ( CallLinkInfo* callLinkInfo, JSFunction* callee))3682 JSC_DEFINE_JIT_OPERATION(operationLinkDirectCall, void, (OptimizingCallLinkInfo* callLinkInfo, JSFunction* callee)) 3683 3683 { 3684 3684 JSGlobalObject* globalObject = callee->globalObject(); -
trunk/Source/JavaScriptCore/dfg/DFGOperations.h
r285530 r286769 36 36 class DateInstance; 37 37 class JSBigInt; 38 class JSPropertyNameEnumerator; 39 class OptimizingCallLinkInfo; 38 40 struct UnlinkedStringJumpTable; 39 class JSPropertyNameEnumerator;40 41 41 42 namespace DFG { … … 315 316 JSC_DECLARE_JIT_OPERATION(operationNewObjectWithButterflyWithIndexingHeaderAndVectorLength, JSCell*, (VM*, Structure*, unsigned length, Butterfly*)); 316 317 317 JSC_DECLARE_JIT_OPERATION(operationLinkDirectCall, void, ( CallLinkInfo*, JSFunction*));318 JSC_DECLARE_JIT_OPERATION(operationLinkDirectCall, void, (OptimizingCallLinkInfo*, JSFunction*)); 318 319 319 320 JSC_DECLARE_JIT_OPERATION(operationDateGetFullYear, EncodedJSValue, (VM*, DateInstance*)); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r285795 r286769 787 787 CallSiteIndex callSite = m_jit.recordCallSiteAndGenerateExceptionHandlingOSRExitIfNeeded(dynamicOrigin, m_stream->size()); 788 788 789 CallLinkInfo* info = m_jit.jitCode()->common.addCallLinkInfo(node->origin.semantic);789 auto* info = m_jit.jitCode()->common.addCallLinkInfo(node->origin.semantic); 790 790 info->setUpCall(callType, calleePayloadGPR); 791 791 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r286345 r286769 891 891 }; 892 892 893 CallLinkInfo* callLinkInfo = m_jit.jitCode()->common.addCallLinkInfo(m_currentNode->origin.semantic);893 auto* callLinkInfo = m_jit.jitCode()->common.addCallLinkInfo(m_currentNode->origin.semantic); 894 894 callLinkInfo->setUpCall(callType, calleeGPR); 895 895 -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r286667 r286769 10266 10266 CCallHelpers::tagFor(VirtualRegister(CallFrameSlot::argumentCountIncludingThis))); 10267 10267 10268 CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(nodeSemanticOrigin);10268 auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(nodeSemanticOrigin); 10269 10269 callLinkInfo->setUpCall( 10270 10270 nodeOp == Construct ? CallLinkInfo::Construct : CallLinkInfo::Call, GPRInfo::regT0); … … 10400 10400 shuffleData.setupCalleeSaveRegisters(jit.codeBlock()); 10401 10401 10402 CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);10402 auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin); 10403 10403 callLinkInfo->setUpCall(CallLinkInfo::DirectTailCall, InvalidGPRReg); 10404 10404 … … 10432 10432 } 10433 10433 10434 CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);10434 auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin); 10435 10435 callLinkInfo->setUpCall( 10436 10436 isConstruct ? CallLinkInfo::DirectConstruct : CallLinkInfo::DirectCall, InvalidGPRReg); … … 10560 10560 shuffleData.setupCalleeSaveRegisters(jit.codeBlock()); 10561 10561 10562 CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(codeOrigin);10562 auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(codeOrigin); 10563 10563 callLinkInfo->setUpCall(CallLinkInfo::TailCall, GPRInfo::regT0); 10564 10564 … … 10765 10765 CCallHelpers::tagFor(VirtualRegister(CallFrameSlot::argumentCountIncludingThis))); 10766 10766 10767 CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);10767 auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin); 10768 10768 10769 10769 RegisterSet usedRegisters = RegisterSet::allRegisters(); … … 11049 11049 CCallHelpers::tagFor(VirtualRegister(CallFrameSlot::argumentCountIncludingThis))); 11050 11050 11051 CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);11051 auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin); 11052 11052 11053 11053 unsigned argIndex = 1; … … 11291 11291 CCallHelpers::tagFor(VirtualRegister(CallFrameSlot::argumentCountIncludingThis))); 11292 11292 11293 CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);11293 auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin); 11294 11294 callLinkInfo->setUpCall(CallLinkInfo::Call, GPRInfo::regT0); 11295 11295 -
trunk/Source/JavaScriptCore/jit/CallFrameShuffleData.cpp
r285795 r286769 86 86 CallFrameShuffleData CallFrameShuffleData::createForBaselineOrLLIntTailCall(const OpTailCall& bytecode, unsigned numParameters) 87 87 { 88 #if USE(JSVALUE64)89 constexpr JSValueRegs calleeJSR { GPRInfo::regT0 };90 #elif USE(JSVALUE32_64)91 constexpr JSValueRegs calleeJSR { GPRInfo::regT1, GPRInfo::regT0 };92 #endif93 88 CallFrameShuffleData shuffleData; 94 89 shuffleData.numPassedArgs = bytecode.m_argc; … … 106 101 } 107 102 #if USE(JSVALUE64) 108 shuffleData.callee = ValueRecovery::inGPR( calleeJSR.payloadGPR(), DataFormatJS);103 shuffleData.callee = ValueRecovery::inGPR(BaselineCallRegisters::calleeJSR.payloadGPR(), DataFormatJS); 109 104 #elif USE(JSVALUE32_64) 110 shuffleData.callee = ValueRecovery::inPair( calleeJSR.tagGPR(),calleeJSR.payloadGPR());105 shuffleData.callee = ValueRecovery::inPair(BaselineCallRegisters::calleeJSR.tagGPR(), BaselineCallRegisters::calleeJSR.payloadGPR()); 111 106 #endif 112 107 shuffleData.setupCalleeSaveRegisters(&RegisterAtOffsetList::llintBaselineCalleeSaveRegisters()); -
trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp
r286345 r286769 106 106 MarkingGCAwareJITStubRoutine::MarkingGCAwareJITStubRoutine( 107 107 const MacroAssemblerCodeRef<JITStubRoutinePtrTag>& code, VM& vm, FixedVector<RefPtr<AccessCase>>&& cases, FixedVector<StructureID>&& weakStructures, const JSCell* owner, 108 const Vector<JSCell*>& cells, Bag< CallLinkInfo>&& callLinkInfos)108 const Vector<JSCell*>& cells, Bag<OptimizingCallLinkInfo>&& callLinkInfos) 109 109 : PolymorphicAccessJITStubRoutine(code, vm, WTFMove(cases), WTFMove(weakStructures)) 110 110 , m_cells(cells.size()) … … 136 136 137 137 GCAwareJITStubRoutineWithExceptionHandler::GCAwareJITStubRoutineWithExceptionHandler( 138 const MacroAssemblerCodeRef<JITStubRoutinePtrTag>& code, VM& vm, FixedVector<RefPtr<AccessCase>>&& cases, FixedVector<StructureID>&& weakStructures, const JSCell* owner, const Vector<JSCell*>& cells, Bag< CallLinkInfo>&& callLinkInfos,138 const MacroAssemblerCodeRef<JITStubRoutinePtrTag>& code, VM& vm, FixedVector<RefPtr<AccessCase>>&& cases, FixedVector<StructureID>&& weakStructures, const JSCell* owner, const Vector<JSCell*>& cells, Bag<OptimizingCallLinkInfo>&& callLinkInfos, 139 139 CodeBlock* codeBlockForExceptionHandlers, DisposableCallSiteIndex exceptionHandlerCallSiteIndex) 140 140 : MarkingGCAwareJITStubRoutine(code, vm, WTFMove(cases), WTFMove(weakStructures), owner, cells, WTFMove(callLinkInfos)) … … 190 190 bool makesCalls, 191 191 const Vector<JSCell*>& cells, 192 Bag< CallLinkInfo>&& callLinkInfos,192 Bag<OptimizingCallLinkInfo>&& callLinkInfos, 193 193 CodeBlock* codeBlockForExceptionHandlers, 194 194 DisposableCallSiteIndex exceptionHandlerCallSiteIndex) -
trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.h
r278656 r286769 43 43 class CallLinkInfo; 44 44 class JITStubRoutineSet; 45 class OptimizingCallLinkInfo; 45 46 46 47 // Use this stub routine if you know that your code might be on stack when … … 125 126 126 127 MarkingGCAwareJITStubRoutine( 127 const MacroAssemblerCodeRef<JITStubRoutinePtrTag>&, VM&, FixedVector<RefPtr<AccessCase>>&&, FixedVector<StructureID>&&, const JSCell* owner, const Vector<JSCell*>&, Bag< CallLinkInfo>&&);128 const MacroAssemblerCodeRef<JITStubRoutinePtrTag>&, VM&, FixedVector<RefPtr<AccessCase>>&&, FixedVector<StructureID>&&, const JSCell* owner, const Vector<JSCell*>&, Bag<OptimizingCallLinkInfo>&&); 128 129 ~MarkingGCAwareJITStubRoutine() override; 129 130 … … 135 136 private: 136 137 FixedVector<WriteBarrier<JSCell>> m_cells; 137 Bag< CallLinkInfo> m_callLinkInfos;138 Bag<OptimizingCallLinkInfo> m_callLinkInfos; 138 139 }; 139 140 … … 146 147 using Base = MarkingGCAwareJITStubRoutine; 147 148 148 GCAwareJITStubRoutineWithExceptionHandler(const MacroAssemblerCodeRef<JITStubRoutinePtrTag>&, VM&, FixedVector<RefPtr<AccessCase>>&&, FixedVector<StructureID>&&, const JSCell* owner, const Vector<JSCell*>&, Bag< CallLinkInfo>&&, CodeBlock*, DisposableCallSiteIndex);149 GCAwareJITStubRoutineWithExceptionHandler(const MacroAssemblerCodeRef<JITStubRoutinePtrTag>&, VM&, FixedVector<RefPtr<AccessCase>>&&, FixedVector<StructureID>&&, const JSCell* owner, const Vector<JSCell*>&, Bag<OptimizingCallLinkInfo>&&, CodeBlock*, DisposableCallSiteIndex); 149 150 ~GCAwareJITStubRoutineWithExceptionHandler() final; 150 151 … … 182 183 Ref<PolymorphicAccessJITStubRoutine> createICJITStubRoutine( 183 184 const MacroAssemblerCodeRef<JITStubRoutinePtrTag>&, FixedVector<RefPtr<AccessCase>>&& cases, FixedVector<StructureID>&& weakStructures, VM&, const JSCell* owner, bool makesCalls, 184 const Vector<JSCell*>&, Bag< CallLinkInfo>&& callLinkInfos,185 const Vector<JSCell*>&, Bag<OptimizingCallLinkInfo>&& callLinkInfos, 185 186 CodeBlock* codeBlockForExceptionHandlers, DisposableCallSiteIndex exceptionHandlingCallSiteIndex); 186 187 -
trunk/Source/JavaScriptCore/jit/JITCall.cpp
r286424 r286769 43 43 namespace JSC { 44 44 45 namespace {46 constexpr JSValueRegs calleeJSR = JSRInfo::jsRegT10;47 }48 49 45 void JIT::emit_op_ret(const Instruction* currentInstruction) 50 46 { … … 201 197 addPtr(TrustedImm32(registerOffset * sizeof(Register) + sizeof(CallerFrameAndPC)), callFrameRegister, stackPointerRegister); 202 198 203 loadValue(Address(stackPointerRegister, sizeof(Register) * CallFrameSlot::callee - sizeof(CallerFrameAndPC)), calleeJSR); 199 static_assert(noOverlap(BaselineCallRegisters::calleeJSR, BaselineCallRegisters::callLinkInfoGPR, regT3)); 200 loadValue(Address(stackPointerRegister, sizeof(Register) * CallFrameSlot::callee - sizeof(CallerFrameAndPC)), BaselineCallRegisters::calleeJSR); 204 201 loadGlobalObject(regT3); 205 constexpr GPRReg callLinkInfoGPR = regT2; 206 materializePointerIntoMetadata(bytecode, OpCallEval::Metadata::offsetOfCallLinkInfo(), callLinkInfoGPR); 207 emitVirtualCallWithoutMovingGlobalObject(*m_vm, callLinkInfoGPR, CallMode::Regular); 202 materializePointerIntoMetadata(bytecode, OpCallEval::Metadata::offsetOfCallLinkInfo(), BaselineCallRegisters::callLinkInfoGPR); 203 emitVirtualCallWithoutMovingGlobalObject(*m_vm, BaselineCallRegisters::callLinkInfoGPR, CallMode::Regular); 208 204 resetSP(); 209 205 } … … 218 214 bool JIT::compileTailCall(const OpTailCall& bytecode, UnlinkedCallLinkInfo*, unsigned callLinkInfoIndex) 219 215 { 220 constexpr GPRReg callLinkInfoGPR = regT2; 221 materializePointerIntoMetadata(bytecode, OpTailCall::Metadata::offsetOfCallLinkInfo(), callLinkInfoGPR); 222 JumpList slowPaths = CallLinkInfo::emitTailCallDataICFastPath(*this, calleeJSR.payloadGPR(), callLinkInfoGPR, scopedLambda<void()>([&]{ 216 materializePointerIntoMetadata(bytecode, OpTailCall::Metadata::offsetOfCallLinkInfo(), BaselineCallRegisters::callLinkInfoGPR); 217 JumpList slowPaths = CallLinkInfo::emitTailCallDataICFastPath(*this, BaselineCallRegisters::calleeJSR.payloadGPR(), BaselineCallRegisters::callLinkInfoGPR, scopedLambda<void()>([&] { 223 218 CallFrameShuffleData shuffleData = CallFrameShuffleData::createForBaselineOrLLIntTailCall(bytecode, m_unlinkedCodeBlock->numParameters()); 224 219 CallFrameShuffler shuffler { *this, shuffleData }; 225 shuffler.lockGPR( callLinkInfoGPR);220 shuffler.lockGPR(BaselineCallRegisters::callLinkInfoGPR); 226 221 shuffler.prepareForTailCall(); 227 222 })); … … 268 263 store32(TrustedImm32(locationBits), Address(callFrameRegister, CallFrameSlot::argumentCountIncludingThis * static_cast<int>(sizeof(Register)) + TagOffset)); 269 264 270 emitGetVirtualRegister(callee, calleeJSR);271 storeValue( calleeJSR, Address(stackPointerRegister, CallFrameSlot::callee * static_cast<int>(sizeof(Register)) - sizeof(CallerFrameAndPC)));265 emitGetVirtualRegister(callee, BaselineCallRegisters::calleeJSR); 266 storeValue(BaselineCallRegisters::calleeJSR, Address(stackPointerRegister, CallFrameSlot::callee * static_cast<int>(sizeof(Register)) - sizeof(CallerFrameAndPC))); 272 267 273 268 if (compileCallEval(bytecode)) … … 277 272 // We need this on JSVALUE32_64 only as on JSVALUE64 a pointer comparison in the DataIC fast 278 273 // path catches this. 279 addSlowCase(branchIfNotCell( calleeJSR));274 addSlowCase(branchIfNotCell(BaselineCallRegisters::calleeJSR)); 280 275 #endif 281 276 … … 283 278 return; 284 279 285 constexpr GPRReg callLinkInfoGPR = regT2; 286 materializePointerIntoMetadata(bytecode, Op::Metadata::offsetOfCallLinkInfo(), callLinkInfoGPR); 280 materializePointerIntoMetadata(bytecode, Op::Metadata::offsetOfCallLinkInfo(), BaselineCallRegisters::callLinkInfoGPR); 287 281 if (opcodeID == op_tail_call_varargs || opcodeID == op_tail_call_forward_arguments) { 288 auto slowPaths = CallLinkInfo::emitTailCallDataICFastPath(*this, calleeJSR.payloadGPR(), callLinkInfoGPR, scopedLambda<void()>([&]{282 auto slowPaths = CallLinkInfo::emitTailCallDataICFastPath(*this, BaselineCallRegisters::calleeJSR.payloadGPR(), BaselineCallRegisters::callLinkInfoGPR, scopedLambda<void()>([&] { 289 283 emitRestoreCalleeSaves(); 290 prepareForTailCallSlow( callLinkInfoGPR);284 prepareForTailCallSlow(BaselineCallRegisters::callLinkInfoGPR); 291 285 })); 292 286 addSlowCase(slowPaths); … … 296 290 } 297 291 298 auto slowPaths = CallLinkInfo::emitDataICFastPath(*this, calleeJSR.payloadGPR(),callLinkInfoGPR);292 auto slowPaths = CallLinkInfo::emitDataICFastPath(*this, BaselineCallRegisters::calleeJSR.payloadGPR(), BaselineCallRegisters::callLinkInfoGPR); 299 293 auto doneLocation = label(); 300 294 addSlowCase(slowPaths); -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlock.h
r273138 r286769 91 91 Ref<Wasm::CodeBlock> m_codeBlock; 92 92 Vector<MacroAssemblerCodeRef<WasmEntryPtrTag>> m_wasmToJSExitStubs; 93 Bag< CallLinkInfo> m_callLinkInfos;93 Bag<OptimizingCallLinkInfo> m_callLinkInfos; 94 94 String m_errorMessage; 95 95 }; -
trunk/Source/JavaScriptCore/wasm/js/WasmToJS.cpp
r284935 r286769 52 52 } 53 53 54 Expected<MacroAssemblerCodeRef<WasmEntryPtrTag>, BindingFailure> wasmToJS(VM& vm, Bag< CallLinkInfo>& callLinkInfos, SignatureIndex signatureIndex, unsigned importIndex)54 Expected<MacroAssemblerCodeRef<WasmEntryPtrTag>, BindingFailure> wasmToJS(VM& vm, Bag<OptimizingCallLinkInfo>& callLinkInfos, SignatureIndex signatureIndex, unsigned importIndex) 55 55 { 56 56 // FIXME: This function doesn't properly abstract away the calling convention. … … 262 262 // FIXME Tail call if the wasm return type is void and no registers were spilled. https://bugs.webkit.org/show_bug.cgi?id=165488 263 263 264 CallLinkInfo* callLinkInfo = callLinkInfos.add(CodeOrigin());264 auto* callLinkInfo = callLinkInfos.add(CodeOrigin()); 265 265 callLinkInfo->setUpCall(CallLinkInfo::Call, importJSCellGPRReg); 266 266 auto slowPath = callLinkInfo->emitFastPath(jit, importJSCellGPRReg, InvalidGPRReg, CallLinkInfo::UseDataIC::No); -
trunk/Source/JavaScriptCore/wasm/js/WasmToJS.h
r271594 r286769 43 43 class Instance; 44 44 45 Expected<MacroAssemblerCodeRef<WasmEntryPtrTag>, BindingFailure> wasmToJS(VM&, Bag< CallLinkInfo>& callLinkInfos, SignatureIndex, unsigned importIndex);45 Expected<MacroAssemblerCodeRef<WasmEntryPtrTag>, BindingFailure> wasmToJS(VM&, Bag<OptimizingCallLinkInfo>& callLinkInfos, SignatureIndex, unsigned importIndex); 46 46 47 47 void emitThrowWasmToJSException(CCallHelpers&, GPRReg wasmInstance, Wasm::ExceptionType);
Note:
See TracChangeset
for help on using the changeset viewer.