Skip to content

Commit 39d9b74

Browse files
committed
[JSC] Remove unused op_overrides_has_instance
https://bugs.webkit.org/show_bug.cgi?id=307074 rdar://169714796 Reviewed by Yijia Huang and Yusuke Suzuki. We don't emit this bytecode anymore as it's baked into op_instance_of now. The DFG node is still used in some cases by op_instance_of so that remains untouched. No new tests, removing unreachable code. Canonical link: https://commits.webkit.org/306883@main
1 parent 3f07307 commit 39d9b74

11 files changed

Lines changed: 0 additions & 106 deletions

File tree

‎Source/JavaScriptCore/bytecode/BytecodeList.rb‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,13 +1368,6 @@
13681368
bottomProfile: unsigned,
13691369
}
13701370

1371-
op :overrides_has_instance,
1372-
args: {
1373-
dst: VirtualRegister,
1374-
constructor: VirtualRegister,
1375-
hasInstanceValue: VirtualRegister,
1376-
}
1377-
13781371
op :typeof,
13791372
args: {
13801373
dst: VirtualRegister,

‎Source/JavaScriptCore/bytecode/BytecodeUseDef.cpp‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ void computeUsesForBytecodeIndexImpl(const JSInstruction* instruction, Checkpoin
233233
USES(OpHasPrivateName, base, property)
234234
USES(OpHasPrivateBrand, base, brand)
235235
USES(OpHasStructureWithFlags, operand)
236-
USES(OpOverridesHasInstance, constructor, hasInstanceValue)
237236
USES(OpAdd, lhs, rhs)
238237
USES(OpMul, lhs, rhs)
239238
USES(OpDiv, lhs, rhs)
@@ -515,7 +514,6 @@ void computeDefsForBytecodeIndexImpl(unsigned numVars, const JSInstruction* inst
515514
DEFS(OpGetByIdWithThis, dst)
516515
DEFS(OpGetByValWithThis, dst)
517516
DEFS(OpGetPrototypeOf, dst)
518-
DEFS(OpOverridesHasInstance, dst)
519517
DEFS(OpGetByVal, dst)
520518
DEFS(OpGetPrivateName, dst)
521519
DEFS(OpTypeof, dst)

‎Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2635,12 +2635,6 @@ std::optional<Variable> BytecodeGenerator::tryResolveVariable(ExpressionNode* ex
26352635
return std::nullopt;
26362636
}
26372637

2638-
RegisterID* BytecodeGenerator::emitOverridesHasInstance(RegisterID* dst, RegisterID* constructor, RegisterID* hasInstanceValue)
2639-
{
2640-
OpOverridesHasInstance::emit(this, dst, constructor, hasInstanceValue);
2641-
return dst;
2642-
}
2643-
26442638
// Indicates the least upper bound of resolve type based on local scope. The bytecode linker
26452639
// will start with this ResolveType and compute the least upper bound including intercepting scopes.
26462640
ResolveType BytecodeGenerator::resolveType()

‎Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,6 @@ namespace JSC {
776776
RegisterID* emitInc(RegisterID* srcDst);
777777
RegisterID* emitDec(RegisterID* srcDst);
778778

779-
RegisterID* emitOverridesHasInstance(RegisterID* dst, RegisterID* constructor, RegisterID* hasInstanceValue);
780779
RegisterID* emitInstanceof(RegisterID* dst, RegisterID* value, RegisterID* constructor, RegisterID* hasInstanceOrPrototype);
781780
RegisterID* emitTypeOf(RegisterID* dst, RegisterID* src);
782781
RegisterID* emitInByVal(RegisterID* dst, RegisterID* property, RegisterID* base);

‎Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7604,17 +7604,6 @@ void ByteCodeParser::parseBlock(unsigned limit)
76047604
NEXT_OPCODE(op_check_tdz);
76057605
}
76067606

7607-
case op_overrides_has_instance: {
7608-
auto bytecode = currentInstruction->as<OpOverridesHasInstance>();
7609-
JSFunction* defaultHasInstanceSymbolFunction = m_inlineStackTop->m_codeBlock->globalObjectFor(currentCodeOrigin())->functionProtoHasInstanceSymbolFunction();
7610-
7611-
Node* constructor = get(VirtualRegister(bytecode.m_constructor));
7612-
Node* hasInstanceValue = get(VirtualRegister(bytecode.m_hasInstanceValue));
7613-
7614-
set(VirtualRegister(bytecode.m_dst), addToGraph(OverridesHasInstance, OpInfo(m_graph.freeze(defaultHasInstanceSymbolFunction)), constructor, hasInstanceValue));
7615-
NEXT_OPCODE(op_overrides_has_instance);
7616-
}
7617-
76187607
case op_identity_with_profile: {
76197608
auto bytecode = currentInstruction->as<OpIdentityWithProfile>();
76207609
Node* srcDst = get(bytecode.m_srcDst);

‎Source/JavaScriptCore/jit/JIT.cpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ void JIT::privateCompileMainPass()
325325
DEFINE_OP(op_set_private_brand)
326326
DEFINE_OP(op_check_private_brand)
327327
DEFINE_OP(op_get_prototype_of)
328-
DEFINE_OP(op_overrides_has_instance)
329328
DEFINE_OP(op_instanceof)
330329
DEFINE_OP(op_is_empty)
331330
DEFINE_OP(op_typeof_is_undefined)

‎Source/JavaScriptCore/jit/JIT.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,6 @@ namespace JSC {
426426
void emit_op_has_private_name(const JSInstruction*);
427427
void emit_op_has_private_brand(const JSInstruction*);
428428
void emit_op_init_lazy_reg(const JSInstruction*);
429-
void emit_op_overrides_has_instance(const JSInstruction*);
430429
void emit_op_instanceof(const JSInstruction*);
431430
void emit_op_is_empty(const JSInstruction*);
432431
void emit_op_typeof_is_undefined(const JSInstruction*);

‎Source/JavaScriptCore/jit/JITOpcodes.cpp‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -112,30 +112,6 @@ void JIT::emitSlow_op_new_object(const JSInstruction* currentInstruction, Vector
112112
emitPutVirtualRegister(dst, returnValueJSR);
113113
}
114114

115-
116-
void JIT::emit_op_overrides_has_instance(const JSInstruction* currentInstruction)
117-
{
118-
auto bytecode = currentInstruction->as<OpOverridesHasInstance>();
119-
VirtualRegister dst = bytecode.m_dst;
120-
VirtualRegister constructor = bytecode.m_constructor;
121-
VirtualRegister hasInstanceValue = bytecode.m_hasInstanceValue;
122-
123-
emitGetVirtualRegisterPayload(hasInstanceValue, regT2);
124-
125-
// We don't jump if we know what Symbol.hasInstance would do.
126-
move(TrustedImm32(1), regT0);
127-
loadGlobalObject(regT1);
128-
Jump customHasInstanceValue = branchPtr(NotEqual, regT2, Address(regT1, JSGlobalObject::offsetOfFunctionProtoHasInstanceSymbolFunction()));
129-
// We know that constructor is an object from the way bytecode is emitted for instanceof expressions.
130-
emitGetVirtualRegisterPayload(constructor, regT2);
131-
// Check that constructor 'ImplementsDefaultHasInstance' i.e. the object is not a C-API user nor a bound function.
132-
test8(Zero, Address(regT2, JSCell::typeInfoFlagsOffset()), TrustedImm32(ImplementsDefaultHasInstance), regT0);
133-
customHasInstanceValue.link(this);
134-
135-
boxBoolean(regT0, jsRegT10);
136-
emitPutVirtualRegister(dst, jsRegT10);
137-
}
138-
139115
void JIT::emit_op_is_empty(const JSInstruction* currentInstruction)
140116
{
141117
auto bytecode = currentInstruction->as<OpIsEmpty>();

‎Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm‎

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,35 +1332,6 @@ llintOpWithReturn(op_bitnot, OpBitnot, macro (size, get, dispatch, return)
13321332
dispatch()
13331333
end)
13341334

1335-
llintOp(op_overrides_has_instance, OpOverridesHasInstance, macro (size, get, dispatch)
1336-
get(m_dst, t3)
1337-
storei BooleanTag, TagOffset[cfr, t3, 8]
1338-
1339-
# First check if hasInstanceValue is the one on Function.prototype[Symbol.hasInstance]
1340-
get(m_hasInstanceValue, t0)
1341-
loadConstantOrVariablePayload(size, t0, CellTag, t2, .opOverrideshasInstanceValueNotCell)
1342-
loadConstantOrVariable(size, t0, t1, t2)
1343-
bineq t1, CellTag, .opOverrideshasInstanceValueNotCell
1344-
1345-
# We don't need hasInstanceValue's tag register anymore.
1346-
loadp CodeBlock[cfr], t1
1347-
loadp CodeBlock::m_globalObject[t1], t1
1348-
loadp JSGlobalObject::m_functionProtoHasInstanceSymbolFunction[t1], t1
1349-
bineq t1, t2, .opOverrideshasInstanceValueNotDefault
1350-
1351-
# We know the constructor is a cell.
1352-
get(m_constructor, t0)
1353-
loadConstantOrVariablePayloadUnchecked(size, t0, t1)
1354-
tbz JSCell::m_flags[t1], ImplementsDefaultHasInstance, t0
1355-
storei t0, PayloadOffset[cfr, t3, 8]
1356-
dispatch()
1357-
1358-
.opOverrideshasInstanceValueNotCell:
1359-
.opOverrideshasInstanceValueNotDefault:
1360-
storei 1, PayloadOffset[cfr, t3, 8]
1361-
dispatch()
1362-
end)
1363-
13641335

13651336
llintOpWithReturn(op_is_empty, OpIsEmpty, macro (size, get, dispatch, return)
13661337
get(m_operand, t1)

‎Source/JavaScriptCore/llint/LowLevelInterpreter64.asm‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,29 +1441,6 @@ llintOpWithReturn(op_bitnot, OpBitnot, macro (size, get, dispatch, return)
14411441
end)
14421442

14431443

1444-
llintOp(op_overrides_has_instance, OpOverridesHasInstance, macro (size, get, dispatch)
1445-
get(m_dst, t3)
1446-
1447-
get(m_hasInstanceValue, t1)
1448-
loadConstantOrVariable(size, t1, t0)
1449-
loadp CodeBlock[cfr], t2
1450-
loadp CodeBlock::m_globalObject[t2], t2
1451-
loadp JSGlobalObject::m_functionProtoHasInstanceSymbolFunction[t2], t2
1452-
bqneq t0, t2, .opOverridesHasInstanceNotDefaultSymbol
1453-
1454-
get(m_constructor, t1)
1455-
loadConstantOrVariable(size, t1, t0)
1456-
tbz JSCell::m_flags[t0], ImplementsDefaultHasInstance, t1
1457-
orq ValueFalse, t1
1458-
storeq t1, [cfr, t3, 8]
1459-
dispatch()
1460-
1461-
.opOverridesHasInstanceNotDefaultSymbol:
1462-
storeq ValueTrue, [cfr, t3, 8]
1463-
dispatch()
1464-
end)
1465-
1466-
14671444
llintOpWithReturn(op_is_empty, OpIsEmpty, macro (size, get, dispatch, return)
14681445
get(m_operand, t1)
14691446
loadConstantOrVariable(size, t1, t0)

0 commit comments

Comments
 (0)