소스 검색

[MERGE #399] Invalidate proto caches in the correct script context

Merge pull request #399 from rajatd:crossContextProtoCacheInvalidation
If the prototype of an object is changed in a different context, we need to invalidate proto inline caches in the script context of the old prototype. We were only invalidating the caches in the current context, but the prototype being changed could have had property loads from it cached in a different context.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/microsoft/chakracore/399)
<!-- Reviewable:end -->
Rajat Dua 10 년 전
부모
커밋
40b249b0a2
1개의 변경된 파일2개의 추가작업 그리고 10개의 파일을 삭제
  1. 2 10
      lib/Runtime/Base/CrossSiteObject.h

+ 2 - 10
lib/Runtime/Base/CrossSiteObject.h

@@ -223,21 +223,13 @@ namespace Js
     template <typename T>
     void CrossSiteObject<T>::RemoveFromPrototype(ScriptContext * requestContext)
     {
-        if (GetScriptContext() == requestContext)
-        {
-            __super::RemoveFromPrototype(requestContext);
-        }
-        // else do nothing because we never cache cross-context
+        __super::RemoveFromPrototype(GetScriptContext());
     }
 
     template <typename T>
     void CrossSiteObject<T>::AddToPrototype(ScriptContext * requestContext)
     {
-        if (GetScriptContext() == requestContext)
-        {
-            __super::AddToPrototype(requestContext);
-        }
-        // else do nothing because we never cache cross-context
+        __super::AddToPrototype(GetScriptContext());
     }
 
     template <typename T>