<!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>[194603] 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/194603">194603</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-05 13:19:20 -0800 (Tue, 05 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[ES6] Date.prototype should be a plain object
https://bugs.webkit.org/show_bug.cgi?id=152574

Patch by Andy VanWagoner &lt;thetalecrafter@gmail.com&gt; on 2016-01-05
Reviewed by Benjamin Poulain.

Source/JavaScriptCore:

* runtime/DateConstructor.cpp:
(JSC::DateConstructor::finishCreation):
* runtime/DatePrototype.cpp:
(JSC::DatePrototype::DatePrototype):
* runtime/DatePrototype.h:

LayoutTests:

Test that the non-generic Date.prototype methods throw when invoked
from the now generic object Date.prototype. Also test that this change
preserves correct instanceof behavior.

* js/date-proto-generic-invocation-expected.txt:
* js/script-tests/date-proto-generic-invocation.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsdateprotogenericinvocationexpectedtxt">trunk/LayoutTests/js/date-proto-generic-invocation-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsdateprotogenericinvocationjs">trunk/LayoutTests/js/script-tests/date-proto-generic-invocation.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeDateConstructorcpp">trunk/Source/JavaScriptCore/runtime/DateConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeDatePrototypecpp">trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeDatePrototypeh">trunk/Source/JavaScriptCore/runtime/DatePrototype.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (194602 => 194603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-01-05 21:11:30 UTC (rev 194602)
+++ trunk/LayoutTests/ChangeLog        2016-01-05 21:19:20 UTC (rev 194603)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-01-05  Andy VanWagoner  &lt;thetalecrafter@gmail.com&gt;
+
+        [ES6] Date.prototype should be a plain object
+        https://bugs.webkit.org/show_bug.cgi?id=152574
+
+        Reviewed by Benjamin Poulain.
+
+        Test that the non-generic Date.prototype methods throw when invoked
+        from the now generic object Date.prototype. Also test that this change
+        preserves correct instanceof behavior.
+
+        * js/date-proto-generic-invocation-expected.txt:
+        * js/script-tests/date-proto-generic-invocation.js:
+
</ins><span class="cx"> 2016-01-05  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Make ftl-polymorphic-xxx tests more polymorphic.
</span></span></pre></div>
<a id="trunkLayoutTestsjsdateprotogenericinvocationexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/date-proto-generic-invocation-expected.txt (194602 => 194603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/date-proto-generic-invocation-expected.txt        2016-01-05 21:11:30 UTC (rev 194602)
+++ trunk/LayoutTests/js/date-proto-generic-invocation-expected.txt        2016-01-05 21:19:20 UTC (rev 194603)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-This test verifies that the functions of the Date prototype object are not generic, as documented in ECMA-262 rev3 section 15.9.5 Properties of the Date Prototype Object.
</del><ins>+This test verifies that the functions of the Date prototype object are not generic, and the prototype is a plain object, as documented in ECMA-262 rev6 section 20.3.4 Properties of the Date Prototype Object.
</ins><span class="cx"> 
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="cx"> 
</span><span class="lines">@@ -31,6 +31,38 @@
</span><span class="cx"> PASS o.__proto__.setMonth() threw exception TypeError: Type error.
</span><span class="cx"> PASS o.__proto__.setFullYear() threw exception TypeError: Type error.
</span><span class="cx"> PASS o.__proto__.setYear() threw exception TypeError: Type error.
</span><ins>+PASS Date.prototype.toString() threw exception TypeError: Type error.
+PASS Date.prototype.toDateString() threw exception TypeError: Type error.
+PASS Date.prototype.toTimeString() threw exception TypeError: Type error.
+PASS Date.prototype.toGMTString() threw exception TypeError: Type error.
+PASS Date.prototype.toUTCString() threw exception TypeError: Type error.
+PASS Date.prototype.toLocaleString() threw exception TypeError: Type error.
+PASS Date.prototype.toLocaleDateString() threw exception TypeError: Type error.
+PASS Date.prototype.toLocaleTimeString() threw exception TypeError: Type error.
+PASS Date.prototype.getTime() threw exception TypeError: Type error.
+PASS Date.prototype.getYear() threw exception TypeError: Type error.
+PASS Date.prototype.getFullYear() threw exception TypeError: Type error.
+PASS Date.prototype.getMonth() threw exception TypeError: Type error.
+PASS Date.prototype.getDate() threw exception TypeError: Type error.
+PASS Date.prototype.getDay() threw exception TypeError: Type error.
+PASS Date.prototype.getHours() threw exception TypeError: Type error.
+PASS Date.prototype.getMinutes() threw exception TypeError: Type error.
+PASS Date.prototype.getSeconds() threw exception TypeError: Type error.
+PASS Date.prototype.getMilliseconds() threw exception TypeError: Type error.
+PASS Date.prototype.getTimezoneOffset() threw exception TypeError: Type error.
+PASS Date.prototype.setTime() threw exception TypeError: Type error.
+PASS Date.prototype.setMilliseconds() threw exception TypeError: Type error.
+PASS Date.prototype.setSeconds() threw exception TypeError: Type error.
+PASS Date.prototype.setMinutes() threw exception TypeError: Type error.
+PASS Date.prototype.setHours() threw exception TypeError: Type error.
+PASS Date.prototype.setDate() threw exception TypeError: Type error.
+PASS Date.prototype.setMonth() threw exception TypeError: Type error.
+PASS Date.prototype.setFullYear() threw exception TypeError: Type error.
+PASS Date.prototype.setYear() threw exception TypeError: Type error.
+PASS new Date instanceof Date is true
+PASS (new Date).__proto__ is Date.prototype
+PASS (new Date).__proto__ instanceof Date is false
+PASS Date.prototype instanceof Date is false
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsdateprotogenericinvocationjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/date-proto-generic-invocation.js (194602 => 194603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/date-proto-generic-invocation.js        2016-01-05 21:11:30 UTC (rev 194602)
+++ trunk/LayoutTests/js/script-tests/date-proto-generic-invocation.js        2016-01-05 21:19:20 UTC (rev 194603)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-description(&quot;This test verifies that the functions of the Date prototype object are not generic, as documented in ECMA-262 rev3 section 15.9.5 Properties of the Date Prototype Object.&quot;);
</del><ins>+description(&quot;This test verifies that the functions of the Date prototype object are not generic, and the prototype is a plain object, as documented in ECMA-262 rev6 section 20.3.4 Properties of the Date Prototype Object.&quot;);
</ins><span class="cx"> 
</span><span class="cx"> var functionNames = [
</span><span class="cx">         &quot;Date.prototype.toString&quot;,
</span><span class="lines">@@ -38,3 +38,11 @@
</span><span class="cx">     eval(testFunctionName + &quot; = &quot; + functionNames[i]);
</span><span class="cx">     shouldThrow(testFunctionName + &quot;()&quot;, '&quot;TypeError: Type error&quot;');
</span><span class="cx"> }
</span><ins>+for (var i = 0; i &lt; functionNames.length; i++) {
+    shouldThrow(functionNames[i] + &quot;()&quot;, '&quot;TypeError: Type error&quot;');
+}
+
+shouldBeTrue(&quot;new Date instanceof Date&quot;);
+shouldBe(&quot;(new Date).__proto__&quot;, &quot;Date.prototype&quot;);
+shouldBeFalse(&quot;(new Date).__proto__ instanceof Date&quot;);
+shouldBeFalse(&quot;Date.prototype instanceof Date&quot;);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (194602 => 194603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-01-05 21:11:30 UTC (rev 194602)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-01-05 21:19:20 UTC (rev 194603)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-01-05  Andy VanWagoner  &lt;thetalecrafter@gmail.com&gt;
+
+        [ES6] Date.prototype should be a plain object
+        https://bugs.webkit.org/show_bug.cgi?id=152574
+
+        Reviewed by Benjamin Poulain.
+
+        * runtime/DateConstructor.cpp:
+        (JSC::DateConstructor::finishCreation):
+        * runtime/DatePrototype.cpp:
+        (JSC::DatePrototype::DatePrototype):
+        * runtime/DatePrototype.h:
+
</ins><span class="cx"> 2016-01-05  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r194590.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeDateConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/DateConstructor.cpp (194602 => 194603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/DateConstructor.cpp        2016-01-05 21:11:30 UTC (rev 194602)
+++ trunk/Source/JavaScriptCore/runtime/DateConstructor.cpp        2016-01-05 21:19:20 UTC (rev 194603)
</span><span class="lines">@@ -102,7 +102,7 @@
</span><span class="cx"> 
</span><span class="cx"> void DateConstructor::finishCreation(VM&amp; vm, DatePrototype* datePrototype)
</span><span class="cx"> {
</span><del>-    Base::finishCreation(vm, datePrototype-&gt;classInfo()-&gt;className);
</del><ins>+    Base::finishCreation(vm, &quot;Date&quot;);
</ins><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames-&gt;prototype, datePrototype, DontEnum | DontDelete | ReadOnly);
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames-&gt;length, jsNumber(7), ReadOnly | DontEnum | DontDelete);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeDatePrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp (194602 => 194603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp        2016-01-05 21:11:30 UTC (rev 194602)
+++ trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp        2016-01-05 21:19:20 UTC (rev 194603)
</span><span class="lines">@@ -425,7 +425,7 @@
</span><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const ClassInfo DatePrototype::s_info = {&quot;Date&quot;, &amp;DateInstance::s_info, &amp;dateTable, CREATE_METHOD_TABLE(DatePrototype)};
</del><ins>+const ClassInfo DatePrototype::s_info = {&quot;Object&quot;, &amp;JSNonFinalObject::s_info, &amp;dateTable, CREATE_METHOD_TABLE(DatePrototype)};
</ins><span class="cx"> 
</span><span class="cx"> /* Source for DatePrototype.lut.h
</span><span class="cx"> @begin dateTable
</span><span class="lines">@@ -481,7 +481,7 @@
</span><span class="cx"> // ECMA 15.9.4
</span><span class="cx"> 
</span><span class="cx"> DatePrototype::DatePrototype(VM&amp; vm, Structure* structure)
</span><del>-    : DateInstance(vm, structure)
</del><ins>+    : Base(vm, structure)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeDatePrototypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/DatePrototype.h (194602 => 194603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/DatePrototype.h        2016-01-05 21:11:30 UTC (rev 194602)
+++ trunk/Source/JavaScriptCore/runtime/DatePrototype.h        2016-01-05 21:19:20 UTC (rev 194603)
</span><span class="lines">@@ -27,12 +27,12 @@
</span><span class="cx"> 
</span><span class="cx"> class ObjectPrototype;
</span><span class="cx"> 
</span><del>-class DatePrototype : public DateInstance {
</del><ins>+class DatePrototype : public JSNonFinalObject {
</ins><span class="cx"> private:
</span><span class="cx">     DatePrototype(VM&amp;, Structure*);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    typedef DateInstance Base;
</del><ins>+    typedef JSNonFinalObject Base;
</ins><span class="cx">     static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;
</span><span class="cx"> 
</span><span class="cx">     static DatePrototype* create(VM&amp; vm, JSGlobalObject* globalObject, Structure* structure)
</span></span></pre>
</div>
</div>

</body>
</html>