Skip to content

Commit 8a1584c

Browse files
committed
[1.11>master] [MERGE #6387 @pleath] Remove unneeded InitConst op from byte code
Merge pull request #6387 from pleath:noinitconst
2 parents 92dddd3 + 9298227 commit 8a1584c

15 files changed

+23181
-23214
lines changed

lib/Backend/GlobOpt.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4783,7 +4783,6 @@ GlobOpt::ValueNumberDst(IR::Instr **pInstr, Value *src1Val, Value *src2Val)
47834783
// fall-through
47844784

47854785
case Js::OpCode::BytecodeArgOutCapture:
4786-
case Js::OpCode::InitConst:
47874786
case Js::OpCode::LdAsmJsFunc:
47884787
case Js::OpCode::Ld_A:
47894788
case Js::OpCode::Ld_I4:

lib/Backend/IRBuilder.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,10 +1818,6 @@ IRBuilder::BuildReg2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot R0, Js::Re
18181818
this->AddInstr(instr, offset);
18191819
return;
18201820
}
1821-
case Js::OpCode::InitConst:
1822-
// Don't use InitConst in the JIT, as some dataflow tracking is missing, and we don't currently optimize for it.
1823-
newOpcode = Js::OpCode::Ld_A;
1824-
break;
18251821
}
18261822

18271823
IR::RegOpnd * dstOpnd = this->BuildDstOpnd(R0, TyVar, false, reuseLoc);

lib/Backend/Lower.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1782,7 +1782,6 @@ Lowerer::LowerRange(IR::Instr *instrStart, IR::Instr *instrEnd, bool defaultDoFa
17821782
}
17831783
//fallthrough
17841784
case Js::OpCode::Ld_A:
1785-
case Js::OpCode::InitConst:
17861785
if (instr->IsJitProfilingInstr() && instr->AsJitProfilingInstr()->isBeginSwitch) {
17871786
LowerProfiledBeginSwitch(instr->AsJitProfilingInstr());
17881787
break;

lib/Runtime/ByteCode/ByteCodeCacheReleaseFileVersion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
// NOTE: If there is a merge conflict the correct fix is to make a new GUID.
66
// This file was generated with tools\update_bytecode_version.ps1
77

8-
// {5C20FA9E-A347-4731-A0DE-148B4FA12B04}
8+
// {81AEEA4B-AE4E-40C0-848F-6DB7C5F49F55}
99
const GUID byteCodeCacheReleaseFileVersion =
10-
{ 0x5C20FA9E, 0xA347, 0x4731, { 0xA0, 0xDE, 0x14, 0x8B, 0x4F, 0xA1, 0x2B, 0x04 } };
10+
{ 0x81AEEA4B, 0xAE4E, 0x40C0, { 0x84, 0x8F, 0x6D, 0xB7, 0xC5, 0xF4, 0x9F, 0x55 } };

lib/Runtime/ByteCode/ByteCodeEmitter.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4889,15 +4889,6 @@ void ByteCodeGenerator::EmitPropStore(Js::RegSlot rhsLocation, Symbol *sym, Iden
48894889
this->UpdateDebuggerPropertyInitializationOffset(location, sym->GetPosition(), false);
48904890
}
48914891
}
4892-
else if (isConstDecl)
4893-
{
4894-
this->m_writer.Reg2(Js::OpCode::InitConst, sym->GetLocation(), rhsLocation);
4895-
4896-
if (this->ShouldTrackDebuggerMetadata())
4897-
{
4898-
this->UpdateDebuggerPropertyInitializationOffset(sym->GetLocation(), sym->GetPosition());
4899-
}
4900-
}
49014892
else
49024893
{
49034894
if (!isConstDecl && sym->GetDecl() && sym->GetDecl()->nop == knopConstDecl)
@@ -4910,7 +4901,7 @@ void ByteCodeGenerator::EmitPropStore(Js::RegSlot rhsLocation, Symbol *sym, Iden
49104901
{
49114902
this->m_writer.Reg2(Js::OpCode::Ld_A, sym->GetLocation(), rhsLocation);
49124903

4913-
if (this->ShouldTrackDebuggerMetadata() && isLetDecl)
4904+
if (this->ShouldTrackDebuggerMetadata() && (isLetDecl || isConstDecl))
49144905
{
49154906
this->UpdateDebuggerPropertyInitializationOffset(sym->GetLocation(), sym->GetPosition());
49164907
}

lib/Runtime/ByteCode/OpCodes.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ MACRO_EXTEND_WMS( InitUndeclLocalConstFld, ElementP, OpByteCodeOn
383383
MACRO_WMS_ROOT( InitUndeclRootConstFld, ElementRootU, OpSideEffect)
384384
MACRO_EXTEND_WMS( InitUndeclConsoleLetFld, ElementScopedU, OpSideEffect)
385385
MACRO_EXTEND_WMS( InitUndeclConsoleConstFld, ElementScopedU, OpSideEffect)
386-
MACRO_WMS( InitConst, Reg2, OpTempNumberTransfer|OpTempObjectTransfer|OpNonIntTransfer|OpCanCSE) // Create and initialize 'const' as property of global object
387386
MACRO_WMS( InitConstSlot, ElementSlot, None)
388387

389388
// Re-evaluate following 4 opcodes and InitInnerLetFld for obj type spec and inline cache lookup when we add sharing of types having properties with non-default
@@ -627,7 +626,7 @@ MACRO_WMS( NewStackScFunc, ElementSlotI1, OpSideEffect|OpByteC
627626
MACRO_EXTEND_WMS( NewInnerScFunc, ElementSlot, OpSideEffect) // Create new ScriptFunction instance
628627
MACRO_EXTEND_WMS( NewInnerScGenFunc, ElementSlot, OpSideEffect) // Create new JavascriptGeneratorFunction instance
629628
MACRO_EXTEND_WMS( NewInnerStackScFunc,ElementSlot, OpSideEffect|OpByteCodeOnly) // Create new ScriptFunction instance
630-
MACRO_EXTEND_WMS( NewScFuncHomeObj, ElementSlot, OpSideEffect) // Create new ScriptFunction instance that has home object
629+
MACRO_WMS( NewScFuncHomeObj, ElementSlot, OpSideEffect) // Create new ScriptFunction instance that has home object
631630
MACRO_EXTEND_WMS( NewScGenFuncHomeObj, ElementSlot, OpSideEffect) // Create new JavascriptGeneratorFunction instance that has home object
632631
MACRO_EXTEND_WMS( NewInnerScFuncHomeObj, ElementSlotI3, OpSideEffect) // Create new ScriptFunction instance that has home object
633632
MACRO_EXTEND_WMS( NewInnerScGenFuncHomeObj, ElementSlotI3, OpSideEffect) // Create new JavascriptGeneratorFunction instance that has home object

lib/Runtime/Language/InterpreterHandler.inl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ EXDEF2_WMS(A1toA1Mem, Typeof_ReuseLoc, JavascriptOperat
135135
DEF2_WMS(CMMem, CmSrEq_A, JavascriptOperators::StrictEqual)
136136
DEF2_WMS(CMMem, CmSrNeq_A, JavascriptOperators::NotStrictEqual)
137137
DEF2_WMS(FALLTHROUGH, BeginSwitch, /* Common case with Ld_A */)
138-
DEF2_WMS(FALLTHROUGH, InitConst, /* Common case with Ld_A */)
139138
DEF2_WMS(FALLTHROUGH, Ld_A_ReuseLoc, /* Common case with Ld_A */)
140139
DEF2_WMS(A1toA1_ALLOW_STACK, Ld_A, OP_Ld_A)
141140
DEF2_WMS(INNERtoA1, LdInnerScope, OP_Ld_A)
@@ -345,7 +344,7 @@ EXDEF2 (EMPTY, ChkNewCallFlag, OP_ChkNewCallFla
345344
EXDEF3_WMS(CUSTOM_L_Value, NewInnerStackScFunc, OP_NewInnerStackScFunc, ElementSlot)
346345
EXDEF2_WMS(GET_ELEM_SLOT_FB, NewInnerScFunc, ScriptFunction::OP_NewScFunc)
347346
EXDEF2_WMS(GET_ELEM_SLOT_FB, NewInnerScGenFunc, JavascriptGeneratorFunction::OP_NewScGenFunc)
348-
EXDEF2_WMS(GET_SLOT_FB_HMO, NewScFuncHomeObj, ScriptFunction::OP_NewScFuncHomeObj)
347+
DEF2_WMS(GET_SLOT_FB_HMO, NewScFuncHomeObj, ScriptFunction::OP_NewScFuncHomeObj)
349348
EXDEF2_WMS(GET_SLOT_FB_HMO, NewScGenFuncHomeObj, JavascriptGeneratorFunction::OP_NewScGenFuncHomeObj)
350349
EXDEF2_WMS(GET_ELEM_SLOT_FB_HMO, NewInnerScFuncHomeObj, ScriptFunction::OP_NewScFuncHomeObj)
351350
EXDEF2_WMS(GET_ELEM_SLOT_FB_HMO, NewInnerScGenFuncHomeObj, JavascriptGeneratorFunction::OP_NewScGenFuncHomeObj)

0 commit comments

Comments
 (0)