Skip to content

Commit ab0f8c4

Browse files
committed
The ScriptEngine::Clone method was used to support an old host technology, HTC.
All of the code supporting this can be removed. Code coverage pointed out this unused code.
1 parent 50767f9 commit ab0f8c4

11 files changed

Lines changed: 1 addition & 561 deletions

lib/Runtime/Base/FunctionBody.cpp

Lines changed: 0 additions & 457 deletions
Large diffs are not rendered by default.

lib/Runtime/Base/FunctionBody.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,9 +1490,6 @@ namespace Js
14901490
{
14911491
this->m_boundPropertyRecords = nullptr;
14921492
}
1493-
virtual ParseableFunctionInfo* Clone(ScriptContext *scriptContext, uint sourceIndex = Js::Constants::InvalidSourceIndex);
1494-
ParseableFunctionInfo* CopyFunctionInfoInto(ScriptContext *scriptContext, Js::ParseableFunctionInfo* functionInfo, uint sourceIndex = Js::Constants::InvalidSourceIndex);
1495-
void CloneSourceInfo(ScriptContext* scriptContext, const ParseableFunctionInfo& other, ScriptContext* othersScriptContext, uint sourceIndex);
14961493

14971494
void SetInitialDefaultEntryPoint();
14981495
void SetDeferredParsingEntryPoint();
@@ -2806,7 +2803,6 @@ namespace Js
28062803
Var GetConstantVar(RegSlot location);
28072804
Js::Var* GetConstTable() const { return this->m_constTable; }
28082805
void SetConstTable(Js::Var* constTable) { this->m_constTable = constTable; }
2809-
void CloneConstantTable(FunctionBody *newFunc);
28102806

28112807
void MarkScript(ByteBlock * pblkByteCode, ByteBlock * pblkAuxiliaryData, ByteBlock* auxContextBlock,
28122808
uint byteCodeCount, uint byteCodeInLoopCount, uint byteCodeWithoutLDACount);
@@ -2819,8 +2815,6 @@ namespace Js
28192815
bool UninstallProbe(int offset);
28202816
bool ProbeAtOffset(int offset, OpCode* pOriginalOpcode);
28212817

2822-
ParseableFunctionInfo * Clone(ScriptContext *scriptContext, uint sourceIndex = Js::Constants::InvalidSourceIndex) override;
2823-
28242818
static bool ShouldShareInlineCaches() { return CONFIG_FLAG(ShareInlineCaches); }
28252819

28262820
uint GetInlineCacheCount() const { return GetCountField(CounterFields::InlineCacheCount); }
@@ -3423,8 +3417,6 @@ namespace Js
34233417

34243418
// Below function will not change any state, so it will not alter accumulated index and value
34253419
BOOL Seek(int index, StatementData & data);
3426-
3427-
SmallSpanSequence * Clone();
34283420
};
34293421
#pragma endregion
34303422

lib/Runtime/Base/ScriptContext.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,12 +1979,6 @@ if (!sourceList)
19791979
}
19801980

19811981

1982-
Utf8SourceInfo* ScriptContext::CloneSourceCrossContext(Utf8SourceInfo* crossContextSourceInfo, SRCINFO const* srcInfo)
1983-
{
1984-
return Utf8SourceInfo::CloneNoCopy(this, crossContextSourceInfo, srcInfo);
1985-
}
1986-
1987-
19881982
uint ScriptContext::SaveSourceNoCopy(Utf8SourceInfo* sourceInfo, int cchLength, bool isCesu8)
19891983
{
19901984
Assert(sourceInfo->GetScriptContext() == this);
@@ -5522,20 +5516,3 @@ void ScriptContext::RegisterPrototypeChainEnsuredToHaveOnlyWritableDataPropertie
55225516

55235517
} // End namespace Js
55245518

5525-
SRCINFO* SRCINFO::Clone(Js::ScriptContext* scriptContext) const
5526-
{
5527-
SRCINFO* srcInfo;
5528-
if (this->sourceContextInfo->dwHostSourceContext == Js::Constants::NoHostSourceContext &&
5529-
this->dlnHost == 0 && this->ulColumnHost == 0 && this->ulCharOffset == 0 &&
5530-
this->ichMinHost == 0 && this->ichLimHost == 0 && this->grfsi == 0)
5531-
{
5532-
srcInfo = const_cast<SRCINFO*>(scriptContext->GetModuleSrcInfo(this->moduleID));
5533-
}
5534-
else
5535-
{
5536-
SourceContextInfo* sourceContextInfo = this->sourceContextInfo->Clone(scriptContext);
5537-
srcInfo = SRCINFO::Copy(scriptContext->GetRecycler(), this);
5538-
srcInfo->sourceContextInfo = sourceContextInfo;
5539-
}
5540-
return srcInfo;
5541-
}

lib/Runtime/Base/ScriptContext.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ class SRCINFO
5757
SRCINFO* copySrcInfo = RecyclerNew(recycler, SRCINFO, *srcInfo);
5858
return copySrcInfo;
5959
}
60-
61-
SRCINFO* Clone(Js::ScriptContext* scriptContext) const;
6260
};
6361

6462
struct CustomExternalObjectOperations
@@ -1314,7 +1312,6 @@ namespace Js
13141312
bool SaveSourceCopy(Utf8SourceInfo* const sourceInfo, int cchLength, bool isCesu8, uint * index);
13151313

13161314
uint SaveSourceNoCopy(Utf8SourceInfo* sourceInfo, int cchLength, bool isCesu8);
1317-
Utf8SourceInfo* CloneSourceCrossContext(Utf8SourceInfo* crossContextSourceInfo, SRCINFO const* srcInfo = nullptr);
13181315

13191316
void CloneSources(ScriptContext* sourceContext);
13201317
Utf8SourceInfo* GetSource(uint sourceIndex);

lib/Runtime/Base/Utf8SourceInfo.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -215,24 +215,6 @@ namespace Js
215215
return newSourceInfo;
216216
}
217217

218-
Utf8SourceInfo*
219-
Utf8SourceInfo::CloneNoCopy(ScriptContext* scriptContext, const Utf8SourceInfo* sourceInfo, SRCINFO const* srcInfo)
220-
{
221-
Utf8SourceInfo* newSourceInfo = Utf8SourceInfo::NewWithHolder(scriptContext, sourceInfo->GetSourceHolder(), sourceInfo->m_cchLength,
222-
srcInfo ? srcInfo : sourceInfo->GetSrcInfo(), sourceInfo->m_isLibraryCode);
223-
newSourceInfo->m_isXDomain = sourceInfo->m_isXDomain;
224-
newSourceInfo->m_isXDomainString = sourceInfo->m_isXDomainString;
225-
newSourceInfo->m_isLibraryCode = sourceInfo->m_isLibraryCode;
226-
newSourceInfo->SetIsCesu8(sourceInfo->GetIsCesu8());
227-
if (sourceInfo->m_hasHostBuffer)
228-
{
229-
// Keep the host buffer alive via the original source info
230-
newSourceInfo->m_pOriginalSourceInfo = sourceInfo;
231-
}
232-
newSourceInfo->EnsureInitialized(sourceInfo->GetFunctionBodyCount());
233-
return newSourceInfo;
234-
}
235-
236218
HRESULT Utf8SourceInfo::EnsureLineOffsetCacheNoThrow()
237219
{
238220
HRESULT hr = S_OK;

lib/Runtime/Base/Utf8SourceInfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ namespace Js
275275
static Utf8SourceInfo* New(ScriptContext* scriptContext, LPCUTF8 utf8String, int32 length, size_t numBytes, SRCINFO const* srcInfo, bool isLibraryCode);
276276
static Utf8SourceInfo* NewWithNoCopy(ScriptContext* scriptContext, LPCUTF8 utf8String, int32 length, size_t numBytes, SRCINFO const* srcInfo, bool isLibraryCode);
277277
static Utf8SourceInfo* Clone(ScriptContext* scriptContext, const Utf8SourceInfo* sourceinfo);
278-
static Utf8SourceInfo* CloneNoCopy(ScriptContext* scriptContext, const Utf8SourceInfo* sourceinfo, SRCINFO const * srcInfo);
279278

280279
ScriptContext * GetScriptContext() const
281280
{

lib/Runtime/ByteCode/ByteBlock.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ namespace Js
7373
return newBlock;
7474
}
7575

76-
ByteBlock * ByteBlock::Clone(Recycler* alloc)
77-
{
78-
return ByteBlock::New(alloc, this->m_content, this->m_contentSize);
79-
}
80-
8176
ByteBlock *ByteBlock::New(Recycler *alloc, const byte * initialContent, int initialContentSize, ScriptContext * requestContext)
8277
{
8378
// initialContent may be 'null' if no data to copy
@@ -120,13 +115,4 @@ namespace Js
120115

121116
return newBlock;
122117
}
123-
124-
//
125-
// Create a copy of buffer
126-
// Each Var is cloned on the requestContext
127-
//
128-
ByteBlock * ByteBlock::Clone(Recycler* alloc, ScriptContext * requestContext)
129-
{
130-
return ByteBlock::New(alloc, this->m_content, this->m_contentSize, requestContext);
131-
}
132118
}

lib/Runtime/ByteCode/ByteBlock.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,5 @@ namespace Js
4848
const byte* GetBuffer() const;
4949
const byte operator[](uint itemIndex) const;
5050
byte& operator[] (uint itemIndex);
51-
52-
ByteBlock * Clone(Recycler* alloc);
53-
54-
//
55-
// Create a copy of buffer
56-
// Each Var is cloned on the requestContext
57-
//
58-
ByteBlock * Clone(Recycler* alloc, ScriptContext * requestContext);
5951
};
6052
} // namespace Js

lib/Runtime/ByteCode/ByteCodeDumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ namespace Js
220220
Output::Print(_u(" (\"%s\")"), dumpFunction->GetScriptContext()->GetLibrary()->GetStringTemplateCallsiteObjectKey(varConst));
221221
break;
222222
default:
223-
AssertMsg(UNREACHED, "Unexpected object type in CloneConstantTable");
223+
AssertMsg(UNREACHED, "Unexpected object type in DumpConstantTable");
224224
break;
225225
}
226226
}

lib/Runtime/ByteCode/ScopeInfo.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -80,33 +80,6 @@ namespace Js
8080
return scopeInfo;
8181
}
8282

83-
//
84-
// Clone a ScopeInfo object
85-
//
86-
ScopeInfo *ScopeInfo::CloneFor(ParseableFunctionInfo *body)
87-
{
88-
auto count = this->symbolCount;
89-
auto symbolsSize = count * sizeof(SymbolInfo);
90-
auto scopeInfo = RecyclerNewPlusZ(parent->GetScriptContext()->GetRecycler(), symbolsSize,
91-
ScopeInfo, parent, count);
92-
scopeInfo->isDynamic = this->isDynamic;
93-
scopeInfo->isObject = this->isObject;
94-
scopeInfo->mustInstantiate = this->mustInstantiate;
95-
scopeInfo->isCached = this->isCached;
96-
scopeInfo->isGlobalEval = this->isGlobalEval;
97-
if (funcExprScopeInfo)
98-
{
99-
scopeInfo->funcExprScopeInfo = funcExprScopeInfo->CloneFor(body);
100-
}
101-
if (paramScopeInfo)
102-
{
103-
scopeInfo->paramScopeInfo = paramScopeInfo->CloneFor(body);
104-
}
105-
memcpy_s(scopeInfo->symbols, symbolsSize, this->symbols, symbolsSize);
106-
107-
return scopeInfo;
108-
}
109-
11083
//
11184
// Ensure the pids referenced by this scope are tracked.
11285
//

0 commit comments

Comments
 (0)