Skip to content

Commit bf1dab7

Browse files
committed
[JSC] Remove many 32bit-only concept from JIT
https://bugs.webkit.org/show_bug.cgi?id=321164 rdar://184200996 Reviewed by Sosuke Suzuki. We remove many GPR pairs which are only used for 32bit's JSValue representation. Also remove various DFG formats which are only used in 32bit. Additionally, dropping 32bit-only-related OSR entry code. * Source/JavaScriptCore/bytecode/DataFormat.h: (JSC::isJSFormat): Deleted. (JSC::isJSInt32): Deleted. (JSC::isJSDouble): Deleted. (JSC::isJSCell): Deleted. (JSC::isJSBoolean): Deleted. * Source/JavaScriptCore/bytecode/ValueRecovery.cpp: (JSC::ValueRecovery::dumpInContext const): * Source/JavaScriptCore/bytecode/ValueRecovery.h: (JSC::ValueRecovery::inGPR): (JSC::ValueRecovery::isInGPR const): (JSC::ValueRecovery::dataFormat const): (JSC::ValueRecovery::forEachReg): * Source/JavaScriptCore/dfg/DFGAbstractValue.h: * Source/JavaScriptCore/dfg/DFGGenerationInfo.h: (JSC::DFG::GenerationInfo::initCell): (JSC::DFG::GenerationInfo::fillStrictInt52): (JSC::DFG::GenerationInfo::initBoolean): Deleted. (JSC::DFG::GenerationInfo::isJSFormat): Deleted. (JSC::DFG::GenerationInfo::isJSInt32): Deleted. (JSC::DFG::GenerationInfo::isJSDouble): Deleted. (JSC::DFG::GenerationInfo::isJSCell): Deleted. (JSC::DFG::GenerationInfo::isJSBoolean): Deleted. (JSC::DFG::GenerationInfo::fillBoolean): Deleted. * Source/JavaScriptCore/dfg/DFGNode.h: (JSC::DFG::Node::asBoolean): Deleted. * Source/JavaScriptCore/dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * Source/JavaScriptCore/dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::compileExit): * Source/JavaScriptCore/dfg/DFGSilentRegisterSavePlan.h: * Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::silentSavePlanForGPR): (JSC::DFG::SpeculativeJIT::silentSpillImpl): (JSC::DFG::SpeculativeJIT::silentFillImpl): (JSC::DFG::SpeculativeJIT::checkGeneratedTypeForToInt32): (JSC::DFG::SpeculativeJIT::compileExtractFromTuple): * Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::spill): * Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillJSValue): (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): (JSC::DFG::SpeculativeJIT::fillSpeculateBigInt32): * Source/JavaScriptCore/dfg/DFGUseKind.h: * Source/JavaScriptCore/dfg/DFGVariableEvent.h: * Source/JavaScriptCore/dfg/DFGVariableEventStream.cpp: * Source/JavaScriptCore/jit/CallFrameShuffler64.cpp: (JSC::CallFrameShuffler::emitStore): (JSC::CallFrameShuffler::emitBox): * Source/JavaScriptCore/jit/JIT.h: * Source/JavaScriptCore/jit/JITArithmetic.cpp: (JSC::JIT::emit_compareUnsignedAndJumpImpl): (JSC::JIT::emit_compareUnsignedImpl): * Source/JavaScriptCore/jit/JITCall.cpp: (JSC::JIT::compileCallDirectEval): (JSC::JIT::emit_op_async_iterator_next): (JSC::JIT::emit_op_instanceof): * Source/JavaScriptCore/jit/JITInlines.h: (JSC::JIT::emitGetVirtualRegisterPayload): Deleted. * Source/JavaScriptCore/jit/JITOpcodes.cpp: (JSC::JIT::emit_op_set_function_name): (JSC::JIT::emit_op_get_parent_scope): (JSC::JIT::emit_op_create_this): (JSC::JIT::emitNewFuncCommon): (JSC::JIT::emitNewFuncExprCommon): (JSC::JIT::emit_op_create_lexical_environment): (JSC::JIT::emit_op_create_scoped_arguments): (JSC::JIT::emit_op_log_shadow_chicken_prologue): (JSC::JIT::emit_op_log_shadow_chicken_tail): * Source/JavaScriptCore/jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): (JSC::JIT::emit_op_put_getter_setter_by_id): (JSC::JIT::emit_op_put_getter_by_val): (JSC::JIT::emit_op_put_setter_by_val): (JSC::JIT::emit_op_resolve_scope): (JSC::JIT::emitSlow_op_resolve_scope): (JSC::JIT::emit_op_get_from_scope): (JSC::JIT::emitSlow_op_get_from_scope): (JSC::JIT::emit_op_put_to_scope): (JSC::JIT::emit_op_get_from_arguments): (JSC::JIT::emit_op_put_to_arguments): (JSC::JIT::emit_op_get_internal_field): (JSC::JIT::emit_op_put_internal_field): * Source/JavaScriptCore/wasm/WasmBBQJIT.cpp: (JSC::Wasm::BBQJITImpl::Location::dump const): (JSC::Wasm::BBQJITImpl::Location::operator== const): (JSC::Wasm::BBQJITImpl::BBQJIT::saveValuesAcrossCallAndPassArguments): (JSC::Wasm::BBQJITImpl::BBQJIT::returnValuesFromCall): (JSC::Wasm::BBQJITImpl::BBQJIT::addFusedIfCompare): (JSC::Wasm::BBQJITImpl::BBQJIT::setLRUKey): (JSC::Wasm::BBQJITImpl::BBQJIT::allocateWithHint): (JSC::Wasm::BBQJITImpl::BBQJIT::bind): (JSC::Wasm::BBQJITImpl::BBQJIT::unbind): (JSC::Wasm::BBQJITImpl::Location::isGPR2 const): Deleted. (JSC::Wasm::BBQJITImpl::Location::asGPRlo const): Deleted. (JSC::Wasm::BBQJITImpl::Location::asGPRhi const): Deleted. * Source/JavaScriptCore/wasm/WasmBBQJIT.h: (JSC::Wasm::BBQJITImpl::BBQJIT::ScratchScope::initializedPreservedSet): * Source/JavaScriptCore/wasm/WasmBBQJIT64.h: (JSC::Wasm::BBQJITImpl::BBQJIT::typeNeedsGPR2): Deleted. Canonical link: https://commits.webkit.org/318721@main
1 parent 7b4c336 commit bf1dab7

25 files changed

Lines changed: 60 additions & 308 deletions

‎Source/JavaScriptCore/bytecode/DataFormat.h‎

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -100,32 +100,6 @@ inline const char* dataFormatToString(DataFormat dataFormat)
100100
}
101101
}
102102

103-
inline bool isJSFormat(DataFormat format, DataFormat expectedFormat)
104-
{
105-
ASSERT(expectedFormat & DataFormatJS);
106-
return (format | DataFormatJS) == expectedFormat;
107-
}
108-
109-
inline bool isJSInt32(DataFormat format)
110-
{
111-
return isJSFormat(format, DataFormatJSInt32);
112-
}
113-
114-
inline bool isJSDouble(DataFormat format)
115-
{
116-
return isJSFormat(format, DataFormatJSDouble);
117-
}
118-
119-
inline bool isJSCell(DataFormat format)
120-
{
121-
return isJSFormat(format, DataFormatJSCell);
122-
}
123-
124-
inline bool isJSBoolean(DataFormat format)
125-
{
126-
return isJSFormat(format, DataFormatJSBoolean);
127-
}
128-
129103
} // namespace JSC
130104

131105
namespace WTF {

‎Source/JavaScriptCore/bytecode/ValueRecovery.cpp‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ void ValueRecovery::dumpInContext(PrintStream& out, DumpContext* context) const
7373
case UnboxedStrictInt52InGPR:
7474
out.print("strictInt52(", gpr(), ")");
7575
return;
76-
case UnboxedBooleanInGPR:
77-
out.print("bool(", gpr(), ")");
78-
return;
7976
case UnboxedCellInGPR:
8077
out.print("cell(", gpr(), ")");
8178
return;

‎Source/JavaScriptCore/bytecode/ValueRecovery.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ enum ValueRecoveryTechnique : uint8_t {
5959
UnboxedInt32InGPR,
6060
UnboxedInt52InGPR,
6161
UnboxedStrictInt52InGPR,
62-
UnboxedBooleanInGPR,
6362
UnboxedCellInGPR,
6463
InFPR,
6564
UnboxedDoubleInFPR,
@@ -114,8 +113,6 @@ class ValueRecovery {
114113
result.m_technique = UnboxedInt52InGPR;
115114
else if (dataFormat == DataFormatStrictInt52)
116115
result.m_technique = UnboxedStrictInt52InGPR;
117-
else if (dataFormat == DataFormatBoolean)
118-
result.m_technique = UnboxedBooleanInGPR;
119116
else if (dataFormat == DataFormatCell)
120117
result.m_technique = UnboxedCellInGPR;
121118
else
@@ -218,7 +215,6 @@ class ValueRecovery {
218215
switch (m_technique) {
219216
case InGPR:
220217
case UnboxedInt32InGPR:
221-
case UnboxedBooleanInGPR:
222218
case UnboxedCellInGPR:
223219
case UnboxedInt52InGPR:
224220
case UnboxedStrictInt52InGPR:
@@ -277,7 +273,6 @@ class ValueRecovery {
277273
case UnboxedStrictInt52InGPR:
278274
case StrictInt52DisplacedInJSStack:
279275
return DataFormatStrictInt52;
280-
case UnboxedBooleanInGPR:
281276
case BooleanDisplacedInJSStack:
282277
return DataFormatBoolean;
283278
case UnboxedCellInGPR:
@@ -358,7 +353,6 @@ class ValueRecovery {
358353
switch (m_technique) {
359354
case InGPR:
360355
case UnboxedInt32InGPR:
361-
case UnboxedBooleanInGPR:
362356
case UnboxedCellInGPR:
363357
case UnboxedInt52InGPR:
364358
case UnboxedStrictInt52InGPR:

‎Source/JavaScriptCore/dfg/DFGAbstractValue.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,7 @@ struct AbstractValue {
447447
// complex than the normal Epoch, because it knows how to track clobberStructures() and
448448
// observeInvalidationPoint() precisely using integer math.
449449
//
450-
// One reason why it's here is to steal the 32-bit hole between m_arrayModes and m_value on
451-
// 64-bit systems.
450+
// One reason why it's here is to steal the 32-bit hole between m_arrayModes and m_value.
452451
AbstractValueClobberEpoch m_effectEpoch;
453452

454453
// This is a proven constraint on the possible values that this value can

‎Source/JavaScriptCore/dfg/DFGGenerationInfo.h‎

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ class GenerationInfo {
105105
{
106106
initGPR(node, useCount, gpr, DataFormatCell);
107107
}
108-
void initBoolean(Node* node, uint32_t useCount, GPRReg gpr)
109-
{
110-
initGPR(node, useCount, gpr, DataFormatBoolean);
111-
}
112108
void initDouble(Node* node, uint32_t useCount, FPRReg fpr)
113109
{
114110
ASSERT(fpr != InvalidFPRReg);
@@ -192,16 +188,6 @@ class GenerationInfo {
192188
return registerFormat() == expectedFormat || spillFormat() == expectedFormat;
193189
}
194190

195-
bool isJSFormat(DataFormat expectedFormat)
196-
{
197-
return JSC::isJSFormat(registerFormat(), expectedFormat) || JSC::isJSFormat(spillFormat(), expectedFormat);
198-
}
199-
200-
bool isJSInt32()
201-
{
202-
return isJSFormat(DataFormatJSInt32);
203-
}
204-
205191
bool isInt52()
206192
{
207193
return isFormat(DataFormatInt52);
@@ -212,21 +198,6 @@ class GenerationInfo {
212198
return isFormat(DataFormatStrictInt52);
213199
}
214200

215-
bool isJSDouble()
216-
{
217-
return isJSFormat(DataFormatJSDouble);
218-
}
219-
220-
bool isJSCell()
221-
{
222-
return isJSFormat(DataFormatJSCell);
223-
}
224-
225-
bool isJSBoolean()
226-
{
227-
return isJSFormat(DataFormatJSBoolean);
228-
}
229-
230201
bool isUnknownJS()
231202
{
232203
return spillFormat() == DataFormatNone
@@ -317,10 +288,6 @@ class GenerationInfo {
317288
{
318289
fillGPR(stream, gpr, DataFormatStrictInt52);
319290
}
320-
void fillBoolean(VariableEventStreamBuilder& stream, GPRReg gpr)
321-
{
322-
fillGPR(stream, gpr, DataFormatBoolean);
323-
}
324291
void fillDouble(VariableEventStreamBuilder& stream, FPRReg fpr)
325292
{
326293
ASSERT(fpr != InvalidFPRReg);

‎Source/JavaScriptCore/dfg/DFGNode.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,11 +1056,6 @@ struct Node {
10561056
return isConstant() && constant()->value().isBoolean();
10571057
}
10581058

1059-
bool asBoolean()
1060-
{
1061-
return constant()->value().asBoolean();
1062-
}
1063-
10641059
bool isUndefinedOrNullConstant()
10651060
{
10661061
return isConstant() && constant()->value().isUndefinedOrNull();

‎Source/JavaScriptCore/dfg/DFGOSREntry.cpp‎

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -313,31 +313,7 @@ void* prepareOSREntry(VM& vm, CallFrame* callFrame, CodeBlock* codeBlock, Byteco
313313
RELEASE_ASSERT(currentEntry.reg().isGPR());
314314
RegisterAtOffset* calleeSavesEntry = allCalleeSaves->find(currentEntry.reg());
315315

316-
if constexpr (CallerFrameAndPC::sizeInRegisters == 2)
317-
*(std::bit_cast<intptr_t*>(pivot - 1) - currentEntry.offsetAsIndex()) = record->calleeSaveRegistersBuffer[calleeSavesEntry->offsetAsIndex()];
318-
else {
319-
// We need to adjust 4-bytes on 32-bits, otherwise we will clobber some parts of
320-
// pivot[-1] when currentEntry.offsetAsIndex() returns -1. This region contains
321-
// CallerFrameAndPC and if it is cloberred, we will have a corrupted stack.
322-
// Also, we need to store callee-save registers swapped in pairs on scratch buffer,
323-
// otherwise they will be swapped when copied to call frame during OSR Entry code.
324-
// Here is how we would like to have the buffer configured:
325-
//
326-
// pivot[-4] = ArgumentCountIncludingThis
327-
// pivot[-3] = Callee
328-
// pivot[-2] = CodeBlock
329-
// pivot[-1] = CallerFrameAndReturnPC
330-
// pivot[0] = csr1/csr0
331-
// pivot[1] = csr3/csr2
332-
// ...
333-
ASSERT(sizeof(intptr_t) == 4);
334-
ASSERT(CallerFrameAndPC::sizeInRegisters == 1);
335-
ASSERT(currentEntry.offsetAsIndex() < 0);
336-
337-
int offsetAsIndex = currentEntry.offsetAsIndex();
338-
int properIndex = offsetAsIndex % 2 ? offsetAsIndex - 1 : offsetAsIndex + 1;
339-
*(std::bit_cast<intptr_t*>(pivot - 1) + 1 - properIndex) = record->calleeSaveRegistersBuffer[calleeSavesEntry->offsetAsIndex()];
340-
}
316+
*(std::bit_cast<intptr_t*>(pivot - 1) - currentEntry.offsetAsIndex()) = record->calleeSaveRegistersBuffer[calleeSavesEntry->offsetAsIndex()];
341317
}
342318
#endif
343319

‎Source/JavaScriptCore/dfg/DFGOSRExit.cpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,6 @@ void OSRExit::compileExit(CCallHelpers& jit, VM& vm, const OSRExit& exit, const
662662
case Int32DisplacedInJSStack:
663663
case CellDisplacedInJSStack:
664664
case DoubleDisplacedInJSStack:
665-
case UnboxedBooleanInGPR:
666665
case UnboxedInt32InGPR:
667666
case UnboxedCellInGPR:
668667
case UnboxedDoubleInFPR:

‎Source/JavaScriptCore/dfg/DFGSilentRegisterSavePlan.h‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ namespace JSC { namespace DFG {
3636

3737
enum SilentSpillAction {
3838
DoNothingForSpill,
39-
Store32Tag,
4039
Store32Payload,
4140
StorePtr,
4241
Store64,
@@ -48,28 +47,17 @@ enum SilentFillAction {
4847
SetInt32Constant,
4948
SetInt52Constant,
5049
SetStrictInt52Constant,
51-
SetBooleanConstant,
5250
SetCellConstant,
5351
SetTrustedJSConstant,
5452
SetJSConstant,
55-
SetJSConstantTag,
56-
SetJSConstantPayload,
57-
SetInt32Tag,
58-
SetCellTag,
59-
SetBooleanTag,
6053
SetDoubleConstant,
61-
Load32Tag,
6254
Load32Payload,
6355
Load32PayloadBoxInt,
64-
Load32PayloadConvertToInt52,
65-
Load32PayloadSignExtend,
6656
LoadPtr,
6757
Load64,
6858
Load64ShiftInt52Right,
6959
Load64ShiftInt52Left,
70-
LoadDouble,
71-
LoadDoubleBoxDouble,
72-
LoadJSUnboxDouble
60+
LoadDouble
7361
};
7462

7563
class SilentRegisterSavePlan {

‎Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp‎

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -770,17 +770,11 @@ SilentRegisterSavePlan SpeculativeJIT::silentSavePlanForGPR(VirtualRegister spil
770770

771771
if (registerFormat == DataFormatInt32) {
772772
ASSERT(info.gpr() == source);
773-
ASSERT(isJSInt32(info.registerFormat()));
774773
if (node->hasConstant()) {
775774
ASSERT(node->isInt32Constant());
776775
fillAction = SetInt32Constant;
777776
} else
778777
fillAction = Load32Payload;
779-
} else if (registerFormat == DataFormatBoolean) {
780-
RELEASE_ASSERT_NOT_REACHED();
781-
#if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)
782-
fillAction = DoNothingForFill;
783-
#endif
784778
} else if (registerFormat == DataFormatCell) {
785779
ASSERT(info.gpr() == source);
786780
if (node->hasConstant()) {
@@ -876,9 +870,6 @@ void SpeculativeJIT::silentSpillImpl(const SilentRegisterSavePlan& plan)
876870
switch (plan.spillAction()) {
877871
case DoNothingForSpill:
878872
break;
879-
case Store32Tag:
880-
store32(plan.gpr(), highWordFor(plan.node()->virtualRegister()));
881-
break;
882873
case Store32Payload:
883874
store32(plan.gpr(), lowWordFor(plan.node()->virtualRegister()));
884875
break;
@@ -911,9 +902,6 @@ void SpeculativeJIT::silentFillImpl(const SilentRegisterSavePlan& plan)
911902
case SetStrictInt52Constant:
912903
move(Imm64(plan.node()->asAnyInt()), plan.gpr());
913904
break;
914-
case SetBooleanConstant:
915-
move(TrustedImm32(plan.node()->asBoolean()), plan.gpr());
916-
break;
917905
case SetCellConstant:
918906
ASSERT(plan.node()->constant()->value().isCell());
919907
loadLinkableConstant(LinkableConstant(*this, plan.node()->constant()->value().asCell()), plan.gpr());
@@ -931,18 +919,6 @@ void SpeculativeJIT::silentFillImpl(const SilentRegisterSavePlan& plan)
931919
load32(lowWordFor(plan.node()->virtualRegister()), plan.gpr());
932920
or64(GPRInfo::numberTagRegister, plan.gpr());
933921
break;
934-
case Load32PayloadConvertToInt52:
935-
load32(lowWordFor(plan.node()->virtualRegister()), plan.gpr());
936-
signExtend32ToPtr(plan.gpr(), plan.gpr());
937-
lshift64(TrustedImm32(JSValue::int52ShiftAmount), plan.gpr());
938-
break;
939-
case Load32PayloadSignExtend:
940-
load32(lowWordFor(plan.node()->virtualRegister()), plan.gpr());
941-
signExtend32ToPtr(plan.gpr(), plan.gpr());
942-
break;
943-
case Load32Tag:
944-
load32(highWordFor(plan.node()->virtualRegister()), plan.gpr());
945-
break;
946922
case Load32Payload:
947923
load32(lowWordFor(plan.node()->virtualRegister()), plan.gpr());
948924
break;
@@ -2758,7 +2734,6 @@ GeneratedOperandType SpeculativeJIT::checkGeneratedTypeForToInt32(Node* node)
27582734
case DataFormatStorage:
27592735
RELEASE_ASSERT_NOT_REACHED();
27602736

2761-
case DataFormatBoolean:
27622737
case DataFormatCell:
27632738
terminateSpeculativeExecution(Uncountable, JSValueRegs(), nullptr);
27642739
return GeneratedOperandTypeUnknown;
@@ -16539,7 +16514,7 @@ void SpeculativeJIT::compileExtractFromTuple(Node* node)
1653916514
ASSERT(info.isFormat(DataFormatInt32) || info.isFormat(DataFormatJSInt32));
1654016515
break;
1654116516
case NodeResultBoolean:
16542-
ASSERT(info.isFormat(DataFormatBoolean) || info.isFormat(DataFormatJSBoolean));
16517+
ASSERT(info.isFormat(DataFormatJSBoolean));
1654316518
break;
1654416519
case NodeResultStorage:
1654516520
ASSERT(info.isFormat(DataFormatStorage));

0 commit comments

Comments
 (0)