Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (276455 => 276456)
--- trunk/Source/_javascript_Core/ChangeLog 2021-04-22 20:01:01 UTC (rev 276455)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-04-22 20:17:21 UTC (rev 276456)
@@ -1,5 +1,31 @@
2021-04-22 Yusuke Suzuki <[email protected]>
+ [JSC} Remove exception checks from non-throwing function calls in Baseline JIT
+ https://bugs.webkit.org/show_bug.cgi?id=224920
+
+ Reviewed by Tadeu Zagallo.
+
+ These functions are not taking JSGlobalObject and will not throw an error.
+ Use callOperationNoExceptionCheck instead to avoid emitting unnecessary exception checks.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::emitEnterOptimizationCheck):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emitSlow_op_new_object):
+ (JSC::JIT::emit_op_catch):
+ (JSC::JIT::emit_op_switch_imm):
+ (JSC::JIT::emitSlow_op_loop_hint):
+ (JSC::JIT::emit_op_profile_type):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emitSlow_op_new_object):
+ (JSC::JIT::emit_op_catch):
+ (JSC::JIT::emit_op_switch_imm):
+ (JSC::JIT::emit_op_profile_type):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emitWriteBarrier):
+
+2021-04-22 Yusuke Suzuki <[email protected]>
+
[JSC] Baseline should have fast path for switch_imm
https://bugs.webkit.org/show_bug.cgi?id=224521
Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (276455 => 276456)
--- trunk/Source/_javascript_Core/jit/JIT.cpp 2021-04-22 20:01:01 UTC (rev 276455)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp 2021-04-22 20:17:21 UTC (rev 276456)
@@ -95,7 +95,7 @@
copyCalleeSavesFromFrameOrRegisterToEntryFrameCalleeSavesBuffer(vm().topEntryFrame);
- callOperation(operationOptimize, &vm(), m_bytecodeIndex.asBits());
+ callOperationNoExceptionCheck(operationOptimize, &vm(), m_bytecodeIndex.asBits());
skipOptimize.append(branchTestPtr(Zero, returnValueGPR));
farJump(returnValueGPR, GPRInfo::callFrameRegister);
skipOptimize.link(this);
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (276455 => 276456)
--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2021-04-22 20:01:01 UTC (rev 276455)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2021-04-22 20:17:21 UTC (rev 276456)
@@ -115,7 +115,7 @@
auto& metadata = bytecode.metadata(m_codeBlock);
VirtualRegister dst = bytecode.m_dst;
Structure* structure = metadata.m_objectAllocationProfile.structure();
- callOperation(operationNewObject, TrustedImmPtr(&vm()), structure);
+ callOperationNoExceptionCheck(operationNewObject, &vm(), structure);
emitStoreCell(dst, returnValueGPR);
}
@@ -842,7 +842,7 @@
addPtr(TrustedImm32(stackPointerOffsetFor(codeBlock()) * sizeof(Register)), callFrameRegister, stackPointerRegister);
- callOperationNoExceptionCheck(operationRetrieveAndClearExceptionIfCatchable, TrustedImmPtr(&vm()));
+ callOperationNoExceptionCheck(operationRetrieveAndClearExceptionIfCatchable, &vm());
Jump isCatchableException = branchTest32(NonZero, returnValueGPR);
jumpToExceptionHandler(vm());
isCatchableException.link(this);
@@ -861,9 +861,9 @@
auto& metadata = bytecode.metadata(m_codeBlock);
ValueProfileAndVirtualRegisterBuffer* buffer = metadata.m_buffer;
if (buffer || !shouldEmitProfiling())
- callOperation(operationTryOSREnterAtCatch, &vm(), m_bytecodeIndex.asBits());
+ callOperationNoExceptionCheck(operationTryOSREnterAtCatch, &vm(), m_bytecodeIndex.asBits());
else
- callOperation(operationTryOSREnterAtCatchAndValueProfile, &vm(), m_bytecodeIndex.asBits());
+ callOperationNoExceptionCheck(operationTryOSREnterAtCatchAndValueProfile, &vm(), m_bytecodeIndex.asBits());
auto skipOSREntry = branchTestPtr(Zero, returnValueGPR);
emitRestoreCalleeSaves();
farJump(returnValueGPR, ExceptionHandlerPtrTag);
@@ -914,7 +914,7 @@
farJump(BaseIndex(regT1, regT0, ScalePtr), JSSwitchPtrTag);
notInt32.link(this);
- callOperationNoExceptionCheck(operationSwitchImmWithUnknownKeyType, TrustedImmPtr(&vm()), regT0, tableIndex, unlinkedTable.m_min);
+ callOperationNoExceptionCheck(operationSwitchImmWithUnknownKeyType, &vm(), regT0, tableIndex, unlinkedTable.m_min);
farJump(returnValueGPR, JSSwitchPtrTag);
}
@@ -1210,7 +1210,7 @@
copyCalleeSavesFromFrameOrRegisterToEntryFrameCalleeSavesBuffer(vm().topEntryFrame);
- callOperation(operationOptimize, &vm(), m_bytecodeIndex.asBits());
+ callOperationNoExceptionCheck(operationOptimize, &vm(), m_bytecodeIndex.asBits());
Jump noOptimizedEntry = branchTestPtr(Zero, returnValueGPR);
if (ASSERT_ENABLED) {
Jump ok = branchPtr(MacroAssembler::Above, returnValueGPR, TrustedImmPtr(bitwise_cast<void*>(static_cast<intptr_t>(1000))));
@@ -1663,7 +1663,7 @@
store64(regT1, Address(regT2, TypeProfilerLog::currentLogEntryOffset()));
Jump skipClearLog = branchPtr(NotEqual, regT1, TrustedImmPtr(cachedTypeProfilerLog->logEndPtr()));
// Clear the log if we're at the end of the log.
- callOperation(operationProcessTypeProfilerLog, &vm());
+ callOperationNoExceptionCheck(operationProcessTypeProfilerLog, &vm());
skipClearLog.link(this);
jumpToEnd.link(this);
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp (276455 => 276456)
--- trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp 2021-04-22 20:01:01 UTC (rev 276455)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp 2021-04-22 20:17:21 UTC (rev 276456)
@@ -113,7 +113,7 @@
auto& metadata = bytecode.metadata(m_codeBlock);
VirtualRegister dst = bytecode.m_dst;
Structure* structure = metadata.m_objectAllocationProfile.structure();
- callOperation(operationNewObject, TrustedImmPtr(&vm()), structure);
+ callOperationNoExceptionCheck(operationNewObject, &vm(), structure);
emitStoreCell(dst, returnValueGPR);
}
@@ -931,7 +931,7 @@
addPtr(TrustedImm32(stackPointerOffsetFor(codeBlock()) * sizeof(Register)), callFrameRegister, stackPointerRegister);
- callOperationNoExceptionCheck(operationRetrieveAndClearExceptionIfCatchable, TrustedImmPtr(&vm()));
+ callOperationNoExceptionCheck(operationRetrieveAndClearExceptionIfCatchable, &vm());
Jump isCatchableException = branchTest32(NonZero, returnValueGPR);
jumpToExceptionHandler(vm());
isCatchableException.link(this);
@@ -955,9 +955,9 @@
auto& metadata = bytecode.metadata(m_codeBlock);
ValueProfileAndVirtualRegisterBuffer* buffer = metadata.m_buffer;
if (buffer || !shouldEmitProfiling())
- callOperation(operationTryOSREnterAtCatch, &vm(), m_bytecodeIndex.asBits());
+ callOperationNoExceptionCheck(operationTryOSREnterAtCatch, &vm(), m_bytecodeIndex.asBits());
else
- callOperation(operationTryOSREnterAtCatchAndValueProfile, &vm(), m_bytecodeIndex.asBits());
+ callOperationNoExceptionCheck(operationTryOSREnterAtCatchAndValueProfile, &vm(), m_bytecodeIndex.asBits());
auto skipOSREntry = branchTestPtr(Zero, returnValueGPR);
emitRestoreCalleeSaves();
farJump(returnValueGPR, NoPtrTag);
@@ -1009,7 +1009,7 @@
farJump(regT1, NoPtrTag);
notInt32.link(this);
- callOperationNoExceptionCheck(operationSwitchImmWithUnknownKeyType, TrustedImmPtr(&vm()), JSValueRegs(regT1, regT0), tableIndex, unlinkedTable.m_min);
+ callOperationNoExceptionCheck(operationSwitchImmWithUnknownKeyType, &vm(), JSValueRegs(regT1, regT0), tableIndex, unlinkedTable.m_min);
farJump(returnValueGPR, NoPtrTag);
}
@@ -1423,7 +1423,7 @@
store32(regT1, Address(regT2, TypeProfilerLog::currentLogEntryOffset()));
jumpToEnd.append(branchPtr(NotEqual, regT1, TrustedImmPtr(cachedTypeProfilerLog->logEndPtr())));
// Clear the log if we're at the end of the log.
- callOperation(operationProcessTypeProfilerLog, &vm());
+ callOperationNoExceptionCheck(operationProcessTypeProfilerLog, &vm());
jumpToEnd.link(this);
}
Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp (276455 => 276456)
--- trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp 2021-04-22 20:01:01 UTC (rev 276455)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp 2021-04-22 20:17:21 UTC (rev 276456)
@@ -1371,7 +1371,7 @@
ownerNotCell = branchIfNotCell(regT0);
Jump ownerIsRememberedOrInEden = barrierBranch(vm(), regT0, regT1);
- callOperation(operationWriteBarrierSlowPath, &vm(), regT0);
+ callOperationNoExceptionCheck(operationWriteBarrierSlowPath, &vm(), regT0);
ownerIsRememberedOrInEden.link(this);
if (mode == ShouldFilterBaseAndValue || mode == ShouldFilterBase)
@@ -1440,7 +1440,7 @@
ownerNotCell = branchIfNotCell(regT0);
Jump ownerIsRememberedOrInEden = barrierBranch(vm(), regT1, regT2);
- callOperation(operationWriteBarrierSlowPath, &vm(), regT1);
+ callOperationNoExceptionCheck(operationWriteBarrierSlowPath, &vm(), regT1);
ownerIsRememberedOrInEden.link(this);
if (mode == ShouldFilterBase || mode == ShouldFilterBaseAndValue)
@@ -1522,7 +1522,7 @@
void JIT::emitWriteBarrier(JSCell* owner)
{
Jump ownerIsRememberedOrInEden = barrierBranch(vm(), owner, regT0);
- callOperation(operationWriteBarrierSlowPath, &vm(), owner);
+ callOperationNoExceptionCheck(operationWriteBarrierSlowPath, &vm(), owner);
ownerIsRememberedOrInEden.link(this);
}