@@ -1005,21 +1005,14 @@ namespace Js
10051005 }
10061006 }
10071007
1008- ScriptContextPolymorphicInlineCache * ScriptContextPolymorphicInlineCache::New (uint16 size, ScriptContext* scriptContext )
1008+ ScriptContextPolymorphicInlineCache * ScriptContextPolymorphicInlineCache::New (uint16 size, JavascriptLibrary* javascriptLibrary )
10091009 {
1010+ ScriptContext * scriptContext = javascriptLibrary->GetScriptContext ();
10101011 InlineCache * inlineCaches = AllocatorNewArrayZ (InlineCacheAllocator, scriptContext->GetInlineCacheAllocator (), InlineCache, size);
10111012#ifdef POLY_INLINE_CACHE_SIZE_STATS
10121013 scriptContext->GetInlineCacheAllocator ()->LogPolyCacheAlloc (size * sizeof (InlineCache));
10131014#endif
1014- ScriptContextPolymorphicInlineCache * polymorphicInlineCache = RecyclerNewFinalizedLeaf (scriptContext->GetRecycler (), ScriptContextPolymorphicInlineCache, inlineCaches, size, scriptContext);
1015-
1016- polymorphicInlineCache->prev = nullptr ;
1017- polymorphicInlineCache->next = polymorphicInlineCache->scriptContext ->GetGlobalPICHead ();
1018- if (polymorphicInlineCache->next )
1019- {
1020- polymorphicInlineCache->next ->prev = polymorphicInlineCache;
1021- }
1022- polymorphicInlineCache->scriptContext ->SetGlobalPICHead (polymorphicInlineCache);
1015+ ScriptContextPolymorphicInlineCache * polymorphicInlineCache = RecyclerNewFinalized (scriptContext->GetRecycler (), ScriptContextPolymorphicInlineCache, inlineCaches, size, javascriptLibrary);
10231016
10241017 return polymorphicInlineCache;
10251018 }
@@ -1029,7 +1022,7 @@ namespace Js
10291022 if (size == 0 )
10301023 {
10311024 // Already finalized
1032- Assert (!inlineCaches && !prev && !next );
1025+ Assert (!inlineCaches);
10331026 return ;
10341027 }
10351028
@@ -1063,43 +1056,17 @@ namespace Js
10631056 unregisteredInlineCacheCount++;
10641057 }
10651058 }
1066-
1067- AllocatorDeleteArray (InlineCacheAllocator, this ->scriptContext ->GetInlineCacheAllocator (), size, inlineCaches);
1059+ AllocatorDeleteArray (InlineCacheAllocator, this ->javascriptLibrary ->scriptContext ->GetInlineCacheAllocator (), size, inlineCaches);
10681060#ifdef POLY_INLINE_CACHE_SIZE_STATS
1069- this ->scriptContext ->GetInlineCacheAllocator ()->LogPolyCacheFree (size * sizeof (InlineCache));
1061+ this ->javascriptLibrary -> scriptContext ->GetInlineCacheAllocator ()->LogPolyCacheFree (size * sizeof (InlineCache));
10701062#endif
10711063 }
10721064
1073- // Remove this PolymorphicInlineCache from the list
1074- if (this == this ->scriptContext ->GetGlobalPICHead ())
1075- {
1076- Assert (!prev);
1077- if (next)
1078- {
1079- Assert (next->prev == this );
1080- next->prev = nullptr ;
1081- }
1082- this ->scriptContext ->SetGlobalPICHead (next);
1083- }
1084- else
1085- {
1086- if (prev)
1087- {
1088- Assert (prev->next == this );
1089- prev->next = next;
1090- }
1091- if (next)
1092- {
1093- Assert (next->prev == this );
1094- next->prev = prev;
1095- }
1096- }
1097- prev = next = nullptr ;
10981065 inlineCaches = nullptr ;
10991066 size = 0 ;
11001067 if (unregisteredInlineCacheCount > 0 )
11011068 {
1102- this ->scriptContext ->GetThreadContext ()->NotifyInlineCacheBatchUnregistered (unregisteredInlineCacheCount);
1069+ this ->javascriptLibrary -> scriptContext ->GetThreadContext ()->NotifyInlineCacheBatchUnregistered (unregisteredInlineCacheCount);
11031070 }
11041071 }
11051072
@@ -1146,7 +1113,7 @@ namespace Js
11461113
11471114 ScriptContext* ScriptContextPolymorphicInlineCache::GetScriptContext () const
11481115 {
1149- return this ->scriptContext ;
1116+ return this ->javascriptLibrary -> scriptContext ;
11501117 }
11511118#endif
11521119
0 commit comments