Skip to content

Commit 827ebd5

Browse files
committed
move propertyStrings cache to recyler
1 parent ebb5998 commit 827ebd5

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

lib/Runtime/Base/ScriptContext.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ namespace Js
256256
memset(byteCodeHistogram, 0, sizeof(byteCodeHistogram));
257257
#endif
258258

259-
memset(propertyStrings, 0, sizeof(PropertyStringMap*)* 80);
259+
memset(this->Cache()->propertyStrings, 0, sizeof(PropertyStringMap*)* 80);
260260

261261
#if DBG || defined(RUNTIME_DATA_COLLECTION)
262262
this->allocId = threadContext->GetScriptContextCount();
@@ -801,12 +801,12 @@ namespace Js
801801
return NULL;
802802
}
803803
const uint i = PropertyStringMap::PStrMapIndex(ch1);
804-
if (propertyStrings[i] == NULL)
804+
if (this->Cache()->propertyStrings[i] == NULL)
805805
{
806806
return NULL;
807807
}
808808
const uint j = PropertyStringMap::PStrMapIndex(ch2);
809-
return propertyStrings[i]->strLen2[j];
809+
return this->Cache()->propertyStrings[i]->strLen2[j];
810810
}
811811

812812
void ScriptContext::FindPropertyRecord(JavascriptString *pstName, PropertyRecord const ** propertyRecord)
@@ -1550,8 +1550,8 @@ namespace Js
15501550

15511551
void ScriptContext::InitPropertyStringMap(int i)
15521552
{
1553-
propertyStrings[i] = AnewStruct(GeneralAllocator(), PropertyStringMap);
1554-
memset(propertyStrings[i]->strLen2, 0, sizeof(PropertyString*)* 80);
1553+
this->Cache()->propertyStrings[i] = RecyclerNewStruct(GetRecycler(), PropertyStringMap);
1554+
memset(this->Cache()->propertyStrings[i]->strLen2, 0, sizeof(PropertyString*)* 80);
15551555
}
15561556

15571557
void ScriptContext::TrackPid(const PropertyRecord* propertyRecord)
@@ -1597,17 +1597,18 @@ namespace Js
15971597
{
15981598
const char16* buf = propString->GetBuffer();
15991599
const uint i = PropertyStringMap::PStrMapIndex(buf[0]);
1600-
if (propertyStrings[i] == NULL)
1600+
PropertyStringMap* strMap = this->Cache()->propertyStrings[i];
1601+
if (strMap == NULL)
16011602
{
16021603
InitPropertyStringMap(i);
16031604
}
16041605
const uint j = PropertyStringMap::PStrMapIndex(buf[1]);
1605-
if (propertyStrings[i]->strLen2[j] == NULL && !isClosed)
1606+
if (strMap->strLen2[j] == NULL && !isClosed)
16061607
{
1607-
propertyStrings[i]->strLen2[j] = GetLibrary()->CreatePropertyString(propString);
1608+
strMap->strLen2[j] = GetLibrary()->CreatePropertyString(propString);
16081609
this->TrackPid(propString);
16091610
}
1610-
return propertyStrings[i]->strLen2[j];
1611+
return strMap->strLen2[j];
16111612
}
16121613

16131614
PropertyString* ScriptContext::CachePropertyString2(const PropertyRecord* propString)

lib/Runtime/Base/ScriptContext.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,6 @@ namespace Js
549549
void SetGlobalPICHead(ScriptContextPolymorphicInlineCache * cache) { this->Cache()->globalPICHead = cache; }
550550

551551
private:
552-
PropertyStringMap* propertyStrings[80];
553552

554553
JavascriptFunction* GenerateRootFunction(ParseNodePtr parseTree, uint sourceIndex, Parser* parser, uint32 grfscr, CompileScriptException * pse, const char16 *rootDisplayName);
555554

lib/Runtime/Library/JavascriptLibrary.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ namespace Js
5454

5555
struct Cache
5656
{
57+
Field(PropertyStringMap*) propertyStrings[80];
5758
Field(ScriptContextPolymorphicInlineCache *) globalPICHead;
5859
Field(JavascriptString *) lastNumberToStringRadix10String;
5960
Field(EnumeratedObjectCache) enumObjCache;

0 commit comments

Comments
 (0)