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

<h3>Log Message</h3>
<pre>[INTL] Implement Date.prototype.toLocaleDateString in ECMA-402
https://bugs.webkit.org/show_bug.cgi?id=147612

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

Source/JavaScriptCore:

Implement toLocaleDateString in builtin JavaScript. Remove comments with
spec steps, and instead link to the new HTML version of the spec.

Avoids creating an extra empty object in the prototype chain of the options
object in ToDateTimeOptions. The version used in toLocaleString was updated
to match as well.

* builtins/DatePrototype.js:
(toLocaleString.toDateTimeOptionsAnyAll):
(toLocaleString):
(toLocaleDateString.toDateTimeOptionsDateDate):
(toLocaleDateString):
* runtime/DatePrototype.cpp:
(JSC::DatePrototype::finishCreation):

LayoutTests:

Added tests for toLocaleDateString.

* js/date-toLocaleString-expected.txt:
* js/script-tests/date-toLocaleString.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsdatetoLocaleStringexpectedtxt">trunk/LayoutTests/js/date-toLocaleString-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsdatetoLocaleStringjs">trunk/LayoutTests/js/script-tests/date-toLocaleString.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsDatePrototypejs">trunk/Source/JavaScriptCore/builtins/DatePrototype.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeDatePrototypecpp">trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (195329 => 195330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-01-20 01:05:29 UTC (rev 195329)
+++ trunk/LayoutTests/ChangeLog        2016-01-20 01:07:34 UTC (rev 195330)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-01-19  Andy VanWagoner  &lt;thetalecrafter@gmail.com&gt;
+
+        [INTL] Implement Date.prototype.toLocaleDateString in ECMA-402
+        https://bugs.webkit.org/show_bug.cgi?id=147612
+
+        Reviewed by Benjamin Poulain.
+
+        Added tests for toLocaleDateString.
+
+        * js/date-toLocaleString-expected.txt:
+        * js/script-tests/date-toLocaleString.js:
+
</ins><span class="cx"> 2016-01-19  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Modern IDB: Split all storage/indexeddb/modern tests into separate HTML + JS format.
</span></span></pre></div>
<a id="trunkLayoutTestsjsdatetoLocaleStringexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/date-toLocaleString-expected.txt (195329 => 195330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/date-toLocaleString-expected.txt        2016-01-20 01:05:29 UTC (rev 195329)
+++ trunk/LayoutTests/js/date-toLocaleString-expected.txt        2016-01-20 01:07:34 UTC (rev 195330)
</span><span class="lines">@@ -26,6 +26,29 @@
</span><span class="cx"> PASS new Date(0).toLocaleString('en', null) threw exception TypeError: null is not an object.
</span><span class="cx"> PASS new Date(0).toLocaleString('en', { timeZone: 'UTC', hour:'numeric', minute:'2-digit' }) is &quot;12:00 AM&quot;
</span><span class="cx"> PASS new Date(0).toLocaleString('en', { timeZone: 'UTC', year:'numeric', month:'long' }) is &quot;January 1970&quot;
</span><ins>+PASS Date.prototype.toLocaleDateString.length is 0
+PASS Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleDateString').enumerable is false
+PASS Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleDateString').configurable is true
+PASS Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleDateString').writable is true
+PASS Date.prototype.toLocaleDateString.call(new Date) did not throw exception.
+PASS Date.prototype.toLocaleDateString.call() threw exception TypeError: Type error.
+PASS Date.prototype.toLocaleDateString.call(undefined) threw exception TypeError: Type error.
+PASS Date.prototype.toLocaleDateString.call(null) threw exception TypeError: Type error.
+PASS Date.prototype.toLocaleDateString.call(0) threw exception TypeError: Type error.
+PASS Date.prototype.toLocaleDateString.call(NaN) threw exception TypeError: Type error.
+PASS Date.prototype.toLocaleDateString.call(Infinity) threw exception TypeError: Type error.
+PASS Date.prototype.toLocaleDateString.call('1') threw exception TypeError: Type error.
+PASS Date.prototype.toLocaleDateString.call({}) threw exception TypeError: Type error.
+PASS Date.prototype.toLocaleDateString.call([]) threw exception TypeError: Type error.
+PASS Date.prototype.toLocaleDateString.call(Symbol()) threw exception TypeError: Type error.
+PASS typeof new Date().toLocaleDateString() === 'string' is true
+PASS new Date(NaN).toLocaleDateString() is &quot;Invalid Date&quot;
+PASS new Date().toLocaleDateString('i') threw exception RangeError: invalid language tag: i.
+PASS new Date(0).toLocaleDateString('zh-Hans-CN-u-nu-hanidec', { timeZone: 'UTC' }) is &quot;一九七〇/一/一&quot;
+PASS new Date(0).toLocaleDateString('en', { timeZone: 'UTC' }) is &quot;1/1/1970&quot;
+PASS new Date(0).toLocaleDateString('en', null) threw exception TypeError: null is not an object.
+PASS new Date(0).toLocaleDateString('en', { timeZone: 'UTC', hour:'numeric', minute:'2-digit' }) is &quot;1/1/1970, 12:00 AM&quot;
+PASS new Date(0).toLocaleDateString('en', { timeZone: 'UTC', year:'numeric', month:'long' }) is &quot;January 1970&quot;
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsdatetoLocaleStringjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/date-toLocaleString.js (195329 => 195330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/date-toLocaleString.js        2016-01-20 01:05:29 UTC (rev 195329)
+++ trunk/LayoutTests/js/script-tests/date-toLocaleString.js        2016-01-20 01:07:34 UTC (rev 195330)
</span><span class="lines">@@ -35,3 +35,40 @@
</span><span class="cx"> shouldBeEqualToString(&quot;new Date(0).toLocaleString('en', { timeZone: 'UTC', hour:'numeric', minute:'2-digit' })&quot;, &quot;12:00 AM&quot;);
</span><span class="cx"> shouldBeEqualToString(&quot;new Date(0).toLocaleString('en', { timeZone: 'UTC', year:'numeric', month:'long' })&quot;, &quot;January 1970&quot;);
</span><span class="cx"> 
</span><ins>+// Test toLocaleDateString ()
+shouldBe(&quot;Date.prototype.toLocaleDateString.length&quot;, &quot;0&quot;);
+shouldBeFalse(&quot;Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleDateString').enumerable&quot;);
+shouldBeTrue(&quot;Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleDateString').configurable&quot;);
+shouldBeTrue(&quot;Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleDateString').writable&quot;);
+
+// Test thisTimeValue abrupt completion.
+shouldNotThrow(&quot;Date.prototype.toLocaleDateString.call(new Date)&quot;);
+shouldThrow(&quot;Date.prototype.toLocaleDateString.call()&quot;);
+shouldThrow(&quot;Date.prototype.toLocaleDateString.call(undefined)&quot;);
+shouldThrow(&quot;Date.prototype.toLocaleDateString.call(null)&quot;);
+shouldThrow(&quot;Date.prototype.toLocaleDateString.call(0)&quot;);
+shouldThrow(&quot;Date.prototype.toLocaleDateString.call(NaN)&quot;);
+shouldThrow(&quot;Date.prototype.toLocaleDateString.call(Infinity)&quot;);
+shouldThrow(&quot;Date.prototype.toLocaleDateString.call('1')&quot;);
+shouldThrow(&quot;Date.prototype.toLocaleDateString.call({})&quot;);
+shouldThrow(&quot;Date.prototype.toLocaleDateString.call([])&quot;);
+shouldThrow(&quot;Date.prototype.toLocaleDateString.call(Symbol())&quot;);
+
+shouldBeTrue(&quot;typeof new Date().toLocaleDateString() === 'string'&quot;);
+
+shouldBeEqualToString(&quot;new Date(NaN).toLocaleDateString()&quot;, &quot;Invalid Date&quot;);
+
+// Test for DateTimeFormat behavior.
+// Test that locale parameter is passed through properly.
+shouldThrow(&quot;new Date().toLocaleDateString('i')&quot;);
+shouldBeEqualToString(&quot;new Date(0).toLocaleDateString('zh-Hans-CN-u-nu-hanidec', { timeZone: 'UTC' })&quot;, &quot;一九七〇/一/一&quot;);
+
+// Defaults to mdy
+shouldBeEqualToString(&quot;new Date(0).toLocaleDateString('en', { timeZone: 'UTC' })&quot;, &quot;1/1/1970&quot;);
+
+// Test that options parameter is passed through properly.
+shouldThrow(&quot;new Date(0).toLocaleDateString('en', null)&quot;, &quot;'TypeError: null is not an object'&quot;);
+// Adds mdy if no date formats specified.
+shouldBeEqualToString(&quot;new Date(0).toLocaleDateString('en', { timeZone: 'UTC', hour:'numeric', minute:'2-digit' })&quot;, &quot;1/1/1970, 12:00 AM&quot;);
+// If any date formats specified, just use them.
+shouldBeEqualToString(&quot;new Date(0).toLocaleDateString('en', { timeZone: 'UTC', year:'numeric', month:'long' })&quot;, &quot;January 1970&quot;);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (195329 => 195330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-01-20 01:05:29 UTC (rev 195329)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-01-20 01:07:34 UTC (rev 195330)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-01-19  Andy VanWagoner  &lt;thetalecrafter@gmail.com&gt;
+
+        [INTL] Implement Date.prototype.toLocaleDateString in ECMA-402
+        https://bugs.webkit.org/show_bug.cgi?id=147612
+
+        Reviewed by Benjamin Poulain.
+
+        Implement toLocaleDateString in builtin JavaScript. Remove comments with
+        spec steps, and instead link to the new HTML version of the spec.
+
+        Avoids creating an extra empty object in the prototype chain of the options
+        object in ToDateTimeOptions. The version used in toLocaleString was updated
+        to match as well.
+
+        * builtins/DatePrototype.js:
+        (toLocaleString.toDateTimeOptionsAnyAll):
+        (toLocaleString):
+        (toLocaleDateString.toDateTimeOptionsDateDate):
+        (toLocaleDateString):
+        * runtime/DatePrototype.cpp:
+        (JSC::DatePrototype::finishCreation):
+
</ins><span class="cx"> 2016-01-19  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [JSC] fixSpillSlotZDef() crashes on ARM64
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsDatePrototypejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/builtins/DatePrototype.js (195329 => 195330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/DatePrototype.js        2016-01-20 01:05:29 UTC (rev 195329)
+++ trunk/Source/JavaScriptCore/builtins/DatePrototype.js        2016-01-20 01:07:34 UTC (rev 195330)
</span><span class="lines">@@ -31,54 +31,31 @@
</span><span class="cx"> 
</span><span class="cx">     function toDateTimeOptionsAnyAll(opts)
</span><span class="cx">     {
</span><del>-        // ToDateTimeOptions abstract operation (ECMA-402 2.0)
-        // http://ecma-international.org/publications/standards/Ecma-402.htm
</del><ins>+        // ToDateTimeOptions(options, &quot;any&quot;, &quot;all&quot;)
+        // http://www.ecma-international.org/ecma-402/2.0/#sec-InitializeDateTimeFormat
</ins><span class="cx"> 
</span><del>-        // 1. If options is undefined, then let options be null, else let options be ToObject(options).
-        // 2. ReturnIfAbrupt(options).
-        var optObj;
</del><ins>+        var options;
</ins><span class="cx">         if (opts === undefined)
</span><del>-            optObj = null;
</del><ins>+            options = null;
</ins><span class="cx">         else if (opts === null)
</span><span class="cx">             throw new @TypeError(&quot;null is not an object&quot;);
</span><span class="cx">         else
</span><del>-            optObj = @Object(opts);
</del><ins>+            options = @Object(opts);
</ins><span class="cx"> 
</span><del>-        // 3. Let options be ObjectCreate(options).
-        var options = @Object.create(optObj);
-
-        // 4. Let needDefaults be true.
-        // 5. If required is &quot;date&quot; or &quot;any&quot;,
-        // a. For each of the property names &quot;weekday&quot;, &quot;year&quot;, &quot;month&quot;, &quot;day&quot;:
-        // i. Let prop be the property name.
-        // ii. Let value be Get(options, prop).
-        // iii. ReturnIfAbrupt(value).
-        // iv. If value is not undefined, then let needDefaults be false.
-        // 6. If required is &quot;time&quot; or &quot;any&quot;,
-        // a. For each of the property names &quot;hour&quot;, &quot;minute&quot;, &quot;second&quot;:
-        // i. Let prop be the property name.
-        // ii. Let value be Get(options, prop).
-        // iii. ReturnIfAbrupt(value).
-        // iv. If value is not undefined, then let needDefaults be false.
-        // Check optObj instead of options to reduce lookups up the prototype chain.
-        var needsDefaults = !optObj || (
-            optObj.weekday === undefined &amp;&amp;
-            optObj.year === undefined &amp;&amp;
-            optObj.month === undefined &amp;&amp;
-            optObj.day === undefined &amp;&amp;
-            optObj.hour === undefined &amp;&amp;
-            optObj.minute === undefined &amp;&amp;
-            optObj.second === undefined
</del><ins>+        // Check original instead of descendant to reduce lookups up the prototype chain.
+        var needsDefaults = !options || (
+            options.weekday === undefined &amp;&amp;
+            options.year === undefined &amp;&amp;
+            options.month === undefined &amp;&amp;
+            options.day === undefined &amp;&amp;
+            options.hour === undefined &amp;&amp;
+            options.minute === undefined &amp;&amp;
+            options.second === undefined
</ins><span class="cx">         );
</span><span class="cx"> 
</span><del>-        // 7. If needDefaults is true and defaults is either &quot;date&quot; or &quot;all&quot;, then a. For each of the property names &quot;year&quot;, &quot;month&quot;, &quot;day&quot;:
-        // i. Let status be CreateDatePropertyOrThrow(options, prop, &quot;numeric&quot;).
-        // ii. ReturnIfAbrupt(status).
-        // 8. If needDefaults is true and defaults is either &quot;time&quot; or &quot;all&quot;, then
-        // a. For each of the property names &quot;hour&quot;, &quot;minute&quot;, &quot;second&quot;:
-        // i. Let status be CreateDatePropertyOrThrow(options, prop, &quot;numeric&quot;).
-        // ii. ReturnIfAbrupt(status).
</del><ins>+        // Only create descendant if it will have own properties.
</ins><span class="cx">         if (needsDefaults) {
</span><ins>+            options = @Object.create(options)
</ins><span class="cx">             options.year = &quot;numeric&quot;;
</span><span class="cx">             options.month = &quot;numeric&quot;;
</span><span class="cx">             options.day = &quot;numeric&quot;;
</span><span class="lines">@@ -92,25 +69,65 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // 13.3.1 Date.prototype.toLocaleString ([locales [, options ]]) (ECMA-402 2.0)
</span><del>-    // http://ecma-international.org/publications/standards/Ecma-402.htm
</del><ins>+    // http://www.ecma-international.org/ecma-402/2.0/#sec-Date.prototype.toLocaleString
</ins><span class="cx"> 
</span><del>-    // 1. Let x be thisTimeValue(this value).
-    // 2. ReturnIfAbrupt(x).
</del><span class="cx">     var value = @thisTimeValue.@call(this);
</span><del>-
-    // 3. If x is NaN, return &quot;Invalid Date&quot;.
</del><span class="cx">     if (@isNaN(value))
</span><span class="cx">         return &quot;Invalid Date&quot;;
</span><span class="cx"> 
</span><del>-    // 4. Let options be ToDateTimeOptions(options, &quot;any&quot;, &quot;all&quot;).
-    // 5. ReturnIfAbrupt(options).
</del><span class="cx">     var options = toDateTimeOptionsAnyAll(arguments[1]);
</span><ins>+    var locales = arguments[0];
</ins><span class="cx"> 
</span><del>-    // 6. Let dateFormat be Construct(%DateTimeFormat%, «locales, options»).
-    // 7. ReturnIfAbrupt(dateFormat).
</del><ins>+    var dateFormat = new @DateTimeFormat(locales, options);
+    return dateFormat.format(value);
+}
+
+function toLocaleDateString(/* locales, options */)
+{
+    &quot;use strict&quot;;
+
+    function toDateTimeOptionsDateDate(opts)
+    {
+        // ToDateTimeOptions(options, &quot;date&quot;, &quot;date&quot;)
+        // http://www.ecma-international.org/ecma-402/2.0/#sec-InitializeDateTimeFormat
+
+        var options;
+        if (opts === undefined)
+            options = null;
+        else if (opts === null)
+            throw new @TypeError(&quot;null is not an object&quot;);
+        else
+            options = @Object(opts);
+
+        // Check original instead of descendant to reduce lookups up the prototype chain.
+        var needsDefaults = !options || (
+            options.weekday === undefined &amp;&amp;
+            options.year === undefined &amp;&amp;
+            options.month === undefined &amp;&amp;
+            options.day === undefined
+        );
+
+        // Only create descendant if it will have own properties.
+        if (needsDefaults) {
+            options = @Object.create(options)
+            options.year = &quot;numeric&quot;;
+            options.month = &quot;numeric&quot;;
+            options.day = &quot;numeric&quot;;
+        }
+
+        return options;
+    }
+
+    // 13.3.2 Date.prototype.toLocaleDateString ([locales [, options ]]) (ECMA-402 2.0)
+    // http://www.ecma-international.org/ecma-402/2.0/#sec-Date.prototype.toLocaleDateString
+
+    var value = @thisTimeValue.@call(this);
+    if (@isNaN(value))
+        return &quot;Invalid Date&quot;;
+
+    var options = toDateTimeOptionsDateDate(arguments[1]);
</ins><span class="cx">     var locales = arguments[0];
</span><ins>+
</ins><span class="cx">     var dateFormat = new @DateTimeFormat(locales, options);
</span><del>-
-    // 8. Return FormatDateTime(dateFormat, x).
</del><span class="cx">     return dateFormat.format(value);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeDatePrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp (195329 => 195330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp        2016-01-20 01:05:29 UTC (rev 195329)
+++ trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp        2016-01-20 01:07:34 UTC (rev 195330)
</span><span class="lines">@@ -493,6 +493,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INTL)
</span><span class="cx">     JSC_BUILTIN_FUNCTION(&quot;toLocaleString&quot;, datePrototypeToLocaleStringCodeGenerator, DontEnum);
</span><ins>+    JSC_BUILTIN_FUNCTION(&quot;toLocaleDateString&quot;, datePrototypeToLocaleDateStringCodeGenerator, DontEnum);
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(globalObject);
</span><span class="cx"> #endif // ENABLE(INTL)
</span></span></pre>
</div>
</div>

</body>
</html>