瀏覽代碼

[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>