Skip to content

Commit 3c2ce7f

Browse files
committed
[MERGE #6215 @pleath] Refactor byte code emission for BrOnNoProperty family of cases
Merge pull request #6215 from pleath:brpropnoimplicit Preparatory to coming changes making it easier for the JIT to renumber temp lifetimes effectively, do the following: - Separate "with" cases from other kinds of cases involving dynamic scopes; - Eliminate bail-on-implicit-call checks from the non-with cases - Eliminate the IsES6UnscopablesSupported switch, which has never had any real testing utility and has long stopped representing a shippable state of the engine
2 parents 1edc963 + d198650 commit 3c2ce7f

18 files changed

+1414
-1459
lines changed

lib/Backend/FlowGraph.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ FlowGraph::RunPeeps()
825825
case Js::OpCode::BrSrNeq_A:
826826
case Js::OpCode::BrOnHasProperty:
827827
case Js::OpCode::BrOnNoProperty:
828+
case Js::OpCode::BrOnNoLocalProperty:
828829
case Js::OpCode::BrHasSideEffects:
829830
case Js::OpCode::BrNotHasSideEffects:
830831
case Js::OpCode::BrFncEqApply:

lib/Backend/GlobOpt.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3393,6 +3393,7 @@ GlobOpt::OptSrc(IR::Opnd *opnd, IR::Instr * *pInstr, Value **indirIndexValRef, I
33933393
case Js::OpCode::ScopedDeleteFldStrict:
33943394
case Js::OpCode::LdMethodFromFlags:
33953395
case Js::OpCode::BrOnNoProperty:
3396+
case Js::OpCode::BrOnNoLocalProperty:
33963397
case Js::OpCode::BrOnHasProperty:
33973398
case Js::OpCode::LdMethodFldPolyInlineMiss:
33983399
case Js::OpCode::StSlotChkUndecl:

lib/Backend/IRBuilder.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7292,17 +7292,7 @@ void
72927292
IRBuilder::BuildBrLocalProperty(Js::OpCode newOpcode, uint32 offset)
72937293
{
72947294
Assert(!OpCodeAttr::HasMultiSizeLayout(newOpcode));
7295-
7296-
switch (newOpcode)
7297-
{
7298-
case Js::OpCode::BrOnNoLocalProperty:
7299-
newOpcode = Js::OpCode::BrOnNoProperty;
7300-
break;
7301-
7302-
default:
7303-
Assert(0);
7304-
break;
7305-
}
7295+
Assert(newOpcode == Js::OpCode::BrOnNoLocalProperty);
73067296

73077297
const unaligned Js::OpLayoutBrLocalProperty *branchInsn = m_jnReader.BrLocalProperty();
73087298

@@ -7346,7 +7336,7 @@ IRBuilder::BuildBrEnvProperty(Js::OpCode newOpcode, uint32 offset)
73467336
fieldSym = PropertySym::New(regOpnd->m_sym, propertyId, branchInsn->PropertyIdIndex, (uint)-1, PropertyKindData, m_func);
73477337
fieldOpnd = IR::SymOpnd::New(fieldSym, TyVar, m_func);
73487338

7349-
branchInstr = IR::BranchInstr::New(Js::OpCode::BrOnNoProperty, nullptr, fieldOpnd, m_func);
7339+
branchInstr = IR::BranchInstr::New(newOpcode == Js::OpCode::BrOnNoEnvProperty ? Js::OpCode::BrOnNoProperty : Js::OpCode::BrOnNoLocalProperty, nullptr, fieldOpnd, m_func);
73507340
this->AddBranchInstr(branchInstr, offset, targetOffset);
73517341
}
73527342

lib/Backend/Lower.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,6 +2244,7 @@ Lowerer::LowerRange(IR::Instr *instrStart, IR::Instr *instrEnd, bool defaultDoFa
22442244

22452245
case Js::OpCode::BrOnHasProperty:
22462246
case Js::OpCode::BrOnNoProperty:
2247+
case Js::OpCode::BrOnNoLocalProperty:
22472248
this->LowerBrProperty(instr, IR::HelperOp_HasProperty);
22482249
break;
22492250

@@ -10782,6 +10783,7 @@ Lowerer::LowerBrProperty(IR::Instr * instr, IR::JnHelperMethod helper)
1078210783
instr->m_opcode = Js::OpCode::BrTrue_A;
1078310784
break;
1078410785
case Js::OpCode::BrOnNoProperty:
10786+
case Js::OpCode::BrOnNoLocalProperty:
1078510787
instr->m_opcode = Js::OpCode::BrFalse_A;
1078610788
break;
1078710789
default:

lib/Runtime/Base/ThreadConfigFlagsList.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ FLAG_RELEASE(IsES6ToPrimitiveEnabled, ES6ToPrimitive)
3636
FLAG_RELEASE(IsES6ToLengthEnabled, ES6ToLength)
3737
FLAG_RELEASE(IsES6ToStringTagEnabled, ES6ToStringTag)
3838
FLAG_RELEASE(IsES6UnicodeExtensionsEnabled, ES6Unicode)
39-
FLAG_RELEASE(IsES6UnscopablesEnabled, ES6Unscopables)
4039
FLAG_RELEASE(IsES6RegExStickyEnabled, ES6RegExSticky)
4140
FLAG_RELEASE(IsES2018RegExDotAllEnabled, ES2018RegExDotAll)
4241
FLAG_RELEASE(IsES6RegExPrototypePropertiesEnabled, ES6RegExPrototypeProperties)

lib/Runtime/ByteCode/ByteCodeCacheReleaseFileVersion.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
//-------------------------------------------------------------------------------------------------------
55
// NOTE: If there is a merge conflict the correct fix is to make a new GUID.
66

7-
// {68DABE55-D14A-4439-B9D2-B76963387802}
8-
const GUID byteCodeCacheReleaseFileVersion =
9-
{ 0x68dabe55, 0xd14a, 0x4439, { 0xb9, 0xd2, 0xb7, 0x69, 0x63, 0x38, 0x78, 0x2 } };
7+
// {CA631EEC-2284-4F10-B25B-159819C4ECDB}
8+
const GUID byteCodeCacheReleaseFileVersion =
9+
{ 0xca631eec, 0x2284, 0x4f10, { 0xb2, 0x5b, 0x15, 0x98, 0x19, 0xc4, 0xec, 0xdb } };

lib/Runtime/ByteCode/ByteCodeEmitter.cpp

Lines changed: 178 additions & 212 deletions
Large diffs are not rendered by default.

lib/Runtime/ByteCode/OpCodes.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,9 @@ MACRO_WMS( BrSrEq_A, BrReg2, OpSideEffect|OpOpndH
161161
MACRO_WMS( BrSrNeq_A, BrReg2, OpSideEffect|OpOpndHasImplicitCall|OpTempNumberSources|OpTempObjectSources) // Branch if '!==' (not strict equals) (NOTE: May have DOM implicit calls)
162162
MACRO_EXTEND( BrOnHasProperty, BrProperty, OpSideEffect|OpOpndHasImplicitCall|OpTempNumberSources|OpTempObjectSources) // Branch if object has the given property (NOTE: May have DOM implicit calls)
163163
MACRO( BrOnNoProperty, BrProperty, OpSideEffect|OpOpndHasImplicitCall|OpTempNumberSources|OpTempObjectSources) // Branch if object does not have the given property (NOTE: May have DOM implicit calls)
164-
MACRO( BrOnNoLocalProperty,BrLocalProperty,OpSideEffect|OpOpndHasImplicitCall|OpTempNumberSources|OpTempObjectSources) // Branch if object does not have the given property (NOTE: May have DOM implicit calls)
165-
MACRO( BrOnNoEnvProperty, BrEnvProperty, OpSideEffect|OpOpndHasImplicitCall|OpTempNumberSources|OpTempObjectSources) // Branch if object does not have the given property (NOTE: May have DOM implicit calls)
164+
MACRO( BrOnNoLocalProperty,BrLocalProperty,OpSideEffect|OpTempNumberSources|OpTempObjectSources) // Branch if object does not have the given property (NOTE: May have DOM implicit calls)
165+
MACRO_EXTEND( BrOnNoEnvProperty, BrEnvProperty, OpSideEffect|OpOpndHasImplicitCall|OpTempNumberSources|OpTempObjectSources) // Branch if object does not have the given property (NOTE: May have DOM implicit calls)
166+
MACRO( BrOnNoLocalEnvProperty, BrEnvProperty, OpSideEffect|OpTempNumberSources|OpTempObjectSources) // Branch if object does not have the given property (NOTE: May have DOM implicit calls)
166167
MACRO_WMS( BrOnObject_A, BrReg1, OpSideEffect|OpTempNumberSources|OpTempObjectSources) // Branch if typeId is not primitive type (i.e. > TypeIds_LastJavascriptPrimitiveType)
167168
MACRO_WMS( BrNotNull_A, BrReg1, OpSideEffect|OpTempNumberSources|OpTempObjectSources) // Branch if not NULL
168169
MACRO_EXTEND_WMS( BrNotUndecl_A, BrReg1, OpSideEffect|OpTempNumberSources|OpTempObjectSources) // Branch if source reg is NEQ to Undecl

lib/Runtime/Language/InterpreterHandler.inl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ EXDEF2_WMS(BRB, BrNotUndecl_A, OP_BrNotUndecl_A
7272
EXDEF2 (BRPROP, BrOnHasProperty, OP_BrOnHasProperty)
7373
DEF2 (BRPROP, BrOnNoProperty, OP_BrOnNoProperty)
7474
DEF2 (BRLOCALPROP, BrOnNoLocalProperty, OP_BrOnNoProperty)
75-
DEF2 (BRENVPROP, BrOnNoEnvProperty, OP_BrOnNoEnvProperty)
75+
EXDEF2 (BRENVPROP, BrOnNoEnvProperty, OP_BrOnNoEnvProperty)
76+
DEF2 (BRENVPROP, BrOnNoLocalEnvProperty, OP_BrOnNoEnvProperty)
7677
DEF2_WMS(BRBS, BrFncNeqApply, JavascriptOperators::OP_BrFncNeqApply)
7778
//Not emitted for byte code, keep it here for completeness
7879
//DEF2_WMS(BRBS, BrFncEqApply, JavascriptOperators::OP_BrFncEqApply)

0 commit comments

Comments
 (0)