<!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>[193493] 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/193493">193493</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-12-04 17:14:03 -0800 (Fri, 04 Dec 2015)</dd>
</dl>

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

Patch by Andy VanWagoner &lt;thetalecrafter@gmail.com&gt; on 2015-12-04
Reviewed by Benjamin Poulain.

Source/JavaScriptCore:

Add toLocaleString in builtin JavaScript that delegates formatting to Intl.NumberFormat.
Keep exisiting native implementation for use if INTL flag is disabled.

* CMakeLists.txt: Add NumberPrototype.js.
* DerivedSources.make: Add NumberPrototype.js.
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/NumberPrototype.js: Added.
(toLocaleString):
* runtime/CommonIdentifiers.h: Add private names for Intl constructors.
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init): Expose Intl constructors to builtin js.
* runtime/NumberPrototype.cpp:
(JSC::NumberPrototype::finishCreation): Replace toLocaleString implementation.

LayoutTests:

Add tests for ECMA-402 Number.prototype.toLocaleString.
Since NumberFormat is not fully implemented, don't test locale-specific behavior yet.

* js/number-toLocaleString-expected.txt: Added.
* js/number-toLocaleString.html: Added.
* js/script-tests/number-toLocaleString.js: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreDerivedSourcesmake">trunk/Source/JavaScriptCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCommonIdentifiersh">trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeNumberPrototypecpp">trunk/Source/JavaScriptCore/runtime/NumberPrototype.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsnumbertoLocaleStringexpectedtxt">trunk/LayoutTests/js/number-toLocaleString-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsnumbertoLocaleStringhtml">trunk/LayoutTests/js/number-toLocaleString.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsnumbertoLocaleStringjs">trunk/LayoutTests/js/script-tests/number-toLocaleString.js</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsNumberPrototypejs">trunk/Source/JavaScriptCore/builtins/NumberPrototype.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (193492 => 193493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-12-05 01:06:50 UTC (rev 193492)
+++ trunk/LayoutTests/ChangeLog        2015-12-05 01:14:03 UTC (rev 193493)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-12-04  Andy VanWagoner  &lt;thetalecrafter@gmail.com&gt;
+
+        [INTL] Implement Number.prototype.toLocaleString in ECMA-402
+        https://bugs.webkit.org/show_bug.cgi?id=147610
+
+        Reviewed by Benjamin Poulain.
+
+        Add tests for ECMA-402 Number.prototype.toLocaleString.
+        Since NumberFormat is not fully implemented, don't test locale-specific behavior yet.
+
+        * js/number-toLocaleString-expected.txt: Added.
+        * js/number-toLocaleString.html: Added.
+        * js/script-tests/number-toLocaleString.js: Added.
+
</ins><span class="cx"> 2015-12-04  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Modern IDB: Flip test expectations around so we only list failures.
</span></span></pre></div>
<a id="trunkLayoutTestsjsnumbertoLocaleStringexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/number-toLocaleString-expected.txt (0 => 193493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/number-toLocaleString-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/number-toLocaleString-expected.txt        2015-12-05 01:14:03 UTC (rev 193493)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+This test checks the behavior of Number.prototype.toLocaleString as described in the ECMAScript Internationalization API Specification (ECMA-402 2.0).
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Number.prototype.toLocaleString.length is 0
+PASS Object.getOwnPropertyDescriptor(Number.prototype, 'toLocaleString').enumerable is false
+PASS Object.getOwnPropertyDescriptor(Number.prototype, 'toLocaleString').configurable is true
+PASS Object.getOwnPropertyDescriptor(Number.prototype, 'toLocaleString').writable is true
+PASS Number.prototype.toLocaleString.call(0) did not throw exception.
+PASS Number.prototype.toLocaleString.call(NaN) did not throw exception.
+PASS Number.prototype.toLocaleString.call(Infinity) did not throw exception.
+PASS Number.prototype.toLocaleString.call(new Number) did not throw exception.
+PASS Number.prototype.toLocaleString.call() threw exception TypeError: Number.prototype.toLocaleString called on incompatible undefined.
+PASS Number.prototype.toLocaleString.call(undefined) threw exception TypeError: Number.prototype.toLocaleString called on incompatible undefined.
+PASS Number.prototype.toLocaleString.call(null) threw exception TypeError: Number.prototype.toLocaleString called on incompatible object.
+PASS Number.prototype.toLocaleString.call('1') threw exception TypeError: Number.prototype.toLocaleString called on incompatible string.
+PASS Number.prototype.toLocaleString.call([]) threw exception TypeError: Number.prototype.toLocaleString called on incompatible object.
+PASS Number.prototype.toLocaleString.call(Symbol()) threw exception TypeError: Number.prototype.toLocaleString called on incompatible symbol.
+PASS (0).toLocaleString() is &quot;0&quot;
+PASS new Number(1).toLocaleString() is &quot;1&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsnumbertoLocaleStringhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/number-toLocaleString.html (0 => 193493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/number-toLocaleString.html                                (rev 0)
+++ trunk/LayoutTests/js/number-toLocaleString.html        2015-12-05 01:14:03 UTC (rev 193493)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/number-toLocaleString.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsnumbertoLocaleStringjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/number-toLocaleString.js (0 => 193493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/number-toLocaleString.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/number-toLocaleString.js        2015-12-05 01:14:03 UTC (rev 193493)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+description(&quot;This test checks the behavior of Number.prototype.toLocaleString as described in the ECMAScript Internationalization API Specification (ECMA-402 2.0).&quot;);
+
+shouldBe(&quot;Number.prototype.toLocaleString.length&quot;, &quot;0&quot;);
+shouldBeFalse(&quot;Object.getOwnPropertyDescriptor(Number.prototype, 'toLocaleString').enumerable&quot;);
+shouldBeTrue(&quot;Object.getOwnPropertyDescriptor(Number.prototype, 'toLocaleString').configurable&quot;);
+shouldBeTrue(&quot;Object.getOwnPropertyDescriptor(Number.prototype, 'toLocaleString').writable&quot;);
+
+// Test thisNumberValue abrupt completion.
+shouldNotThrow(&quot;Number.prototype.toLocaleString.call(0)&quot;);
+shouldNotThrow(&quot;Number.prototype.toLocaleString.call(NaN)&quot;);
+shouldNotThrow(&quot;Number.prototype.toLocaleString.call(Infinity)&quot;);
+shouldNotThrow(&quot;Number.prototype.toLocaleString.call(new Number)&quot;);
+shouldThrow(&quot;Number.prototype.toLocaleString.call()&quot;, &quot;'TypeError: Number.prototype.toLocaleString called on incompatible undefined'&quot;);
+shouldThrow(&quot;Number.prototype.toLocaleString.call(undefined)&quot;, &quot;'TypeError: Number.prototype.toLocaleString called on incompatible undefined'&quot;);
+shouldThrow(&quot;Number.prototype.toLocaleString.call(null)&quot;, &quot;'TypeError: Number.prototype.toLocaleString called on incompatible object'&quot;);
+shouldThrow(&quot;Number.prototype.toLocaleString.call('1')&quot;, &quot;'TypeError: Number.prototype.toLocaleString called on incompatible string'&quot;);
+shouldThrow(&quot;Number.prototype.toLocaleString.call([])&quot;, &quot;'TypeError: Number.prototype.toLocaleString called on incompatible object'&quot;);
+shouldThrow(&quot;Number.prototype.toLocaleString.call(Symbol())&quot;, &quot;'TypeError: Number.prototype.toLocaleString called on incompatible symbol'&quot;);
+
+shouldBeEqualToString(&quot;(0).toLocaleString()&quot;, &quot;0&quot;);
+shouldBeEqualToString(&quot;new Number(1).toLocaleString()&quot;, &quot;1&quot;);
+
+// FIXME: Test for NumberFormat behavior once implemented.
+// shouldThrow(&quot;(0).toLocaleString('i')&quot;);
+// shouldBeEqualToString(&quot;Infinity.toLocaleString()&quot;, &quot;∞&quot;);
+
+// Test that locale parameter is passed through properly.
+// shouldBeEqualToString(&quot;(123456.789).toLocaleString('ar')&quot;, &quot;١٢٣٤٥٦٫٧٨٩&quot;);
+// shouldBeEqualToString(&quot;(123456.789).toLocaleString('zh-Hans-CN-u-nu-hanidec')&quot;, &quot;一二三,四五六.七八九&quot;);
+
+// Test that options parameter is passed through properly.
+// shouldBeEqualToString(&quot;(123.456).toLocaleString('en', { maximumSignificantDigits: 3 })&quot;, &quot;123&quot;);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (193492 => 193493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2015-12-05 01:06:50 UTC (rev 193492)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2015-12-05 01:14:03 UTC (rev 193493)
</span><span class="lines">@@ -1225,6 +1225,7 @@
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/InternalPromiseConstructor.js
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/IteratorPrototype.js
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/ModuleLoaderObject.js
</span><ins>+    ${JAVASCRIPTCORE_DIR}/builtins/NumberPrototype.js
</ins><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/ObjectConstructor.js
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/PromiseConstructor.js
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/PromiseOperations.js
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (193492 => 193493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-12-05 01:06:50 UTC (rev 193492)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-12-05 01:14:03 UTC (rev 193493)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-12-04  Andy VanWagoner  &lt;thetalecrafter@gmail.com&gt;
+
+        [INTL] Implement Number.prototype.toLocaleString in ECMA-402
+        https://bugs.webkit.org/show_bug.cgi?id=147610
+
+        Reviewed by Benjamin Poulain.
+
+        Add toLocaleString in builtin JavaScript that delegates formatting to Intl.NumberFormat.
+        Keep exisiting native implementation for use if INTL flag is disabled.
+
+        * CMakeLists.txt: Add NumberPrototype.js.
+        * DerivedSources.make: Add NumberPrototype.js.
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * builtins/NumberPrototype.js: Added.
+        (toLocaleString):
+        * runtime/CommonIdentifiers.h: Add private names for Intl constructors.
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init): Expose Intl constructors to builtin js.
+        * runtime/NumberPrototype.cpp:
+        (JSC::NumberPrototype::finishCreation): Replace toLocaleString implementation.
+
</ins><span class="cx"> 2015-12-04  Michael Saboff  &lt;msaboff@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         CRASH: CodeBlock::setOptimizationThresholdBasedOnCompilationResult + 567
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/DerivedSources.make (193492 => 193493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/DerivedSources.make        2015-12-05 01:06:50 UTC (rev 193492)
+++ trunk/Source/JavaScriptCore/DerivedSources.make        2015-12-05 01:14:03 UTC (rev 193493)
</span><span class="lines">@@ -90,6 +90,7 @@
</span><span class="cx">     $(JavaScriptCore)/builtins/InternalPromiseConstructor.js \
</span><span class="cx">     $(JavaScriptCore)/builtins/IteratorPrototype.js \
</span><span class="cx">     $(JavaScriptCore)/builtins/ModuleLoaderObject.js \
</span><ins>+    $(JavaScriptCore)/builtins/NumberPrototype.js \
</ins><span class="cx">     $(JavaScriptCore)/builtins/ObjectConstructor.js \
</span><span class="cx">     $(JavaScriptCore)/builtins/PromiseConstructor.js \
</span><span class="cx">     $(JavaScriptCore)/builtins/PromiseOperations.js \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (193492 => 193493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2015-12-05 01:06:50 UTC (rev 193492)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2015-12-05 01:14:03 UTC (rev 193493)
</span><span class="lines">@@ -3606,6 +3606,7 @@
</span><span class="cx">                 A1587D6C1B4DC14100D69849 /* IntlDateTimeFormatPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntlDateTimeFormatPrototype.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A1587D731B4DC1C600D69849 /* IntlDateTimeFormatConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntlDateTimeFormatConstructor.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A1587D741B4DC1C600D69849 /* IntlDateTimeFormatPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntlDateTimeFormatPrototype.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                A15DE5C51C0FBF8D0089133D /* NumberPrototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = NumberPrototype.js; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A1712B3A11C7B212007A5315 /* RegExpCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpCache.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A1712B3E11C7B228007A5315 /* RegExpCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpCache.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A1712B4011C7B235007A5315 /* RegExpKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpKey.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -6666,6 +6667,7 @@
</span><span class="cx">                                 E33F50881B844A1A00413856 /* InternalPromiseConstructor.js */,
</span><span class="cx">                                 7CF9BC5B1B65D9A3009DB1EF /* IteratorPrototype.js */,
</span><span class="cx">                                 E30677971B8BC6F5003F87F0 /* ModuleLoaderObject.js */,
</span><ins>+                                A15DE5C51C0FBF8D0089133D /* NumberPrototype.js */,
</ins><span class="cx">                                 7CF9BC5C1B65D9B1009DB1EF /* ObjectConstructor.js */,
</span><span class="cx">                                 7CF9BC5D1B65D9B1009DB1EF /* PromiseOperations.js */,
</span><span class="cx">                                 7CFBAC1C18B535E500D00750 /* PromisePrototype.js */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsNumberPrototypejs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/builtins/NumberPrototype.js (0 => 193493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/NumberPrototype.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/builtins/NumberPrototype.js        2015-12-05 01:14:03 UTC (rev 193493)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+/*
+ * Copyright (C) 2015 Andy VanWagoner &lt;thetalecrafter@gmail.com&gt;.
+ *
+ * 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.
+ */
+
+// @conditional=ENABLE(INTL)
+
+function toLocaleString(/* locales, options */)
+{
+    &quot;use strict&quot;;
+
+    // 13.2.1 Number.prototype.toLocaleString ([locales [, options ]]) (ECMA-402 2.0)
+    // http://ecma-international.org/publications/standards/Ecma-402.htm
+
+    // 1. Let x be thisNumberValue(this value).
+    // 2. ReturnIfAbrupt(x).
+    var number = this;
+    if (!(typeof number === &quot;number&quot; || number instanceof Number))
+        throw new @TypeError(&quot;Number.prototype.toLocaleString called on incompatible &quot; + typeof number);
+
+    // 3. Let numberFormat be Construct(%NumberFormat%, «locales, options»).
+    // 4. ReturnIfAbrupt(numberFormat).
+    var numberFormat = new @NumberFormat(arguments[0], arguments[1]);
+
+    // 5. Return FormatNumber(numberFormat, x).
+    return numberFormat.format(number);
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCommonIdentifiersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h (193492 => 193493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2015-12-05 01:06:50 UTC (rev 193492)
+++ trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2015-12-05 01:14:03 UTC (rev 193493)
</span><span class="lines">@@ -338,6 +338,9 @@
</span><span class="cx">     macro(generatorValue) \
</span><span class="cx">     macro(generatorThis) \
</span><span class="cx">     macro(generatorResumeMode) \
</span><ins>+    macro(Collator) \
+    macro(DateTimeFormat) \
+    macro(NumberFormat) \
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (193492 => 193493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2015-12-05 01:06:50 UTC (rev 193492)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2015-12-05 01:14:03 UTC (rev 193493)
</span><span class="lines">@@ -468,7 +468,8 @@
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames-&gt;eval, m_evalFunction.get(), DontEnum);
</span><span class="cx">     
</span><span class="cx"> #if ENABLE(INTL)
</span><del>-    putDirectWithoutTransition(vm, vm.propertyNames-&gt;Intl, IntlObject::create(vm, this, IntlObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum);
</del><ins>+    IntlObject* intl = IntlObject::create(vm, this, IntlObject::createStructure(vm, this, m_objectPrototype.get()));
+    putDirectWithoutTransition(vm, vm.propertyNames-&gt;Intl, intl, DontEnum);
</ins><span class="cx"> #endif // ENABLE(INTL)
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames-&gt;JSON, JSONObject::create(vm, JSONObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum);
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames-&gt;Math, MathObject::create(vm, this, MathObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum);
</span><span class="lines">@@ -567,6 +568,11 @@
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;builtinNames().InspectorInstrumentationPrivateName(), InspectorInstrumentationObject::create(vm, this, InspectorInstrumentationObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;MapPrivateName, mapConstructor, DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;builtinNames().generatorResumePrivateName(), JSFunction::createBuiltinFunction(vm, generatorPrototypeGeneratorResumeCodeGenerator(vm), this), DontEnum | DontDelete | ReadOnly),
</span><ins>+#if ENABLE(INTL)
+        GlobalPropertyInfo(vm.propertyNames-&gt;builtinNames().CollatorPrivateName(), intl-&gt;getDirect(vm, vm.propertyNames-&gt;Collator), DontEnum | DontDelete | ReadOnly),
+        GlobalPropertyInfo(vm.propertyNames-&gt;builtinNames().DateTimeFormatPrivateName(), intl-&gt;getDirect(vm, vm.propertyNames-&gt;DateTimeFormat), DontEnum | DontDelete | ReadOnly),
+        GlobalPropertyInfo(vm.propertyNames-&gt;builtinNames().NumberFormatPrivateName(), intl-&gt;getDirect(vm, vm.propertyNames-&gt;NumberFormat), DontEnum | DontDelete | ReadOnly),
+#endif // ENABLE(INTL)
</ins><span class="cx">     };
</span><span class="cx">     addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeNumberPrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/NumberPrototype.cpp (193492 => 193493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/NumberPrototype.cpp        2015-12-05 01:06:50 UTC (rev 193492)
+++ trunk/Source/JavaScriptCore/runtime/NumberPrototype.cpp        2015-12-05 01:14:03 UTC (rev 193493)
</span><span class="lines">@@ -24,10 +24,11 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;BigInteger.h&quot;
</span><span class="cx"> #include &quot;Error.h&quot;
</span><ins>+#include &quot;JSCBuiltins.h&quot;
+#include &quot;JSCInlines.h&quot;
</ins><span class="cx"> #include &quot;JSFunction.h&quot;
</span><span class="cx"> #include &quot;JSGlobalObject.h&quot;
</span><span class="cx"> #include &quot;JSString.h&quot;
</span><del>-#include &quot;JSCInlines.h&quot;
</del><span class="cx"> #include &quot;Uint16WithFraction.h&quot;
</span><span class="cx"> #include &lt;wtf/dtoa.h&gt;
</span><span class="cx"> #include &lt;wtf/Assertions.h&gt;
</span><span class="lines">@@ -75,11 +76,15 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NumberPrototype::finishCreation(VM&amp; vm, JSGlobalObject*)
</del><ins>+void NumberPrototype::finishCreation(VM&amp; vm, JSGlobalObject* globalObject)
</ins><span class="cx"> {
</span><span class="cx">     Base::finishCreation(vm);
</span><span class="cx">     setInternalValue(vm, jsNumber(0));
</span><span class="cx"> 
</span><ins>+#if ENABLE(INTL)
+    JSC_BUILTIN_FUNCTION(&quot;toLocaleString&quot;, numberPrototypeToLocaleStringCodeGenerator, DontEnum);
+#endif // ENABLE(INTL)
+
</ins><span class="cx">     ASSERT(inherits(info()));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>