Skip to content

Commit 0e56d2d

Browse files
author
Irina Yatsenko
committed
[MERGE #5276 @irinayat-MS] Remove unused CloseSources and related methods
Merge pull request #5276 from irinayat-MS:unused_CloneSources
2 parents 297cafe + b729442 commit 0e56d2d

File tree

7 files changed

+0
-85
lines changed

7 files changed

+0
-85
lines changed

lib/Jsrt/JsrtSourceHolder.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,6 @@ namespace Js
103103
|| memcmp(this->GetSource(_u("Equal Comparison")), other->GetSource(_u("Equal Comparison")), this->GetByteLength(_u("Equal Comparison"))) == 0));
104104
}
105105

106-
virtual ISourceHolder* Clone(ScriptContext *scriptContext) override
107-
{
108-
return RecyclerNewFinalized(scriptContext->GetRecycler(), JsrtSourceHolder, this->scriptLoadCallback, this->scriptUnloadCallback, this->sourceContext);
109-
}
110-
111106
virtual hash_t GetHashCode() override
112107
{
113108
LPCUTF8 source = GetSource(_u("Hash Code Calculation"));

lib/Runtime/Base/ScriptContext.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,25 +2672,6 @@ namespace Js
26722672
}
26732673
#endif
26742674

2675-
bool ScriptContext::SaveSourceCopy(Utf8SourceInfo* const sourceInfo, int cchLength, bool isCesu8, uint * index)
2676-
{
2677-
HRESULT hr = S_OK;
2678-
BEGIN_TRANSLATE_OOM_TO_HRESULT
2679-
{
2680-
*index = this->SaveSourceCopy(sourceInfo, cchLength, isCesu8);
2681-
}
2682-
END_TRANSLATE_OOM_TO_HRESULT(hr);
2683-
return hr == S_OK;
2684-
}
2685-
2686-
uint ScriptContext::SaveSourceCopy(Utf8SourceInfo* sourceInfo, int cchLength, bool isCesu8)
2687-
{
2688-
Utf8SourceInfo* newSource = Utf8SourceInfo::Clone(this, sourceInfo);
2689-
2690-
return SaveSourceNoCopy(newSource, cchLength, isCesu8);
2691-
}
2692-
2693-
26942675
uint ScriptContext::SaveSourceNoCopy(Utf8SourceInfo* sourceInfo, int cchLength, bool isCesu8)
26952676
{
26962677
Assert(sourceInfo->GetScriptContext() == this);
@@ -2712,23 +2693,6 @@ namespace Js
27122693
}
27132694
}
27142695

2715-
void ScriptContext::CloneSources(ScriptContext* sourceContext)
2716-
{
2717-
sourceContext->sourceList->Map([=](int index, RecyclerWeakReference<Utf8SourceInfo>* sourceInfo)
2718-
{
2719-
Utf8SourceInfo* info = sourceInfo->Get();
2720-
if (info)
2721-
{
2722-
CloneSource(info);
2723-
}
2724-
});
2725-
}
2726-
2727-
uint ScriptContext::CloneSource(Utf8SourceInfo* info)
2728-
{
2729-
return this->SaveSourceCopy(info, info->GetCchLength(), info->GetIsCesu8());
2730-
}
2731-
27322696
Utf8SourceInfo* ScriptContext::GetSource(uint index)
27332697
{
27342698
Assert(this->sourceList->IsItemValid(index)); // This assert should be a subset of info != null- if info was null, in the last collect, we'd have invalidated the item

lib/Runtime/Base/ScriptContext.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,12 +1439,8 @@ namespace Js
14391439
BOOL IsNativeAddress(void * codeAddr);
14401440
#endif
14411441

1442-
uint SaveSourceCopy(Utf8SourceInfo* sourceInfo, int cchLength, bool isCesu8);
1443-
bool SaveSourceCopy(Utf8SourceInfo* const sourceInfo, int cchLength, bool isCesu8, uint * index);
1444-
14451442
uint SaveSourceNoCopy(Utf8SourceInfo* sourceInfo, int cchLength, bool isCesu8);
14461443

1447-
void CloneSources(ScriptContext* sourceContext);
14481444
Utf8SourceInfo* GetSource(uint sourceIndex);
14491445

14501446
uint SourceCount() const { return (uint)sourceList->Count(); }
@@ -1536,8 +1532,6 @@ namespace Js
15361532

15371533
void FreeFunctionEntryPoint(Js::JavascriptMethod codeAddress, Js::JavascriptMethod thunkAddress);
15381534

1539-
private:
1540-
uint CloneSource(Utf8SourceInfo* info);
15411535
public:
15421536
void RegisterProtoInlineCache(InlineCache *pCache, PropertyId propId);
15431537
void InvalidateProtoCaches(const PropertyId propertyId);

lib/Runtime/Base/SourceHolder.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,4 @@ namespace Js
88
{
99
LPCUTF8 const ISourceHolder::emptyString = (LPCUTF8)"\0";
1010
SimpleSourceHolder const ISourceHolder::emptySourceHolder(NO_WRITE_BARRIER_TAG(emptyString), 0, true);
11-
12-
ISourceHolder* SimpleSourceHolder::Clone(ScriptContext* scriptContext)
13-
{
14-
if(this == ISourceHolder::GetEmptySourceHolder())
15-
{
16-
return this;
17-
}
18-
19-
utf8char_t * newUtf8String = RecyclerNewArrayLeaf(scriptContext->GetRecycler(), utf8char_t, byteLength + 1);
20-
js_memcpy_s(newUtf8String, byteLength + 1, this->source, byteLength + 1);
21-
return RecyclerNew(scriptContext->GetRecycler(), SimpleSourceHolder, newUtf8String, byteLength);
22-
}
2311
}

lib/Runtime/Base/SourceHolder.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ namespace Js
2020

2121
virtual LPCUTF8 GetSource(const char16* reasonString) = 0;
2222
virtual size_t GetByteLength(const char16* reasonString) = 0;
23-
virtual ISourceHolder* Clone(ScriptContext* scriptContext) = 0;
2423
virtual bool Equals(ISourceHolder* other) = 0;
2524
virtual hash_t GetHashCode() = 0;
2625
virtual bool IsEmpty() = 0;
@@ -56,7 +55,6 @@ namespace Js
5655
}
5756

5857
virtual size_t GetByteLength(const char16* reasonString) override { return byteLength; }
59-
virtual ISourceHolder* Clone(ScriptContext* scriptContext) override;
6058

6159
virtual bool Equals(ISourceHolder* other) override
6260
{

lib/Runtime/Base/Utf8SourceInfo.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -254,29 +254,6 @@ namespace Js
254254
return NewWithHolder(scriptContext, sourceHolder, length, srcInfo, isLibraryCode, scriptSource);
255255
}
256256

257-
258-
Utf8SourceInfo*
259-
Utf8SourceInfo::Clone(ScriptContext* scriptContext, const Utf8SourceInfo* sourceInfo)
260-
{
261-
Utf8SourceInfo* newSourceInfo = Utf8SourceInfo::NewWithHolder(scriptContext,
262-
sourceInfo->GetSourceHolder()->Clone(scriptContext), sourceInfo->m_cchLength,
263-
SRCINFO::Copy(scriptContext->GetRecycler(), sourceInfo->GetSrcInfo()),
264-
sourceInfo->m_isLibraryCode);
265-
newSourceInfo->m_isXDomain = sourceInfo->m_isXDomain;
266-
newSourceInfo->m_isXDomainString = sourceInfo->m_isXDomainString;
267-
newSourceInfo->m_isLibraryCode = sourceInfo->m_isLibraryCode;
268-
newSourceInfo->SetIsCesu8(sourceInfo->GetIsCesu8());
269-
newSourceInfo->m_lineOffsetCache = sourceInfo->m_lineOffsetCache;
270-
271-
#ifdef ENABLE_SCRIPT_DEBUGGING
272-
if (scriptContext->IsScriptContextInDebugMode() && !newSourceInfo->GetIsLibraryCode())
273-
{
274-
newSourceInfo->SetInDebugMode(true);
275-
}
276-
#endif
277-
return newSourceInfo;
278-
}
279-
280257
HRESULT Utf8SourceInfo::EnsureLineOffsetCacheNoThrow()
281258
{
282259
HRESULT hr = S_OK;

lib/Runtime/Base/Utf8SourceInfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ namespace Js
299299
static Utf8SourceInfo* NewWithNoCopy(ScriptContext* scriptContext,
300300
LPCUTF8 utf8String, int32 length, size_t numBytes,
301301
SRCINFO const* srcInfo, bool isLibraryCode, Js::Var scriptSource = nullptr);
302-
static Utf8SourceInfo* Clone(ScriptContext* scriptContext, const Utf8SourceInfo* sourceinfo);
303302

304303
ScriptContext * GetScriptContext() const
305304
{

0 commit comments

Comments
 (0)