Skip to content

Commit 9298227

Browse files
committed
[MERGE #6387 @pleath] Remove unneeded InitConst op from byte code
Merge pull request #6387 from pleath:noinitconst
2 parents 428e047 + 7fd1128 commit 9298227

15 files changed

+21169
-21205
lines changed

lib/Backend/GlobOpt.cpp

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

47314731
case Js::OpCode::BytecodeArgOutCapture:
4732-
case Js::OpCode::InitConst:
47334732
case Js::OpCode::LdAsmJsFunc:
47344733
case Js::OpCode::Ld_A:
47354734
case Js::OpCode::Ld_I4:

lib/Backend/IRBuilder.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,10 +1906,6 @@ IRBuilder::BuildReg2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot R0, Js::Re
19061906
this->AddInstr(instr, offset);
19071907
return;
19081908
}
1909-
case Js::OpCode::InitConst:
1910-
// Don't use InitConst in the JIT, as some dataflow tracking is missing, and we don't currently optimize for it.
1911-
newOpcode = Js::OpCode::Ld_A;
1912-
break;
19131909
}
19141910

19151911
IR::RegOpnd * dstOpnd = this->BuildDstOpnd(R0);

lib/Backend/Lower.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,6 @@ Lowerer::LowerRange(IR::Instr *instrStart, IR::Instr *instrEnd, bool defaultDoFa
18021802
}
18031803
//fallthrough
18041804
case Js::OpCode::Ld_A:
1805-
case Js::OpCode::InitConst:
18061805
if (instr->IsJitProfilingInstr() && instr->AsJitProfilingInstr()->isBeginSwitch) {
18071806
LowerProfiledBeginSwitch(instr->AsJitProfilingInstr());
18081807
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-
// {81AEEA4B-AE4E-40C0-848F-6DB7C5F49F55}
8+
// {D4C23742-01B6-409A-9C31-1590C22DE5A4}
99
const GUID byteCodeCacheReleaseFileVersion =
10-
{ 0x81AEEA4B, 0xAE4E, 0x40C0, { 0x84, 0x8F, 0x6D, 0xB7, 0xC5, 0xF4, 0x9F, 0x55 } };
10+
{ 0xD4C23742, 0x01B6, 0x409A, { 0x9C, 0x31, 0x15, 0x90, 0xC2, 0x2D, 0xE5, 0xA4 } };

lib/Runtime/ByteCode/ByteCodeEmitter.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4805,15 +4805,6 @@ void ByteCodeGenerator::EmitPropStore(Js::RegSlot rhsLocation, Symbol *sym, Iden
48054805
this->UpdateDebuggerPropertyInitializationOffset(location, sym->GetPosition(), false);
48064806
}
48074807
}
4808-
else if (isConstDecl)
4809-
{
4810-
this->m_writer.Reg2(Js::OpCode::InitConst, sym->GetLocation(), rhsLocation);
4811-
4812-
if (this->ShouldTrackDebuggerMetadata())
4813-
{
4814-
this->UpdateDebuggerPropertyInitializationOffset(sym->GetLocation(), sym->GetPosition());
4815-
}
4816-
}
48174808
else
48184809
{
48194810
if (!isConstDecl && sym->GetDecl() && sym->GetDecl()->nop == knopConstDecl)
@@ -4826,7 +4817,7 @@ void ByteCodeGenerator::EmitPropStore(Js::RegSlot rhsLocation, Symbol *sym, Iden
48264817
{
48274818
this->m_writer.Reg2(Js::OpCode::Ld_A, sym->GetLocation(), rhsLocation);
48284819

4829-
if (this->ShouldTrackDebuggerMetadata() && isLetDecl)
4820+
if (this->ShouldTrackDebuggerMetadata() && (isLetDecl || isConstDecl))
48304821
{
48314822
this->UpdateDebuggerPropertyInitializationOffset(sym->GetLocation(), sym->GetPosition());
48324823
}

lib/Runtime/ByteCode/OpCodes.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ MACRO_EXTEND_WMS( InitUndeclLocalConstFld, ElementP, OpByteCodeOn
368368
MACRO_WMS_ROOT( InitUndeclRootConstFld, ElementRootU, OpSideEffect)
369369
MACRO_EXTEND_WMS( InitUndeclConsoleLetFld, ElementScopedU, OpSideEffect)
370370
MACRO_EXTEND_WMS( InitUndeclConsoleConstFld, ElementScopedU, OpSideEffect)
371-
MACRO_WMS( InitConst, Reg2, OpTempNumberTransfer|OpTempObjectTransfer|OpNonIntTransfer|OpCanCSE) // Create and initialize 'const' as property of global object
372371
MACRO_WMS( InitConstSlot, ElementSlot, None)
373372

374373
// 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
@@ -598,7 +597,7 @@ MACRO_WMS( NewStackScFunc, ElementSlotI1, OpSideEffect|OpByteC
598597
MACRO_EXTEND_WMS( NewInnerScFunc, ElementSlot, OpSideEffect) // Create new ScriptFunction instance
599598
MACRO_EXTEND_WMS( NewInnerScGenFunc, ElementSlot, OpSideEffect) // Create new JavascriptGeneratorFunction instance
600599
MACRO_EXTEND_WMS( NewInnerStackScFunc,ElementSlot, OpSideEffect|OpByteCodeOnly) // Create new ScriptFunction instance
601-
MACRO_EXTEND_WMS( NewScFuncHomeObj, ElementSlot, OpSideEffect) // Create new ScriptFunction instance that has home object
600+
MACRO_WMS( NewScFuncHomeObj, ElementSlot, OpSideEffect) // Create new ScriptFunction instance that has home object
602601
MACRO_EXTEND_WMS( NewScGenFuncHomeObj, ElementSlot, OpSideEffect) // Create new JavascriptGeneratorFunction instance that has home object
603602
MACRO_EXTEND_WMS( NewInnerScFuncHomeObj, ElementSlotI3, OpSideEffect) // Create new ScriptFunction instance that has home object
604603
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
@@ -132,7 +132,6 @@ EXDEF2_WMS(A1toA1Mem, NewUnscopablesWrapperObject,JavascriptOperat
132132
DEF2_WMS(CMMem, CmSrEq_A, JavascriptOperators::StrictEqual)
133133
DEF2_WMS(CMMem, CmSrNeq_A, JavascriptOperators::NotStrictEqual)
134134
DEF2_WMS(FALLTHROUGH, BeginSwitch, /* Common case with Ld_A */)
135-
DEF2_WMS(FALLTHROUGH, InitConst, /* Common case with Ld_A */)
136135
DEF2_WMS(A1toA1_ALLOW_STACK, Ld_A, OP_Ld_A)
137136
DEF2_WMS(INNERtoA1, LdInnerScope, OP_Ld_A)
138137
DEF2_WMS(XXtoA1, LdLocalObj, OP_LdLocalObj)
@@ -328,7 +327,7 @@ EXDEF2 (EMPTY, ChkNewCallFlag, OP_ChkNewCallFla
328327
EXDEF3_WMS(CUSTOM_L_Value, NewInnerStackScFunc, OP_NewInnerStackScFunc, ElementSlot)
329328
EXDEF2_WMS(GET_ELEM_SLOT_FB, NewInnerScFunc, ScriptFunction::OP_NewScFunc)
330329
EXDEF2_WMS(GET_ELEM_SLOT_FB, NewInnerScGenFunc, JavascriptGeneratorFunction::OP_NewScGenFunc)
331-
EXDEF2_WMS(GET_SLOT_FB_HMO, NewScFuncHomeObj, ScriptFunction::OP_NewScFuncHomeObj)
330+
DEF2_WMS(GET_SLOT_FB_HMO, NewScFuncHomeObj, ScriptFunction::OP_NewScFuncHomeObj)
332331
EXDEF2_WMS(GET_SLOT_FB_HMO, NewScGenFuncHomeObj, JavascriptGeneratorFunction::OP_NewScGenFuncHomeObj)
333332
EXDEF2_WMS(GET_ELEM_SLOT_FB_HMO, NewInnerScFuncHomeObj, ScriptFunction::OP_NewScFuncHomeObj)
334333
EXDEF2_WMS(GET_ELEM_SLOT_FB_HMO, NewInnerScGenFuncHomeObj, JavascriptGeneratorFunction::OP_NewScGenFuncHomeObj)

0 commit comments

Comments
 (0)