<!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>[201428] trunk</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/201428">201428</a></dd>
<dt>Author</dt> <dd>ggaren@apple.com</dd>
<dt>Date</dt> <dd>2016-05-26 12:51:26 -0700 (Thu, 26 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>replaceable own properties seem to ignore replacement after property caching
https://bugs.webkit.org/show_bug.cgi?id=158091

Reviewed by Darin Adler.

PerformanceTests:

* MallocBench/MallocBench.xcodeproj/project.pbxproj:
* MallocBench/MallocBench/Benchmark.cpp:
* MallocBench/MallocBench/Interpreter.cpp:
(Interpreter::doMallocOp):
* MallocBench/MallocBench/Interpreter.h:
* MallocBench/MallocBench/fastMallocLog.63316.ops: Added.
* MallocBench/MallocBench/jetstream.cpp: Added.
(benchmark_jetstream):
* MallocBench/MallocBench/jetstream.h: Added.

Source/JavaScriptCore:

* runtime/Lookup.h:
(JSC::replaceStaticPropertySlot): New helper function for replacing a
static property with a direct property. We need to do an attribute changed
transition because client code might have cached our static property.

Source/WebCore:

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation): Use our new replacement helper if we're replacing
an own static property with an own direct property. Because we advertise
that our own static properties are cacheable, we need to do a structure
transition to indicate when they change. (Only own properties need this 
special treatment because JSC considers it normal to shadow a prototype
property with an own property.)

LayoutTests:

* js/cached-window-properties.html: Augmneted this test to enter cacheable
dictionary mode in order to demonstrate a bug that is not visible otherwise.

Factored out a helper test function.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjscachedwindowpropertieshtml">trunk/LayoutTests/js/cached-window-properties.html</a></li>
<li><a href="#trunkPerformanceTestsChangeLog">trunk/PerformanceTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeLookuph">trunk/Source/JavaScriptCore/runtime/Lookup.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (201427 => 201428)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-05-26 19:29:02 UTC (rev 201427)
+++ trunk/LayoutTests/ChangeLog        2016-05-26 19:51:26 UTC (rev 201428)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-05-25  Geoffrey Garen  &lt;ggaren@apple.com&gt;
+
+        replaceable own properties seem to ignore replacement after property caching
+        https://bugs.webkit.org/show_bug.cgi?id=158091
+
+        Reviewed by Darin Adler.
+
+        * js/cached-window-properties.html: Augmneted this test to enter cacheable
+        dictionary mode in order to demonstrate a bug that is not visible otherwise.
+
+        Factored out a helper test function.
+
</ins><span class="cx"> 2016-05-26  Pranjal Jumde  &lt;pjumde@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Sites served over insecure connections should not be allowed to use geolocation.
</span></span></pre></div>
<a id="trunkLayoutTestsjscachedwindowpropertieshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/cached-window-properties.html (201427 => 201428)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/cached-window-properties.html        2016-05-26 19:29:02 UTC (rev 201427)
+++ trunk/LayoutTests/js/cached-window-properties.html        2016-05-26 19:51:26 UTC (rev 201428)
</span><span class="lines">@@ -1,31 +1,37 @@
</span><del>-&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
</del><ins>+&lt;!DOCTYPE HTML&gt;
</ins><span class="cx"> &lt;html&gt;
</span><span class="cx"> &lt;head&gt;
</span><span class="cx"> &lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
</span><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body&gt;
</span><span class="cx"> &lt;script&gt;
</span><ins>+
+// Force the window into cacheable dictionary mode.
+for (var i = 0; i &lt; 100; ++i)
+        window[&quot;p&quot; + i] = i;
+
</ins><span class="cx"> var foo = function(o) {
</span><span class="cx">     return o.screenX;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-var x = window.screenX;
-var niters = 100000;
-var sum = 0;
-for (var i = 0; i &lt; niters; ++i) {
-    sum += foo(window);
</del><ins>+var test = function(id, x)
+{
+        var niters = 100000;
+
+        var sum = 0;
+        for (var i = 0; i &lt; niters; ++i)
+            sum += foo(window);
+
+        if (sum !== x * niters)
+            throw new Error(&quot;Incorrect sum for &quot; + id);
</ins><span class="cx"> }
</span><del>-if (sum !== x * niters)
-    throw new Error(&quot;Incorrect sum&quot;);
</del><span class="cx"> 
</span><del>-window.screenX = 42;
</del><ins>+var x = window.screenX;
+test(&quot;x&quot;, x);
</ins><span class="cx"> 
</span><del>-sum = 0;
-for (var i = 0; i &lt; niters; ++i) {
-    sum += foo(window);
-}
-if (sum !== 42 * niters)
-    throw new Error(&quot;Incorrect sum&quot;);
</del><ins>+var newX = window.screenX + 1;
+window.screenX = newX;
+test(&quot;newX&quot;, newX);
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span><span class="cx"> &lt;/body&gt;
</span></span></pre></div>
<a id="trunkPerformanceTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/ChangeLog (201427 => 201428)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/ChangeLog        2016-05-26 19:29:02 UTC (rev 201427)
+++ trunk/PerformanceTests/ChangeLog        2016-05-26 19:51:26 UTC (rev 201428)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-05-25  Geoffrey Garen  &lt;ggaren@apple.com&gt;
+
+        replaceable own properties seem to ignore replacement after property caching
+        https://bugs.webkit.org/show_bug.cgi?id=158091
+
+        Reviewed by Darin Adler.
+
+        * MallocBench/MallocBench.xcodeproj/project.pbxproj:
+        * MallocBench/MallocBench/Benchmark.cpp:
+        * MallocBench/MallocBench/Interpreter.cpp:
+        (Interpreter::doMallocOp):
+        * MallocBench/MallocBench/Interpreter.h:
+        * MallocBench/MallocBench/fastMallocLog.63316.ops: Added.
+        * MallocBench/MallocBench/jetstream.cpp: Added.
+        (benchmark_jetstream):
+        * MallocBench/MallocBench/jetstream.h: Added.
+
</ins><span class="cx"> 2016-05-25  Keith Miller  &lt;keith_miller@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, add JSBench to the skipped list for now since it doesn't
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (201427 => 201428)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-05-26 19:29:02 UTC (rev 201427)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-05-26 19:51:26 UTC (rev 201428)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-05-25  Geoffrey Garen  &lt;ggaren@apple.com&gt;
+
+        replaceable own properties seem to ignore replacement after property caching
+        https://bugs.webkit.org/show_bug.cgi?id=158091
+
+        Reviewed by Darin Adler.
+
+        * runtime/Lookup.h:
+        (JSC::replaceStaticPropertySlot): New helper function for replacing a
+        static property with a direct property. We need to do an attribute changed
+        transition because client code might have cached our static property.
+
</ins><span class="cx"> 2016-05-25  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [JSC] RegExp with deeply nested subexpressions overflow the stack in Yarr
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeLookuph"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Lookup.h (201427 => 201428)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Lookup.h        2016-05-26 19:29:02 UTC (rev 201427)
+++ trunk/Source/JavaScriptCore/runtime/Lookup.h        2016-05-26 19:51:26 UTC (rev 201428)
</span><span class="lines">@@ -288,6 +288,17 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline bool replaceStaticPropertySlot(VM&amp; vm, JSObject* thisObject, PropertyName propertyName, JSValue value)
+{
+    if (!thisObject-&gt;putDirect(vm, propertyName, value))
+        return false;
+
+    if (!thisObject-&gt;staticFunctionsReified())
+        thisObject-&gt;JSObject::setStructure(vm, Structure::attributeChangeTransition(vm, thisObject-&gt;structure(), propertyName, 0));
+
+    return true;
+}
+
</ins><span class="cx"> // 'base' means the object holding the property (possibly in the prototype chain of the object put was called on).
</span><span class="cx"> // 'thisValue' is the object that put is being applied to (in the case of a proxy, the proxy target).
</span><span class="cx"> // 'slot.thisValue()' is the object the put was originally performed on (in the case of a proxy, the proxy itself).
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201427 => 201428)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-26 19:29:02 UTC (rev 201427)
+++ trunk/Source/WebCore/ChangeLog        2016-05-26 19:51:26 UTC (rev 201428)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-05-25  Geoffrey Garen  &lt;ggaren@apple.com&gt;
+
+        replaceable own properties seem to ignore replacement after property caching
+        https://bugs.webkit.org/show_bug.cgi?id=158091
+
+        Reviewed by Darin Adler.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation): Use our new replacement helper if we're replacing
+        an own static property with an own direct property. Because we advertise
+        that our own static properties are cacheable, we need to do a structure
+        transition to indicate when they change. (Only own properties need this 
+        special treatment because JSC considers it normal to shadow a prototype
+        property with an own property.)
+
</ins><span class="cx"> 2016-05-26  Said Abou-Hallawa  &lt;sabouhallawa@apple,com&gt;
</span><span class="cx"> 
</span><span class="cx">         BitmapImage::checkForSolidColor() cleanup
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (201427 => 201428)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-05-26 19:29:02 UTC (rev 201427)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-05-26 19:51:26 UTC (rev 201428)
</span><span class="lines">@@ -2910,8 +2910,12 @@
</span><span class="cx">                 push(@implContent, &quot;    // Shadowing a built-in constructor.\n&quot;);
</span><span class="cx">                 push(@implContent, &quot;    return castedThis-&gt;putDirect(state-&gt;vm(), Identifier::fromString(state, \&quot;$name\&quot;), value);\n&quot;);
</span><span class="cx">             } elsif ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Replaceable&quot;}) {
</span><del>-                push(@implContent, &quot;    // Shadowing a built-in object.\n&quot;);
-                push(@implContent, &quot;    return castedThis-&gt;putDirect(state-&gt;vm(), Identifier::fromString(state, \&quot;$name\&quot;), value);\n&quot;);
</del><ins>+                push(@implContent, &quot;    // Shadowing a built-in property.\n&quot;);
+                if (AttributeShouldBeOnInstance($interface, $attribute)) {
+                    push(@implContent, &quot;    return replaceStaticPropertySlot(state-&gt;vm(), castedThis, Identifier::fromString(state, \&quot;$name\&quot;), value);\n&quot;);
+                } else {
+                    push(@implContent, &quot;    return castedThis-&gt;putDirect(state-&gt;vm(), Identifier::fromString(state, \&quot;$name\&quot;), value);\n&quot;);
+                }
</ins><span class="cx">             } else {
</span><span class="cx">                 if (!$attribute-&gt;isStatic) {
</span><span class="cx">                     my $putForwards = $attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;PutForwards&quot;};
</span></span></pre>
</div>
</div>

</body>
</html>