<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[197732] trunk/Source/JavaScriptCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/197732">197732</a></dd>
<dt>Author</dt> <dd>sbarati@apple.com</dd>
<dt>Date</dt> <dd>2016-03-07 23:16:21 -0800 (Mon, 07 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[ES6] Implement revocable proxies
https://bugs.webkit.org/show_bug.cgi?id=154321

Reviewed by Mark Lam.

This patch is a straight forward implementation of Proxy.revocable
with respect to section 26.2.2.1 of the ECMAScript spec.
https://tc39.github.io/ecma262/#sec-proxy.revocable

This patch also fixes a bug in Proxy where we
were incorrectly caching &quot;in&quot;, i.e, `&quot;x&quot; in proxy`.
We should never blatantly cache this because caching is observable
behavior by users of the language. We could come up with
a smarter caching scheme that caches only if the Proxy's
handler doesn't have a &quot;has&quot; property, i.e, we don't have
to call out to JS code. But for now, it's easiest to disable
caching.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::moduleRecordStructure):
(JSC::JSGlobalObject::moduleNamespaceObjectStructure):
(JSC::JSGlobalObject::proxyObjectStructure):
(JSC::JSGlobalObject::proxyRevokeStructure):
(JSC::JSGlobalObject::wasmModuleStructure):
* runtime/ProxyConstructor.cpp:
(JSC::ProxyConstructor::create):
(JSC::ProxyConstructor::ProxyConstructor):
(JSC::makeRevocableProxy):
(JSC::proxyRevocableConstructorThrowError):
(JSC::ProxyConstructor::finishCreation):
(JSC::constructProxyObject):
* runtime/ProxyConstructor.h:
(JSC::ProxyConstructor::createStructure):
* runtime/ProxyObject.cpp:
(JSC::ProxyObject::finishCreation):
(JSC::performProxyGet):
(JSC::ProxyObject::performInternalMethodGetOwnProperty):
(JSC::ProxyObject::performHasProperty):
(JSC::ProxyObject::performPut):
(JSC::performProxyCall):
(JSC::performProxyConstruct):
(JSC::ProxyObject::performDelete):
(JSC::ProxyObject::performPreventExtensions):
(JSC::ProxyObject::performIsExtensible):
(JSC::ProxyObject::performDefineOwnProperty):
(JSC::ProxyObject::performGetOwnPropertyNames):
(JSC::ProxyObject::performSetPrototype):
(JSC::ProxyObject::performGetPrototype):
(JSC::ProxyObject::getPrototype):
(JSC::ProxyObject::revoke):
(JSC::ProxyObject::visitChildren):
* runtime/ProxyObject.h:
(JSC::ProxyObject::create):
* runtime/ProxyRevoke.cpp: Added.
(JSC::ProxyRevoke::create):
(JSC::ProxyRevoke::ProxyRevoke):
(JSC::ProxyRevoke::finishCreation):
(JSC::performProxyRevoke):
(JSC::ProxyRevoke::getCallData):
(JSC::ProxyRevoke::visitChildren):
* runtime/ProxyRevoke.h: Added.
(JSC::ProxyRevoke::createStructure):
(JSC::ProxyRevoke::proxy):
(JSC::ProxyRevoke::setProxyToNull):
* tests/stress/proxy-has-property.js:
(assert):
(assert.let.handler.has):
(assert.let.foo):
* tests/stress/proxy-revoke.js: Added.
(assert):
(throw.new.Error.):
(throw.new.Error):
(callAllHandlers):
(shouldThrowNullHandler):
(allHandlersShouldThrow):
(i.let.trap.of.traps.trap.string_appeared_here.func):
(i.let.trap.of.traps.else.func):
(i.Proxy.revocable):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjecth">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeProxyConstructorcpp">trunk/Source/JavaScriptCore/runtime/ProxyConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeProxyConstructorh">trunk/Source/JavaScriptCore/runtime/ProxyConstructor.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeProxyObjectcpp">trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeProxyObjecth">trunk/Source/JavaScriptCore/runtime/ProxyObject.h</a></li>
<li><a href="#trunkSourceJavaScriptCoretestses6yaml">trunk/Source/JavaScriptCore/tests/es6.yaml</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressproxyhaspropertyjs">trunk/Source/JavaScriptCore/tests/stress/proxy-has-property.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreruntimeProxyRevokecpp">trunk/Source/JavaScriptCore/runtime/ProxyRevoke.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeProxyRevokeh">trunk/Source/JavaScriptCore/runtime/ProxyRevoke.h</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressproxyrevokejs">trunk/Source/JavaScriptCore/tests/stress/proxy-revoke.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (197731 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2016-03-08 07:09:23 UTC (rev 197731)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -764,6 +764,7 @@
</span><span class="cx">     runtime/PrototypeMap.cpp
</span><span class="cx">     runtime/ProxyConstructor.cpp
</span><span class="cx">     runtime/ProxyObject.cpp
</span><ins>+    runtime/ProxyRevoke.cpp
</ins><span class="cx">     runtime/ReflectObject.cpp
</span><span class="cx">     runtime/RegExp.cpp
</span><span class="cx">     runtime/RegExpCache.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (197731 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-03-08 07:09:23 UTC (rev 197731)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -1,3 +1,89 @@
</span><ins>+2016-03-07  Saam barati  &lt;sbarati@apple.com&gt;
+
+        [ES6] Implement revocable proxies
+        https://bugs.webkit.org/show_bug.cgi?id=154321
+
+        Reviewed by Mark Lam.
+
+        This patch is a straight forward implementation of Proxy.revocable
+        with respect to section 26.2.2.1 of the ECMAScript spec.
+        https://tc39.github.io/ecma262/#sec-proxy.revocable
+
+        This patch also fixes a bug in Proxy where we
+        were incorrectly caching &quot;in&quot;, i.e, `&quot;x&quot; in proxy`.
+        We should never blatantly cache this because caching is observable
+        behavior by users of the language. We could come up with
+        a smarter caching scheme that caches only if the Proxy's
+        handler doesn't have a &quot;has&quot; property, i.e, we don't have
+        to call out to JS code. But for now, it's easiest to disable
+        caching.
+
+        * CMakeLists.txt:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+        (JSC::JSGlobalObject::visitChildren):
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::moduleRecordStructure):
+        (JSC::JSGlobalObject::moduleNamespaceObjectStructure):
+        (JSC::JSGlobalObject::proxyObjectStructure):
+        (JSC::JSGlobalObject::proxyRevokeStructure):
+        (JSC::JSGlobalObject::wasmModuleStructure):
+        * runtime/ProxyConstructor.cpp:
+        (JSC::ProxyConstructor::create):
+        (JSC::ProxyConstructor::ProxyConstructor):
+        (JSC::makeRevocableProxy):
+        (JSC::proxyRevocableConstructorThrowError):
+        (JSC::ProxyConstructor::finishCreation):
+        (JSC::constructProxyObject):
+        * runtime/ProxyConstructor.h:
+        (JSC::ProxyConstructor::createStructure):
+        * runtime/ProxyObject.cpp:
+        (JSC::ProxyObject::finishCreation):
+        (JSC::performProxyGet):
+        (JSC::ProxyObject::performInternalMethodGetOwnProperty):
+        (JSC::ProxyObject::performHasProperty):
+        (JSC::ProxyObject::performPut):
+        (JSC::performProxyCall):
+        (JSC::performProxyConstruct):
+        (JSC::ProxyObject::performDelete):
+        (JSC::ProxyObject::performPreventExtensions):
+        (JSC::ProxyObject::performIsExtensible):
+        (JSC::ProxyObject::performDefineOwnProperty):
+        (JSC::ProxyObject::performGetOwnPropertyNames):
+        (JSC::ProxyObject::performSetPrototype):
+        (JSC::ProxyObject::performGetPrototype):
+        (JSC::ProxyObject::getPrototype):
+        (JSC::ProxyObject::revoke):
+        (JSC::ProxyObject::visitChildren):
+        * runtime/ProxyObject.h:
+        (JSC::ProxyObject::create):
+        * runtime/ProxyRevoke.cpp: Added.
+        (JSC::ProxyRevoke::create):
+        (JSC::ProxyRevoke::ProxyRevoke):
+        (JSC::ProxyRevoke::finishCreation):
+        (JSC::performProxyRevoke):
+        (JSC::ProxyRevoke::getCallData):
+        (JSC::ProxyRevoke::visitChildren):
+        * runtime/ProxyRevoke.h: Added.
+        (JSC::ProxyRevoke::createStructure):
+        (JSC::ProxyRevoke::proxy):
+        (JSC::ProxyRevoke::setProxyToNull):
+        * tests/stress/proxy-has-property.js:
+        (assert):
+        (assert.let.handler.has):
+        (assert.let.foo):
+        * tests/stress/proxy-revoke.js: Added.
+        (assert):
+        (throw.new.Error.):
+        (throw.new.Error):
+        (callAllHandlers):
+        (shouldThrowNullHandler):
+        (allHandlersShouldThrow):
+        (i.let.trap.of.traps.trap.string_appeared_here.func):
+        (i.let.trap.of.traps.else.func):
+        (i.Proxy.revocable):
+
</ins><span class="cx"> 2016-03-07  Csaba Osztrogonác  &lt;ossy@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the ARM build after r197687
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (197731 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-03-08 07:09:23 UTC (rev 197731)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -1269,6 +1269,8 @@
</span><span class="cx">                 70ECA6071AFDBEA200449739 /* TemplateRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70ECA6021AFDBEA200449739 /* TemplateRegistry.cpp */; };
</span><span class="cx">                 70ECA6081AFDBEA200449739 /* TemplateRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 70ECA6031AFDBEA200449739 /* TemplateRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 70ECA6091AFDBEA200449739 /* TemplateRegistryKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 70ECA6041AFDBEA200449739 /* TemplateRegistryKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                79160DBD1C8E3EC8008C085A /* ProxyRevoke.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 79160DBB1C8E3EC8008C085A /* ProxyRevoke.cpp */; };
+                79160DBE1C8E3EC8008C085A /* ProxyRevoke.h in Headers */ = {isa = PBXBuildFile; fileRef = 79160DBC1C8E3EC8008C085A /* ProxyRevoke.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 792CB3491C4EED5C00D13AF3 /* PCToCodeOriginMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 792CB3471C4EED5C00D13AF3 /* PCToCodeOriginMap.cpp */; };
</span><span class="cx">                 792CB34A1C4EED5C00D13AF3 /* PCToCodeOriginMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 792CB3481C4EED5C00D13AF3 /* PCToCodeOriginMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7964656A1B952FF0003059EE /* GetPutInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 796465681B952FF0003059EE /* GetPutInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -3428,6 +3430,8 @@
</span><span class="cx">                 70ECA6021AFDBEA200449739 /* TemplateRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TemplateRegistry.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 70ECA6031AFDBEA200449739 /* TemplateRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateRegistry.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 70ECA6041AFDBEA200449739 /* TemplateRegistryKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateRegistryKey.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                79160DBB1C8E3EC8008C085A /* ProxyRevoke.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProxyRevoke.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                79160DBC1C8E3EC8008C085A /* ProxyRevoke.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyRevoke.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 792CB3471C4EED5C00D13AF3 /* PCToCodeOriginMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PCToCodeOriginMap.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 792CB3481C4EED5C00D13AF3 /* PCToCodeOriginMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PCToCodeOriginMap.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 796465681B952FF0003059EE /* GetPutInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetPutInfo.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5855,6 +5859,8 @@
</span><span class="cx">                                 79B00CB91C6AB07E0088C65D /* ProxyConstructor.h */,
</span><span class="cx">                                 79B00CBA1C6AB07E0088C65D /* ProxyObject.cpp */,
</span><span class="cx">                                 79B00CBB1C6AB07E0088C65D /* ProxyObject.h */,
</span><ins>+                                79160DBB1C8E3EC8008C085A /* ProxyRevoke.cpp */,
+                                79160DBC1C8E3EC8008C085A /* ProxyRevoke.h */,
</ins><span class="cx">                                 0F5780A118FE1E98001E72D9 /* PureNaN.h */,
</span><span class="cx">                                 0F0CD4C015F1A6040032F1C0 /* PutDirectIndexMode.h */,
</span><span class="cx">                                 147B84620E6DE6B1004775A4 /* PutPropertySlot.h */,
</span><span class="lines">@@ -6902,6 +6908,7 @@
</span><span class="cx">                                 990DA67F1C8E316A00295159 /* generate_objc_protocol_type_conversions_implementation.py in Headers */,
</span><span class="cx">                                 799EF7C41C56ED96002B0534 /* B3PCToOriginMap.h in Headers */,
</span><span class="cx">                                 79B00CBF1C6AB07E0088C65D /* ProxyObject.h in Headers */,
</span><ins>+                                79160DBE1C8E3EC8008C085A /* ProxyRevoke.h in Headers */,
</ins><span class="cx">                                 792CB34A1C4EED5C00D13AF3 /* PCToCodeOriginMap.h in Headers */,
</span><span class="cx">                                 79CFC6F01C33B10000C768EA /* LLIntPCRanges.h in Headers */,
</span><span class="cx">                                 79D5CD5B1C1106A900CECA07 /* SamplingProfiler.h in Headers */,
</span><span class="lines">@@ -9162,6 +9169,7 @@
</span><span class="cx">                                 E355F3521B7DC85300C50DC5 /* ModuleLoaderObject.cpp in Sources */,
</span><span class="cx">                                 0F338E0B1BF0276C0013C88F /* B3Compilation.cpp in Sources */,
</span><span class="cx">                                 14469DE0107EC7E700650446 /* NativeErrorConstructor.cpp in Sources */,
</span><ins>+                                79160DBD1C8E3EC8008C085A /* ProxyRevoke.cpp in Sources */,
</ins><span class="cx">                                 14469DE1107EC7E700650446 /* NativeErrorPrototype.cpp in Sources */,
</span><span class="cx">                                 E33E8D201B9013DE00346B52 /* NativeStdFunctionCell.cpp in Sources */,
</span><span class="cx">                                 148F21B7107EC5470042EC2C /* Nodes.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (197731 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-03-08 07:09:23 UTC (rev 197731)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -130,6 +130,7 @@
</span><span class="cx"> #include &quot;ParserError.h&quot;
</span><span class="cx"> #include &quot;ProxyConstructor.h&quot;
</span><span class="cx"> #include &quot;ProxyObject.h&quot;
</span><ins>+#include &quot;ProxyRevoke.h&quot;
</ins><span class="cx"> #include &quot;ReflectObject.h&quot;
</span><span class="cx"> #include &quot;RegExpConstructor.h&quot;
</span><span class="cx"> #include &quot;RegExpMatchesArray.h&quot;
</span><span class="lines">@@ -370,6 +371,7 @@
</span><span class="cx">     m_moduleRecordStructure.set(vm, this, JSModuleRecord::createStructure(vm, this, m_objectPrototype.get()));
</span><span class="cx">     m_moduleNamespaceObjectStructure.set(vm, this, JSModuleNamespaceObject::createStructure(vm, this, jsNull()));
</span><span class="cx">     m_proxyObjectStructure.set(vm, this, ProxyObject::createStructure(vm, this, m_objectPrototype.get()));
</span><ins>+    m_proxyRevokeStructure.set(vm, this, ProxyRevoke::createStructure(vm, this, m_functionPrototype.get()));
</ins><span class="cx">     
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx">     m_wasmModuleStructure.set(vm, this, JSWASMModule::createStructure(vm, this));
</span><span class="lines">@@ -911,6 +913,7 @@
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_dollarVMStructure);
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_internalFunctionStructure);
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_proxyObjectStructure);
</span><ins>+    visitor.append(&amp;thisObject-&gt;m_proxyRevokeStructure);
</ins><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_wasmModuleStructure);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h (197731 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2016-03-08 07:09:23 UTC (rev 197731)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -282,6 +282,7 @@
</span><span class="cx">     WriteBarrier&lt;Structure&gt; m_moduleRecordStructure;
</span><span class="cx">     WriteBarrier&lt;Structure&gt; m_moduleNamespaceObjectStructure;
</span><span class="cx">     WriteBarrier&lt;Structure&gt; m_proxyObjectStructure;
</span><ins>+    WriteBarrier&lt;Structure&gt; m_proxyRevokeStructure;
</ins><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx">     WriteBarrier&lt;Structure&gt; m_wasmModuleStructure;
</span><span class="cx"> #endif
</span><span class="lines">@@ -535,6 +536,7 @@
</span><span class="cx">     Structure* moduleRecordStructure() const { return m_moduleRecordStructure.get(); }
</span><span class="cx">     Structure* moduleNamespaceObjectStructure() const { return m_moduleNamespaceObjectStructure.get(); }
</span><span class="cx">     Structure* proxyObjectStructure() const { return m_proxyObjectStructure.get(); }
</span><ins>+    Structure* proxyRevokeStructure() const { return m_proxyRevokeStructure.get(); }
</ins><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx">     Structure* wasmModuleStructure() const { return m_wasmModuleStructure.get(); }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeProxyConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ProxyConstructor.cpp (197731 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ProxyConstructor.cpp        2016-03-08 07:09:23 UTC (rev 197731)
+++ trunk/Source/JavaScriptCore/runtime/ProxyConstructor.cpp        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -27,10 +27,13 @@
</span><span class="cx"> #include &quot;ProxyConstructor.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Error.h&quot;
</span><ins>+#include &quot;IdentifierInlines.h&quot;
</ins><span class="cx"> #include &quot;JSCJSValueInlines.h&quot;
</span><span class="cx"> #include &quot;JSCellInlines.h&quot;
</span><ins>+#include &quot;ObjectConstructor.h&quot;
</ins><span class="cx"> #include &quot;ObjectPrototype.h&quot;
</span><span class="cx"> #include &quot;ProxyObject.h&quot;
</span><ins>+#include &quot;ProxyRevoke.h&quot;
</ins><span class="cx"> #include &quot;StructureInlines.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="lines">@@ -42,7 +45,7 @@
</span><span class="cx"> ProxyConstructor* ProxyConstructor::create(VM&amp; vm, Structure* structure)
</span><span class="cx"> {
</span><span class="cx">     ProxyConstructor* constructor = new (NotNull, allocateCell&lt;ProxyConstructor&gt;(vm.heap)) ProxyConstructor(vm, structure);
</span><del>-    constructor-&gt;finishCreation(vm, &quot;Proxy&quot;);
</del><ins>+    constructor-&gt;finishCreation(vm, &quot;Proxy&quot;, structure-&gt;globalObject());
</ins><span class="cx">     return constructor;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -51,11 +54,42 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ProxyConstructor::finishCreation(VM&amp; vm, const char* name)
</del><ins>+static EncodedJSValue JSC_HOST_CALL makeRevocableProxy(ExecState* exec)
</ins><span class="cx"> {
</span><ins>+    if (exec-&gt;argumentCount() &lt; 2)
+        return throwVMTypeError(exec, ASCIILiteral(&quot;Proxy.revocable needs to be called with two arguments: the target and the handler.&quot;));
+
+    VM&amp; vm = exec-&gt;vm();
+    ArgList args(exec);
+    JSValue target = args.at(0);
+    JSValue handler = args.at(1);
+    ProxyObject* proxy = ProxyObject::create(exec, exec-&gt;lexicalGlobalObject()-&gt;proxyObjectStructure(), target, handler);
+    if (vm.exception())
+        return JSValue::encode(JSValue());
+    ProxyRevoke* revoke = ProxyRevoke::create(vm, exec-&gt;lexicalGlobalObject()-&gt;proxyRevokeStructure(), proxy);
+    if (vm.exception())
+        return JSValue::encode(JSValue());
+
+    JSObject* result = constructEmptyObject(exec);
+    if (vm.exception())
+        return JSValue::encode(JSValue());
+    result-&gt;putDirect(vm, makeIdentifier(vm, &quot;proxy&quot;), proxy, None);
+    result-&gt;putDirect(vm, makeIdentifier(vm, &quot;revoke&quot;), revoke, None);
+
+    return JSValue::encode(result);
+}
+
+static EncodedJSValue JSC_HOST_CALL proxyRevocableConstructorThrowError(ExecState* exec)
+{
+    return throwVMTypeError(exec, ASCIILiteral(&quot;Proxy.revocable can not be constructed. It can only be called.&quot;));
+}
+
+void ProxyConstructor::finishCreation(VM&amp; vm, const char* name, JSGlobalObject* globalObject)
+{
</ins><span class="cx">     Base::finishCreation(vm, name);
</span><span class="cx"> 
</span><del>-    putDirectWithoutTransition(vm, vm.propertyNames-&gt;length, jsNumber(2), ReadOnly | DontDelete | DontEnum);
</del><ins>+    putDirect(vm, vm.propertyNames-&gt;length, jsNumber(2), ReadOnly | DontDelete | DontEnum);
+    putDirect(vm, makeIdentifier(vm, &quot;revocable&quot;), JSFunction::create(vm, globalObject, 2, ASCIILiteral(&quot;revocable&quot;), makeRevocableProxy, NoIntrinsic, proxyRevocableConstructorThrowError));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL constructProxyObject(ExecState* exec)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeProxyConstructorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ProxyConstructor.h (197731 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ProxyConstructor.h        2016-03-08 07:09:23 UTC (rev 197731)
+++ trunk/Source/JavaScriptCore/runtime/ProxyConstructor.h        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">         return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void finishCreation(VM&amp;, const char* name);
</del><ins>+    void finishCreation(VM&amp;, const char* name, JSGlobalObject*);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     ProxyConstructor(VM&amp;, Structure*);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeProxyObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp (197731 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp        2016-03-08 07:09:23 UTC (rev 197731)
+++ trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -53,10 +53,8 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (ProxyObject* targetAsProxy = jsDynamicCast&lt;ProxyObject*&gt;(target)) {
</span><del>-        // FIXME: Add tests for this once we implement Proxy.revoke(.).
-        // https://bugs.webkit.org/show_bug.cgi?id=154321
</del><span class="cx">         if (targetAsProxy-&gt;handler().isNull()) {
</span><del>-            throwTypeError(exec, ASCIILiteral(&quot;If a Proxy's handler is another Proxy object, the other Proxy object must have a non-null handler.&quot;));
</del><ins>+            throwTypeError(exec, ASCIILiteral(&quot;If a Proxy's handler is another Proxy object, the other Proxy should not have been revoked.&quot;));
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -77,6 +75,8 @@
</span><span class="cx">     m_handler.set(vm, this, handler);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static const char* s_proxyAlreadyRevokedErrorMessage = &quot;Proxy has already been revoked. No more operations are allowed to be performed on it.&quot;;
+
</ins><span class="cx"> static EncodedJSValue performProxyGet(ExecState* exec, EncodedJSValue thisValue, PropertyName propertyName)
</span><span class="cx"> {
</span><span class="cx">     VM&amp; vm = exec-&gt;vm();
</span><span class="lines">@@ -113,7 +113,7 @@
</span><span class="cx"> 
</span><span class="cx">     JSValue handlerValue = proxyObject-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull())
</span><del>-        return throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        return throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx"> 
</span><span class="cx">     JSObject* handler = jsCast&lt;JSObject*&gt;(handlerValue);
</span><span class="cx">     CallData callData;
</span><span class="lines">@@ -164,7 +164,7 @@
</span><span class="cx"> 
</span><span class="cx">     JSValue handlerValue = this-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull()) {
</span><del>-        throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -267,7 +267,7 @@
</span><span class="cx"> 
</span><span class="cx">     JSValue handlerValue = this-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull()) {
</span><del>-        throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -360,7 +360,7 @@
</span><span class="cx"> 
</span><span class="cx">     JSValue handlerValue = this-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull()) {
</span><del>-        throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -447,7 +447,7 @@
</span><span class="cx">     ProxyObject* proxy = jsCast&lt;ProxyObject*&gt;(exec-&gt;callee());
</span><span class="cx">     JSValue handlerValue = proxy-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull())
</span><del>-        return throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        return throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx"> 
</span><span class="cx">     JSObject* handler = jsCast&lt;JSObject*&gt;(handlerValue);
</span><span class="cx">     CallData callData;
</span><span class="lines">@@ -492,7 +492,7 @@
</span><span class="cx">     ProxyObject* proxy = jsCast&lt;ProxyObject*&gt;(exec-&gt;callee());
</span><span class="cx">     JSValue handlerValue = proxy-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull())
</span><del>-        return throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        return throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx"> 
</span><span class="cx">     JSObject* handler = jsCast&lt;JSObject*&gt;(handlerValue);
</span><span class="cx">     CallData callData;
</span><span class="lines">@@ -546,7 +546,7 @@
</span><span class="cx"> 
</span><span class="cx">     JSValue handlerValue = this-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull()) {
</span><del>-        throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -615,7 +615,7 @@
</span><span class="cx"> 
</span><span class="cx">     JSValue handlerValue = this-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull()) {
</span><del>-        throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -663,7 +663,7 @@
</span><span class="cx"> 
</span><span class="cx">     JSValue handlerValue = this-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull()) {
</span><del>-        throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -725,7 +725,7 @@
</span><span class="cx"> 
</span><span class="cx">     JSValue handlerValue = this-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull()) {
</span><del>-        throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -809,7 +809,7 @@
</span><span class="cx">     VM&amp; vm = exec-&gt;vm();
</span><span class="cx">     JSValue handlerValue = this-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull()) {
</span><del>-        throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -970,7 +970,7 @@
</span><span class="cx"> 
</span><span class="cx">     JSValue handlerValue = this-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull()) {
</span><del>-        throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1030,7 +1030,7 @@
</span><span class="cx"> 
</span><span class="cx">     JSValue handlerValue = this-&gt;handler();
</span><span class="cx">     if (handlerValue.isNull()) {
</span><del>-        throwVMTypeError(exec, ASCIILiteral(&quot;Proxy 'handler' is null. It should be an Object.&quot;));
</del><ins>+        throwVMTypeError(exec, ASCIILiteral(s_proxyAlreadyRevokedErrorMessage));
</ins><span class="cx">         return JSValue();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1078,6 +1078,13 @@
</span><span class="cx">     return jsCast&lt;ProxyObject*&gt;(object)-&gt;performGetPrototype(exec);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ProxyObject::revoke(VM&amp; vm)
+{ 
+    // This should only ever be called once and we should strictly transition from Object to null.
+    RELEASE_ASSERT(!m_handler.get().isNull() &amp;&amp; m_handler.get().isObject());
+    m_handler.set(vm, this, jsNull());
+}
+
</ins><span class="cx"> void ProxyObject::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
</span><span class="cx"> {
</span><span class="cx">     ProxyObject* thisObject = jsCast&lt;ProxyObject*&gt;(cell);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeProxyObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ProxyObject.h (197731 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ProxyObject.h        2016-03-08 07:09:23 UTC (rev 197731)
+++ trunk/Source/JavaScriptCore/runtime/ProxyObject.h        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx"> 
</span><span class="cx">     // We lie an say we override getPropertyNames() because it prevents
</span><span class="cx">     // property name enumeration caching.
</span><del>-    const static unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | TypeOfShouldCallGetCallData | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | OverridesGetPropertyNames;
</del><ins>+    const static unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | TypeOfShouldCallGetCallData | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | OverridesGetPropertyNames | ProhibitsPropertyCaching;
</ins><span class="cx"> 
</span><span class="cx">     static ProxyObject* create(ExecState* exec, Structure* structure, JSValue target, JSValue handler)
</span><span class="cx">     {
</span><span class="lines">@@ -66,6 +66,7 @@
</span><span class="cx">     static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
</span><span class="cx">     void putByIndexCommon(ExecState*, JSValue thisValue, unsigned propertyName, JSValue putValue, bool shouldThrow);
</span><span class="cx">     JSValue performGetPrototype(ExecState*);
</span><ins>+    void revoke(VM&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     ProxyObject(VM&amp;, Structure*);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeProxyRevokecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/runtime/ProxyRevoke.cpp (0 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ProxyRevoke.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/ProxyRevoke.cpp        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ProxyRevoke.h&quot;
+
+#include &quot;JSCJSValueInlines.h&quot;
+#include &quot;ProxyObject.h&quot;
+#include &quot;SlotVisitorInlines.h&quot;
+#include &quot;StructureInlines.h&quot;
+
+namespace JSC {
+
+STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ProxyRevoke);
+
+const ClassInfo ProxyRevoke::s_info = { &quot;ProxyRevoke&quot;, &amp;Base::s_info, 0, CREATE_METHOD_TABLE(ProxyRevoke) };
+
+ProxyRevoke* ProxyRevoke::create(VM&amp; vm, Structure* structure, ProxyObject* proxy)
+{
+    ProxyRevoke* revoke = new (NotNull, allocateCell&lt;ProxyRevoke&gt;(vm.heap)) ProxyRevoke(vm, structure);
+    revoke-&gt;finishCreation(vm, &quot;revoke&quot;, proxy);
+    return revoke;
+}
+
+ProxyRevoke::ProxyRevoke(VM&amp; vm, Structure* structure)
+    : Base(vm, structure)
+{
+}
+
+void ProxyRevoke::finishCreation(VM&amp; vm, const char* name, ProxyObject* proxy)
+{
+    Base::finishCreation(vm, String(name));
+    m_proxy.set(vm, this, proxy);
+
+    putDirect(vm, vm.propertyNames-&gt;length, jsNumber(0), ReadOnly | DontDelete | DontEnum);
+}
+
+static EncodedJSValue JSC_HOST_CALL performProxyRevoke(ExecState* exec)
+{
+    ProxyRevoke* proxyRevoke = jsCast&lt;ProxyRevoke*&gt;(exec-&gt;callee());
+    JSValue proxyValue = proxyRevoke-&gt;proxy();
+    if (proxyValue.isNull())
+        return JSValue::encode(jsUndefined());
+
+    ProxyObject* proxy = jsCast&lt;ProxyObject*&gt;(proxyValue);
+    VM&amp; vm = exec-&gt;vm();
+    proxy-&gt;revoke(vm);
+    proxyRevoke-&gt;setProxyToNull(vm);
+    return JSValue::encode(jsUndefined());
+}
+
+CallType ProxyRevoke::getCallData(JSCell*, CallData&amp; callData)
+{
+    callData.native.function = performProxyRevoke;
+    return CallType::Host;
+}
+
+void ProxyRevoke::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
+{
+    ProxyRevoke* thisObject = jsCast&lt;ProxyRevoke*&gt;(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+    Base::visitChildren(thisObject, visitor);
+
+    visitor.append(&amp;thisObject-&gt;m_proxy);
+}
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeProxyRevokehfromrev197731trunkSourceJavaScriptCoreruntimeProxyConstructorh"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/runtime/ProxyRevoke.h (from rev 197731, trunk/Source/JavaScriptCore/runtime/ProxyConstructor.h) (0 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ProxyRevoke.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/ProxyRevoke.h        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ProxyRevoke_h
+#define ProxyRevoke_h
+
+#include &quot;InternalFunction.h&quot;
+
+namespace JSC {
+
+class ProxyObject;
+
+class ProxyRevoke : public InternalFunction {
+public:
+    typedef InternalFunction Base;
+    static const unsigned StructureFlags = Base::StructureFlags;
+
+    static ProxyRevoke* create(VM&amp;, Structure*, ProxyObject*);
+
+    DECLARE_INFO;
+
+    static Structure* createStructure(VM&amp; vm, JSGlobalObject* globalObject, JSValue prototype) 
+    { 
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 
+    }
+
+    void finishCreation(VM&amp;, const char* name, ProxyObject*);
+    static void visitChildren(JSCell*, SlotVisitor&amp;);
+    JSValue proxy() { return m_proxy.get(); }
+    void setProxyToNull(VM&amp; vm) { return m_proxy.set(vm, this, jsNull()); }
+
+private:
+    ProxyRevoke(VM&amp;, Structure*);
+    static CallType getCallData(JSCell*, CallData&amp;);
+
+    WriteBarrier&lt;Unknown&gt; m_proxy;
+};
+
+} // namespace JSC
+
+#endif // ProxyRevoke_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestses6yaml"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/es6.yaml (197731 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/es6.yaml        2016-03-08 07:09:23 UTC (rev 197731)
+++ trunk/Source/JavaScriptCore/tests/es6.yaml        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -1063,7 +1063,7 @@
</span><span class="cx"> - path: es6/Proxy_preventExtensions_handler.js
</span><span class="cx">   cmd: runES6 :normal
</span><span class="cx"> - path: es6/Proxy_Proxy.revocable.js
</span><del>-  cmd: runES6 :fail
</del><ins>+  cmd: runES6 :normal
</ins><span class="cx"> - path: es6/Proxy_set_handler.js
</span><span class="cx">   cmd: runES6 :normal
</span><span class="cx"> - path: es6/Proxy_set_handler_instances_of_proxies.js
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressproxyhaspropertyjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/proxy-has-property.js (197731 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/proxy-has-property.js        2016-03-08 07:09:23 UTC (rev 197731)
+++ trunk/Source/JavaScriptCore/tests/stress/proxy-has-property.js        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -443,3 +443,23 @@
</span><span class="cx">         assert(!called1);
</span><span class="cx">     }
</span><span class="cx"> }
</span><ins>+
+{
+    let called = false;
+    let handler = {
+        has: function(...args) {
+            called = true;
+            return Reflect.has(...args);
+        }
+    };
+    let proxy = new Proxy({}, handler);
+    let foo = function() {
+        assert(!Reflect.has(proxy, &quot;x&quot;));
+        assert(called);
+        called = false;
+    }
+    noInline(foo)
+    for (let i = 0; i &lt; 10000; i++) {
+        foo();
+    }
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressproxyrevokejs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/proxy-revoke.js (0 => 197732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/proxy-revoke.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/proxy-revoke.js        2016-03-08 07:16:21 UTC (rev 197732)
</span><span class="lines">@@ -0,0 +1,191 @@
</span><ins>+function assert(b) {
+    if (!b)
+        throw new Error(&quot;bad assertion.&quot;);
+}
+
+{
+    assert(Proxy.revocable.length === 2);
+    assert(Proxy.revocable.name === &quot;revocable&quot;);
+
+    {
+        let threw = false;
+        try {
+            new Proxy.revocable;
+        } catch(e) {
+            threw = true;
+            assert(e.toString() === &quot;TypeError: Proxy.revocable can not be constructed. It can only be called.&quot;);
+        }
+        assert(threw);
+    }
+
+    {
+        let threw = false;
+        try {
+            Proxy.revocable();
+        } catch(e) {
+            threw = true;
+            assert(e.toString() === &quot;TypeError: Proxy.revocable needs to be called with two arguments: the target and the handler.&quot;);
+        }
+        assert(threw);
+    }
+
+    {
+        let threw = false;
+        try {
+            Proxy.revocable({});
+        } catch(e) {
+            threw = true;
+            assert(e.toString() === &quot;TypeError: Proxy.revocable needs to be called with two arguments: the target and the handler.&quot;);
+        }
+        assert(threw);
+    }
+
+    {
+        let threw = false;
+        try {
+            Proxy.revocable({}, null);
+        } catch(e) {
+            threw = true;
+            assert(e.toString() === &quot;TypeError: A Proxy's 'handler' should be an Object&quot;);
+        }
+        assert(threw);
+    }
+
+    {
+        let threw = false;
+        try {
+            Proxy.revocable(null, {});
+        } catch(e) {
+            threw = true;
+            assert(e.toString() === &quot;TypeError: A Proxy's 'target' should be an Object&quot;);
+        }
+        assert(threw);
+    }
+
+    {
+        let threw = false;
+        try {
+            Proxy.revocable({}, {}, {}); // It's okay to call with &gt; 2 arguments.
+        } catch(e) {
+            threw = true;
+        }
+        assert(!threw);
+    }
+
+    for (let i = 0; i &lt; 500; i++) {
+        let threw = false;
+        try {
+            let {revoke} =  Proxy.revocable({}, {}); // It's okay to call with &gt; 2 arguments.
+            new revoke;
+        } catch(e) {
+            threw = true;
+            assert(e.toString() === &quot;TypeError: function is not a constructor (evaluating 'new revoke')&quot;);
+        }
+        assert(threw);
+    }
+
+    for (let i = 0; i &lt; 500; i++) {
+        function foo() {
+            let threw = false;
+            let {proxy, revoke} = Proxy.revocable({}, {});
+            revoke();
+            try {
+                new Proxy(proxy, {});
+            } catch(e) {
+                threw = true;
+                assert(e.toString() === &quot;TypeError: If a Proxy's handler is another Proxy object, the other Proxy should not have been revoked.&quot;);
+            }
+            assert(threw);
+        }
+        foo();
+    }
+}
+
+function callAllHandlers(proxy) {
+    Reflect.getPrototypeOf(proxy);
+    Reflect.setPrototypeOf(proxy, null);
+    Reflect.isExtensible(proxy);
+    Reflect.preventExtensions(proxy);
+    Reflect.getOwnPropertyDescriptor(proxy, &quot;x&quot;)
+    Reflect.has(proxy, &quot;x&quot;)
+    Reflect.get(proxy, &quot;x&quot;)
+    proxy[&quot;x&quot;] = 20; // Reflect.set
+    Reflect.deleteProperty(proxy, &quot;x&quot;);
+    Reflect.defineProperty(proxy, &quot;x&quot;, {value: 40, enumerable: true, configurable: true});
+    Reflect.ownKeys(proxy);
+    Reflect.apply(proxy, this, []);
+    Reflect.construct(proxy, []);
+}
+
+function shouldThrowNullHandler(f) {
+    let threw = false;
+    try {
+        f();
+    } catch(e) {
+        threw = true;
+        assert(e.toString() === &quot;TypeError: Proxy has already been revoked. No more operations are allowed to be performed on it.&quot;);
+    }
+    assert(threw);
+}
+
+function allHandlersShouldThrow(proxy) {
+    shouldThrowNullHandler(() =&gt; Reflect.getPrototypeOf(proxy));
+    shouldThrowNullHandler(() =&gt; Reflect.setPrototypeOf(proxy, null));
+    shouldThrowNullHandler(() =&gt; Reflect.isExtensible(proxy));
+    shouldThrowNullHandler(() =&gt; Reflect.preventExtensions(proxy));
+    shouldThrowNullHandler(() =&gt; Reflect.getOwnPropertyDescriptor(proxy, &quot;x&quot;));
+    shouldThrowNullHandler(() =&gt; Reflect.has(proxy, &quot;x&quot;));
+    shouldThrowNullHandler(() =&gt; Reflect.get(proxy, &quot;x&quot;));
+    shouldThrowNullHandler(() =&gt; proxy[&quot;x&quot;] = 20); // Reflect.set
+    shouldThrowNullHandler(() =&gt; Reflect.deleteProperty(proxy, &quot;x&quot;));
+    shouldThrowNullHandler(() =&gt; Reflect.defineProperty(proxy, &quot;x&quot;, {value: 40, enumerable: true, configurable: true}));
+    shouldThrowNullHandler(() =&gt; Reflect.ownKeys(proxy));
+    shouldThrowNullHandler(() =&gt; Reflect.apply(proxy, this, []));
+    shouldThrowNullHandler(() =&gt; Reflect.construct(proxy, []));
+}
+
+const traps = [
+    &quot;getPrototypeOf&quot;,
+    &quot;setPrototypeOf&quot;,
+    &quot;isExtensible&quot;,
+    &quot;preventExtensions&quot;,
+    &quot;getOwnPropertyDescriptor&quot;,
+    &quot;has&quot;,
+    &quot;get&quot;,
+    &quot;set&quot;,
+    &quot;deleteProperty&quot;,
+    &quot;defineProperty&quot;,
+    &quot;ownKeys&quot;,
+    &quot;apply&quot;,
+    &quot;construct&quot;
+];
+
+for (let i = 0; i &lt; 500; i++) {
+    let handler = {};
+    let count = 0;
+    let trapsCalled = new Set;
+    for (let trap of traps) {
+        let func;
+        if (trap !== &quot;set&quot;) {
+            func = `(function ${trap}(...args) { count++; trapsCalled.add(${&quot;'&quot; + trap + &quot;'&quot;}); return Reflect.${trap}(...args); })`;
+        } else {
+            func = `(function ${trap}(proxy, prop, v) { trapsCalled.add(${&quot;'&quot; + trap + &quot;'&quot;}); count++; proxy[prop] = v; })`;
+        }
+        handler[trap] = eval(func);
+    }
+
+
+    let {proxy, revoke} = Proxy.revocable(function(){}, handler); // To make callable and constructible true.
+    callAllHandlers(proxy);
+    assert(count &gt;= traps.length);
+    for (let trap of traps) {
+        let result = trapsCalled.has(trap);
+        assert(result);
+    }
+
+    revoke();
+    allHandlersShouldThrow(proxy);
+
+    for (let i = 0; i &lt; 50; i++)
+        revoke(); // Repeatedly calling revoke is OK.
+}
</ins></span></pre>
</div>
</div>

</body>
</html>