<!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>[174049] 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/174049">174049</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-09-28 18:52:42 -0700 (Sun, 28 Sep 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Simple ES6 feature: Number constructor extras
https://bugs.webkit.org/show_bug.cgi?id=131707
Patch by Diego Pino Garcia <dpino@igalia.com> on 2014-09-28
Reviewed by Darin Adler.
Source/JavaScriptCore:
* runtime/CommonIdentifiers.h:
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::finishCreation): Setup constants and
functions.
(JSC::numberConstructorFuncIsFinite): Added.
(JSC::numberConstructorFuncIsInteger): Added.
(JSC::numberConstructorFuncIsNaN): Added.
(JSC::numberConstructorFuncIsSafeInteger): Added.
(JSC::NumberConstructor::getOwnPropertySlot): Deleted.
(JSC::numberConstructorNaNValue): Deleted.
(JSC::numberConstructorNegInfinity): Deleted.
(JSC::numberConstructorPosInfinity): Deleted.
(JSC::numberConstructorMaxValue): Deleted.
(JSC::numberConstructorMinValue): Deleted.
* runtime/NumberConstructor.h:
LayoutTests:
* js/Object-getOwnPropertyNames-expected.txt:
* js/number-constructor-expected.txt: Added.
* js/number-constructor.html: Added.
* js/script-tests/Object-getOwnPropertyNames.js:
* js/script-tests/number-constructor.js: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsObjectgetOwnPropertyNamesexpectedtxt">trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsObjectgetOwnPropertyNamesjs">trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCommonIdentifiersh">trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeNumberConstructorcpp">trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeNumberConstructorh">trunk/Source/JavaScriptCore/runtime/NumberConstructor.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsnumberconstructorexpectedtxt">trunk/LayoutTests/js/number-constructor-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsnumberconstructorhtml">trunk/LayoutTests/js/number-constructor.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsnumberconstructorjs">trunk/LayoutTests/js/script-tests/number-constructor.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (174048 => 174049)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-09-29 01:18:30 UTC (rev 174048)
+++ trunk/LayoutTests/ChangeLog        2014-09-29 01:52:42 UTC (rev 174049)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-09-28 Diego Pino Garcia <dpino@igalia.com>
+
+ Simple ES6 feature: Number constructor extras
+ https://bugs.webkit.org/show_bug.cgi?id=131707
+
+ Reviewed by Darin Adler.
+
+ * js/Object-getOwnPropertyNames-expected.txt:
+ * js/number-constructor-expected.txt: Added.
+ * js/number-constructor.html: Added.
+ * js/script-tests/Object-getOwnPropertyNames.js:
+ * js/script-tests/number-constructor.js: Added.
+
</ins><span class="cx"> 2014-09-28 Sungmann Cho <sungmann.cho@navercorp.com>
</span><span class="cx">
</span><span class="cx"> Fix some minor typos: psuedo -> pseudo
</span></span></pre></div>
<a id="trunkLayoutTestsjsObjectgetOwnPropertyNamesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt (174048 => 174049)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt        2014-09-29 01:18:30 UTC (rev 174048)
+++ trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt        2014-09-29 01:52:42 UTC (rev 174049)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'contains', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'replace', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf']
</span><span class="cx"> PASS getSortedOwnPropertyNames(Boolean) is ['length', 'name', 'prototype']
</span><span class="cx"> PASS getSortedOwnPropertyNames(Boolean.prototype) is ['constructor', 'toString', 'valueOf']
</span><del>-PASS getSortedOwnPropertyNames(Number) is ['MAX_VALUE', 'MIN_VALUE', 'NEGATIVE_INFINITY', 'NaN', 'POSITIVE_INFINITY', 'length', 'name', 'prototype']
</del><ins>+PASS getSortedOwnPropertyNames(Number) is ['EPSILON', 'MAX_SAFE_INTEGER', 'MAX_VALUE', 'MIN_SAFE_INTEGER', 'MIN_VALUE', 'NEGATIVE_INFINITY', 'NaN', 'POSITIVE_INFINITY', 'isFinite', 'isInteger', 'isNaN', 'isSafeInteger', 'length', 'name', 'parseFloat', 'parseInt', 'prototype']
</ins><span class="cx"> PASS getSortedOwnPropertyNames(Number.prototype) is ['clz', 'constructor', 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision', 'toString', 'valueOf']
</span><span class="cx"> PASS getSortedOwnPropertyNames(Date) is ['UTC', 'length', 'name', 'now', 'parse', 'prototype']
</span><span class="cx"> PASS getSortedOwnPropertyNames(Date.prototype) is ['constructor', 'getDate', 'getDay', 'getFullYear', 'getHours', 'getMilliseconds', 'getMinutes', 'getMonth', 'getSeconds', 'getTime', 'getTimezoneOffset', 'getUTCDate', 'getUTCDay', 'getUTCFullYear', 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', 'getUTCSeconds', 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setYear', 'toDateString', 'toGMTString', 'toISOString', 'toJSON', 'toLocaleDateString', 'toLocaleString', 'toLocaleTimeString', 'toString', 'toTimeString', 'toUTCString', 'valueOf']
</span></span></pre></div>
<a id="trunkLayoutTestsjsnumberconstructorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/number-constructor-expected.txt (0 => 174049)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/number-constructor-expected.txt         (rev 0)
+++ trunk/LayoutTests/js/number-constructor-expected.txt        2014-09-29 01:52:42 UTC (rev 174049)
</span><span class="lines">@@ -0,0 +1,156 @@
</span><ins>+This test case tests the Number constructor.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Number.isFinite(0) is true
+PASS Number.isFinite(-0) is true
+PASS Number.isFinite(1) is true
+PASS Number.isFinite(-1) is true
+PASS Number.isFinite(1.0) is true
+PASS Number.isFinite(1.1) is true
+PASS Number.isFinite(-1.0) is true
+PASS Number.isFinite(-1.1) is true
+PASS Number.isFinite(Number.MAX_SAFE_INTEGER) is true
+PASS Number.isFinite(Number.MIN_SAFE_INTEGER) is true
+PASS Number.isFinite(Number.MAX_VALUE) is true
+PASS Number.isFinite(Number.MIN_VALUE) is true
+PASS Number.isFinite() is false
+PASS Number.isFinite({}) is false
+PASS Number.isFinite([]) is false
+PASS Number.isFinite(true) is false
+PASS Number.isFinite(false) is false
+PASS Number.isFinite(null) is false
+PASS Number.isFinite(Number.NaN) is false
+PASS Number.isFinite(Number.POSITIVE_INFINITY) is false
+PASS Number.isFinite(Number.NEGATIVE_INFINITY) is false
+PASS Number.isFinite(foo) threw exception ReferenceError: Can't find variable: foo.
+PASS Number.isInteger(0) is true
+PASS Number.isInteger(-0) is true
+PASS Number.isInteger(1) is true
+PASS Number.isInteger(-1) is true
+PASS Number.isInteger(1.0) is true
+PASS Number.isInteger(-1.0) is true
+PASS Number.isInteger(Number.MAX_SAFE_INTEGER) is true
+PASS Number.isInteger(Number.MIN_SAFE_INTEGER) is true
+PASS Number.isInteger(Number.MAX_VALUE) is true
+PASS Number.isInteger(Number.MIN_VALUE) is false
+PASS Number.isInteger(1.1) is false
+PASS Number.isInteger(-1.1) is false
+PASS Number.isInteger() is false
+PASS Number.isInteger({}) is false
+PASS Number.isInteger([]) is false
+PASS Number.isInteger(true) is false
+PASS Number.isInteger(false) is false
+PASS Number.isInteger(null) is false
+PASS Number.isInteger(Number.NaN) is false
+PASS Number.isInteger(Number.POSITIVE_INFINITY) is false
+PASS Number.isInteger(Number.NEGATIVE_INFINITY) is false
+PASS Number.isInteger(foo) threw exception ReferenceError: Can't find variable: foo.
+PASS Number.isNaN(Number.NaN) is true
+PASS Number.isNaN(0) is false
+PASS Number.isNaN(-0) is false
+PASS Number.isNaN(1) is false
+PASS Number.isNaN(-1) is false
+PASS Number.isNaN(1.0) is false
+PASS Number.isNaN(1.1) is false
+PASS Number.isNaN(-1.0) is false
+PASS Number.isNaN(-1.1) is false
+PASS Number.isNaN() is false
+PASS Number.isNaN({}) is false
+PASS Number.isNaN([]) is false
+PASS Number.isNaN(true) is false
+PASS Number.isNaN(false) is false
+PASS Number.isNaN(null) is false
+PASS Number.isNaN(Number.POSITIVE_INFINITY) is false
+PASS Number.isNaN(Number.NEGATIVE_INFINITY) is false
+PASS Number.isNaN(Number.MAX_SAFE_INTEGER) is false
+PASS Number.isNaN(Number.MIN_SAFE_INTEGER) is false
+PASS Number.isNaN(Number.MAX_VALUE) is false
+PASS Number.isNaN(Number.MIN_VALUE) is false
+PASS Number.isNaN(foo) threw exception ReferenceError: Can't find variable: foo.
+PASS Number.isSafeInteger(0) is true
+PASS Number.isSafeInteger(-0) is true
+PASS Number.isSafeInteger(1) is true
+PASS Number.isSafeInteger(-1) is true
+PASS Number.isSafeInteger(1.0) is true
+PASS Number.isSafeInteger(-1.0) is true
+PASS Number.isSafeInteger(Number.MAX_SAFE_INTEGER) is true
+PASS Number.isSafeInteger(Number.MAX_SAFE_INTEGER - 1) is true
+PASS Number.isSafeInteger(Number.MIN_SAFE_INTEGER) is true
+PASS Number.isSafeInteger(Number.MIN_SAFE_INTEGER + 1) is true
+PASS Number.isSafeInteger(1.1) is false
+PASS Number.isSafeInteger(-1.1) is false
+PASS Number.isSafeInteger() is false
+PASS Number.isSafeInteger({}) is false
+PASS Number.isSafeInteger([]) is false
+PASS Number.isSafeInteger(true) is false
+PASS Number.isSafeInteger(false) is false
+PASS Number.isSafeInteger(null) is false
+PASS Number.isSafeInteger(Number.NaN) is false
+PASS Number.isSafeInteger(Number.MAX_VALUE) is false
+PASS Number.isSafeInteger(Number.MIN_VALUE) is false
+PASS Number.isSafeInteger(Number.POSITIVE_INFINITY) is false
+PASS Number.isSafeInteger(Number.NEGATIVE_INFINITY) is false
+PASS Number.isSafeInteger(Number.MAX_SAFE_INTEGER + 1) is false
+PASS Number.isSafeInteger(Number.MIN_SAFE_INTEGER - 1) is false
+PASS Number.isSafeInteger(foo) threw exception ReferenceError: Can't find variable: foo.
+PASS Number.parseFloat("0") is 0
+PASS Number.parseFloat("-0") is -0
+PASS Number.parseFloat("1") is 1
+PASS Number.parseFloat("-1") is -1
+PASS Number.parseFloat("1.1") is 1.1
+PASS Number.parseFloat("-1.1") is -1.1
+PASS Number.parseFloat("10E6") is 10E6
+PASS Number.parseFloat("0xA") is 0
+PASS Number.parseFloat("050") is 50
+PASS Number.parseFloat(050) is 40
+PASS Number.parseFloat("0x20") is 0
+PASS Number.parseFloat(0x20) is 32
+PASS Number.parseFloat() is NaN
+PASS Number.parseFloat({}) is NaN
+PASS Number.parseFloat([]) is NaN
+PASS Number.parseFloat(true) is NaN
+PASS Number.parseFloat(false) is NaN
+PASS Number.parseFloat(null) is NaN
+PASS Number.parseFloat(Number.NaN) is NaN
+PASS Number.parseFloat("1.7976931348623157E308") is 1.7976931348623157e+308
+PASS Number.parseFloat("1.80E308") is Infinity
+PASS Number.parseFloat("5E-324") is 5e-324
+PASS Number.parseFloat("5E-325") is 0
+PASS Number.parseFloat("20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") is 2e+307
+PASS Number.parseFloat("200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") is Infinity
+PASS Number.parseFloat(foo) threw exception ReferenceError: Can't find variable: foo.
+PASS Number.parseInt("0") is 0
+PASS Number.parseInt("-0") is -0
+PASS Number.parseInt("1") is 1
+PASS Number.parseInt("-1") is -1
+PASS Number.parseInt("1.1") is 1
+PASS Number.parseInt("-1.1") is -1
+PASS Number.parseInt("10E6") is 10
+PASS Number.parseInt("0xA") is 10
+PASS Number.parseInt("050") is 50
+PASS Number.parseInt("050", 8) is 40
+PASS Number.parseInt(050) is 40
+PASS Number.parseInt("0x20") is 32
+PASS Number.parseInt("0x20", 16) is 32
+PASS Number.parseInt("20", 16) is 32
+PASS Number.parseInt(0x20) is 32
+PASS Number.parseInt() is NaN
+PASS Number.parseInt({}) is NaN
+PASS Number.parseInt([]) is NaN
+PASS Number.parseInt(true) is NaN
+PASS Number.parseInt(false) is NaN
+PASS Number.parseInt(null) is NaN
+PASS Number.parseInt(Number.NaN) is NaN
+PASS Number.parseInt("1.7976931348623157E308") is 1
+PASS Number.parseInt("1.80E308") is 1
+PASS Number.parseInt("5E-324") is 5
+PASS Number.parseInt("5E-325") is 5
+PASS Number.parseInt("20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") is 2e+307
+PASS Number.parseInt("200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") is Infinity
+PASS Number.parseInt(foo) threw exception ReferenceError: Can't find variable: foo.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsnumberconstructorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/number-constructor.html (0 => 174049)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/number-constructor.html         (rev 0)
+++ trunk/LayoutTests/js/number-constructor.html        2014-09-29 01:52:42 UTC (rev 174049)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <script src="../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script src="script-tests/number-constructor.js"></script>
+ <script src="../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsObjectgetOwnPropertyNamesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js (174048 => 174049)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js        2014-09-29 01:18:30 UTC (rev 174048)
+++ trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js        2014-09-29 01:52:42 UTC (rev 174049)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx"> "String.prototype": "['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'contains', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'replace', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf']",
</span><span class="cx"> "Boolean": "['length', 'name', 'prototype']",
</span><span class="cx"> "Boolean.prototype": "['constructor', 'toString', 'valueOf']",
</span><del>- "Number": "['MAX_VALUE', 'MIN_VALUE', 'NEGATIVE_INFINITY', 'NaN', 'POSITIVE_INFINITY', 'length', 'name', 'prototype']",
</del><ins>+ "Number": "['EPSILON', 'MAX_SAFE_INTEGER', 'MAX_VALUE', 'MIN_SAFE_INTEGER', 'MIN_VALUE', 'NEGATIVE_INFINITY', 'NaN', 'POSITIVE_INFINITY', 'isFinite', 'isInteger', 'isNaN', 'isSafeInteger', 'length', 'name', 'parseFloat', 'parseInt', 'prototype']",
</ins><span class="cx"> "Number.prototype": "['clz', 'constructor', 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision', 'toString', 'valueOf']",
</span><span class="cx"> "Date": "['UTC', 'length', 'name', 'now', 'parse', 'prototype']",
</span><span class="cx"> "Date.prototype": "['constructor', 'getDate', 'getDay', 'getFullYear', 'getHours', 'getMilliseconds', 'getMinutes', 'getMonth', 'getSeconds', 'getTime', 'getTimezoneOffset', 'getUTCDate', 'getUTCDay', 'getUTCFullYear', 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', 'getUTCSeconds', 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setYear', 'toDateString', 'toGMTString', 'toISOString', 'toJSON', 'toLocaleDateString', 'toLocaleString', 'toLocaleTimeString', 'toString', 'toTimeString', 'toUTCString', 'valueOf']",
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsnumberconstructorjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/number-constructor.js (0 => 174049)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/number-constructor.js         (rev 0)
+++ trunk/LayoutTests/js/script-tests/number-constructor.js        2014-09-29 01:52:42 UTC (rev 174049)
</span><span class="lines">@@ -0,0 +1,160 @@
</span><ins>+description('This test case tests the Number constructor.');
+
+// isFinite
+shouldBeTrue('Number.isFinite(0)');
+shouldBeTrue('Number.isFinite(-0)');
+shouldBeTrue('Number.isFinite(1)');
+shouldBeTrue('Number.isFinite(-1)');
+shouldBeTrue('Number.isFinite(1.0)');
+shouldBeTrue('Number.isFinite(1.1)');
+shouldBeTrue('Number.isFinite(-1.0)');
+shouldBeTrue('Number.isFinite(-1.1)');
+shouldBeTrue('Number.isFinite(Number.MAX_SAFE_INTEGER)');
+shouldBeTrue('Number.isFinite(Number.MIN_SAFE_INTEGER)');
+shouldBeTrue('Number.isFinite(Number.MAX_VALUE)');
+shouldBeTrue('Number.isFinite(Number.MIN_VALUE)');
+shouldBeFalse('Number.isFinite()');
+shouldBeFalse('Number.isFinite({})');
+shouldBeFalse('Number.isFinite([])');
+shouldBeFalse('Number.isFinite(true)');
+shouldBeFalse('Number.isFinite(false)');
+shouldBeFalse('Number.isFinite(null)');
+shouldBeFalse('Number.isFinite(Number.NaN)');
+shouldBeFalse('Number.isFinite(Number.POSITIVE_INFINITY)');
+shouldBeFalse('Number.isFinite(Number.NEGATIVE_INFINITY)');
+shouldThrow('Number.isFinite(foo)');
+
+// isInteger
+shouldBeTrue('Number.isInteger(0)');
+shouldBeTrue('Number.isInteger(-0)');
+shouldBeTrue('Number.isInteger(1)');
+shouldBeTrue('Number.isInteger(-1)');
+shouldBeTrue('Number.isInteger(1.0)');
+shouldBeTrue('Number.isInteger(-1.0)');
+shouldBeTrue('Number.isInteger(Number.MAX_SAFE_INTEGER)');
+shouldBeTrue('Number.isInteger(Number.MIN_SAFE_INTEGER)');
+shouldBeTrue('Number.isInteger(Number.MAX_VALUE)');
+shouldBeFalse('Number.isInteger(Number.MIN_VALUE)');
+shouldBeFalse('Number.isInteger(1.1)');
+shouldBeFalse('Number.isInteger(-1.1)');
+shouldBeFalse('Number.isInteger()');
+shouldBeFalse('Number.isInteger({})');
+shouldBeFalse('Number.isInteger([])');
+shouldBeFalse('Number.isInteger(true)');
+shouldBeFalse('Number.isInteger(false)');
+shouldBeFalse('Number.isInteger(null)');
+shouldBeFalse('Number.isInteger(Number.NaN)');
+shouldBeFalse('Number.isInteger(Number.POSITIVE_INFINITY)');
+shouldBeFalse('Number.isInteger(Number.NEGATIVE_INFINITY)');
+shouldThrow('Number.isInteger(foo)');
+
+// isNaN
+shouldBeTrue('Number.isNaN(Number.NaN)');
+shouldBeFalse('Number.isNaN(0)');
+shouldBeFalse('Number.isNaN(-0)');
+shouldBeFalse('Number.isNaN(1)');
+shouldBeFalse('Number.isNaN(-1)');
+shouldBeFalse('Number.isNaN(1.0)');
+shouldBeFalse('Number.isNaN(1.1)');
+shouldBeFalse('Number.isNaN(-1.0)');
+shouldBeFalse('Number.isNaN(-1.1)');
+shouldBeFalse('Number.isNaN()');
+shouldBeFalse('Number.isNaN({})');
+shouldBeFalse('Number.isNaN([])');
+shouldBeFalse('Number.isNaN(true)');
+shouldBeFalse('Number.isNaN(false)');
+shouldBeFalse('Number.isNaN(null)');
+shouldBeFalse('Number.isNaN(Number.POSITIVE_INFINITY)');
+shouldBeFalse('Number.isNaN(Number.NEGATIVE_INFINITY)');
+shouldBeFalse('Number.isNaN(Number.MAX_SAFE_INTEGER)');
+shouldBeFalse('Number.isNaN(Number.MIN_SAFE_INTEGER)');
+shouldBeFalse('Number.isNaN(Number.MAX_VALUE)');
+shouldBeFalse('Number.isNaN(Number.MIN_VALUE)');
+shouldThrow('Number.isNaN(foo)');
+
+// isSafeInteger
+shouldBeTrue('Number.isSafeInteger(0)');
+shouldBeTrue('Number.isSafeInteger(-0)');
+shouldBeTrue('Number.isSafeInteger(1)');
+shouldBeTrue('Number.isSafeInteger(-1)');
+shouldBeTrue('Number.isSafeInteger(1.0)');
+shouldBeTrue('Number.isSafeInteger(-1.0)');
+shouldBeTrue('Number.isSafeInteger(Number.MAX_SAFE_INTEGER)');
+shouldBeTrue('Number.isSafeInteger(Number.MAX_SAFE_INTEGER - 1)');
+shouldBeTrue('Number.isSafeInteger(Number.MIN_SAFE_INTEGER)');
+shouldBeTrue('Number.isSafeInteger(Number.MIN_SAFE_INTEGER + 1)');
+shouldBeFalse('Number.isSafeInteger(1.1)');
+shouldBeFalse('Number.isSafeInteger(-1.1)');
+shouldBeFalse('Number.isSafeInteger()');
+shouldBeFalse('Number.isSafeInteger({})');
+shouldBeFalse('Number.isSafeInteger([])');
+shouldBeFalse('Number.isSafeInteger(true)');
+shouldBeFalse('Number.isSafeInteger(false)');
+shouldBeFalse('Number.isSafeInteger(null)');
+shouldBeFalse('Number.isSafeInteger(Number.NaN)');
+shouldBeFalse('Number.isSafeInteger(Number.MAX_VALUE)');
+shouldBeFalse('Number.isSafeInteger(Number.MIN_VALUE)');
+shouldBeFalse('Number.isSafeInteger(Number.POSITIVE_INFINITY)');
+shouldBeFalse('Number.isSafeInteger(Number.NEGATIVE_INFINITY)');
+shouldBeFalse('Number.isSafeInteger(Number.MAX_SAFE_INTEGER + 1)');
+shouldBeFalse('Number.isSafeInteger(Number.MIN_SAFE_INTEGER - 1)');
+shouldThrow('Number.isSafeInteger(foo)');
+
+// parseFloat
+shouldBe('Number.parseFloat("0")', '0');
+shouldBe('Number.parseFloat("-0")', '-0');
+shouldBe('Number.parseFloat("1")', '1');
+shouldBe('Number.parseFloat("-1")', '-1');
+shouldBe('Number.parseFloat("1.1")', '1.1');
+shouldBe('Number.parseFloat("-1.1")', '-1.1');
+shouldBe('Number.parseFloat("10E6")', '10E6');
+shouldBe('Number.parseFloat("0xA")', '0');
+shouldBe('Number.parseFloat("050")', '50');
+shouldBe('Number.parseFloat(050)', '40');
+shouldBe('Number.parseFloat("0x20")', '0');
+shouldBe('Number.parseFloat(0x20)', '32');
+shouldBe('Number.parseFloat()', 'NaN');
+shouldBe('Number.parseFloat({})', 'NaN');
+shouldBe('Number.parseFloat([])', 'NaN');
+shouldBe('Number.parseFloat(true)', 'NaN');
+shouldBe('Number.parseFloat(false)', 'NaN');
+shouldBe('Number.parseFloat(null)', 'NaN');
+shouldBe('Number.parseFloat(Number.NaN)', 'NaN');
+shouldBe('Number.parseFloat("1.7976931348623157E308")', '1.7976931348623157e+308');
+shouldBe('Number.parseFloat("1.80E308")', "Infinity");
+shouldBe('Number.parseFloat("5E-324")', '5e-324');
+shouldBe('Number.parseFloat("5E-325")', '0');
+shouldBe('Number.parseFloat("20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")', '2e+307');
+shouldBe('Number.parseFloat("200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")', 'Infinity');
+shouldThrow('Number.parseFloat(foo)');
+
+// parseInt
+shouldBe('Number.parseInt("0")', '0');
+shouldBe('Number.parseInt("-0")', '-0');
+shouldBe('Number.parseInt("1")', '1');
+shouldBe('Number.parseInt("-1")', '-1');
+shouldBe('Number.parseInt("1.1")', '1');
+shouldBe('Number.parseInt("-1.1")', '-1');
+shouldBe('Number.parseInt("10E6")', '10');
+shouldBe('Number.parseInt("0xA")', '10');
+shouldBe('Number.parseInt("050")', '50');
+shouldBe('Number.parseInt("050", 8)', '40');
+shouldBe('Number.parseInt(050)', '40');
+shouldBe('Number.parseInt("0x20")', '32');
+shouldBe('Number.parseInt("0x20", 16)', '32');
+shouldBe('Number.parseInt("20", 16)', '32');
+shouldBe('Number.parseInt(0x20)', '32');
+shouldBe('Number.parseInt()', 'NaN');
+shouldBe('Number.parseInt({})', 'NaN');
+shouldBe('Number.parseInt([])', 'NaN');
+shouldBe('Number.parseInt(true)', 'NaN');
+shouldBe('Number.parseInt(false)', 'NaN');
+shouldBe('Number.parseInt(null)', 'NaN');
+shouldBe('Number.parseInt(Number.NaN)', 'NaN');
+shouldBe('Number.parseInt("1.7976931348623157E308")', '1');
+shouldBe('Number.parseInt("1.80E308")', '1');
+shouldBe('Number.parseInt("5E-324")', '5');
+shouldBe('Number.parseInt("5E-325")', '5');
+shouldBe('Number.parseInt("20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")', '2e+307');
+shouldBe('Number.parseInt("200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")', 'Infinity');
+shouldThrow('Number.parseInt(foo)');
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (174048 => 174049)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-09-29 01:18:30 UTC (rev 174048)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-09-29 01:52:42 UTC (rev 174049)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-09-28 Diego Pino Garcia <dpino@igalia.com>
+
+ Simple ES6 feature: Number constructor extras
+ https://bugs.webkit.org/show_bug.cgi?id=131707
+
+ Reviewed by Darin Adler.
+
+ * runtime/CommonIdentifiers.h:
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::finishCreation): Setup constants and
+ functions.
+ (JSC::numberConstructorFuncIsFinite): Added.
+ (JSC::numberConstructorFuncIsInteger): Added.
+ (JSC::numberConstructorFuncIsNaN): Added.
+ (JSC::numberConstructorFuncIsSafeInteger): Added.
+ (JSC::NumberConstructor::getOwnPropertySlot): Deleted.
+ (JSC::numberConstructorNaNValue): Deleted.
+ (JSC::numberConstructorNegInfinity): Deleted.
+ (JSC::numberConstructorPosInfinity): Deleted.
+ (JSC::numberConstructorMaxValue): Deleted.
+ (JSC::numberConstructorMinValue): Deleted.
+ * runtime/NumberConstructor.h:
+
</ins><span class="cx"> 2014-09-26 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> Disable function.arguments
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCommonIdentifiersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h (174048 => 174049)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2014-09-29 01:18:30 UTC (rev 174048)
+++ trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2014-09-29 01:52:42 UTC (rev 174049)
</span><span class="lines">@@ -118,7 +118,11 @@
</span><span class="cx"> macro(input) \
</span><span class="cx"> macro(instructionCount) \
</span><span class="cx"> macro(isArray) \
</span><ins>+ macro(isFinite) \
+ macro(isInteger) \
+ macro(isNaN) \
</ins><span class="cx"> macro(isPrototypeOf) \
</span><ins>+ macro(isSafeInteger) \
</ins><span class="cx"> macro(isView) \
</span><span class="cx"> macro(isWatchpoint) \
</span><span class="cx"> macro(jettisonReason) \
</span><span class="lines">@@ -140,6 +144,8 @@
</span><span class="cx"> macro(osrExitSites) \
</span><span class="cx"> macro(osrExits) \
</span><span class="cx"> macro(parse) \
</span><ins>+ macro(parseFloat) \
+ macro(parseInt) \
</ins><span class="cx"> macro(postMessage) \
</span><span class="cx"> macro(profiledBytecodes) \
</span><span class="cx"> macro(propertyIsEnumerable) \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeNumberConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp (174048 => 174049)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp        2014-09-29 01:18:30 UTC (rev 174048)
+++ trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp        2014-09-29 01:52:42 UTC (rev 174049)
</span><span class="lines">@@ -26,35 +26,23 @@
</span><span class="cx"> #include "NumberObject.h"
</span><span class="cx"> #include "NumberPrototype.h"
</span><span class="cx"> #include "JSCInlines.h"
</span><ins>+#include "JSGlobalObjectFunctions.h"
</ins><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><del>-static EncodedJSValue numberConstructorNaNValue(ExecState*, JSObject*, EncodedJSValue, PropertyName);
-static EncodedJSValue numberConstructorNegInfinity(ExecState*, JSObject*, EncodedJSValue, PropertyName);
-static EncodedJSValue numberConstructorPosInfinity(ExecState*, JSObject*, EncodedJSValue, PropertyName);
-static EncodedJSValue numberConstructorMaxValue(ExecState*, JSObject*, EncodedJSValue, PropertyName);
-static EncodedJSValue numberConstructorMinValue(ExecState*, JSObject*, EncodedJSValue, PropertyName);
</del><ins>+static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsFinite(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsInteger(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsNaN(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsSafeInteger(ExecState*);
</ins><span class="cx">
</span><span class="cx"> } // namespace JSC
</span><span class="cx">
</span><del>-#include "NumberConstructor.lut.h"
-
</del><span class="cx"> namespace JSC {
</span><span class="cx">
</span><span class="cx"> STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(NumberConstructor);
</span><span class="cx">
</span><del>-const ClassInfo NumberConstructor::s_info = { "Function", &InternalFunction::s_info, &numberConstructorTable, CREATE_METHOD_TABLE(NumberConstructor) };
</del><ins>+const ClassInfo NumberConstructor::s_info = { "Function", &InternalFunction::s_info, 0, CREATE_METHOD_TABLE(NumberConstructor) };
</ins><span class="cx">
</span><del>-/* Source for NumberConstructor.lut.h
-@begin numberConstructorTable
- NaN numberConstructorNaNValue DontEnum|DontDelete|ReadOnly
- NEGATIVE_INFINITY numberConstructorNegInfinity DontEnum|DontDelete|ReadOnly
- POSITIVE_INFINITY numberConstructorPosInfinity DontEnum|DontDelete|ReadOnly
- MAX_VALUE numberConstructorMaxValue DontEnum|DontDelete|ReadOnly
- MIN_VALUE numberConstructorMinValue DontEnum|DontDelete|ReadOnly
-@end
-*/
-
</del><span class="cx"> NumberConstructor::NumberConstructor(VM& vm, Structure* structure)
</span><span class="cx"> : InternalFunction(vm, structure)
</span><span class="cx"> {
</span><span class="lines">@@ -70,38 +58,24 @@
</span><span class="cx">
</span><span class="cx"> // no. of arguments for constructor
</span><span class="cx"> putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
</span><del>-}
</del><span class="cx">
</span><del>-bool NumberConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
-{
- return getStaticValueSlot<NumberConstructor, InternalFunction>(exec, numberConstructorTable, jsCast<NumberConstructor*>(object), propertyName, slot);
-}
</del><ins>+ putDirectWithoutTransition(vm, Identifier(&vm, "EPSILON"), jsDoubleNumber(std::numeric_limits<double>::epsilon()), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(vm, Identifier(&vm, "MAX_VALUE"), jsDoubleNumber(1.7976931348623157E+308), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(vm, Identifier(&vm, "MIN_VALUE"), jsDoubleNumber(5E-324), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(vm, Identifier(&vm, "MAX_SAFE_INTEGER"), jsDoubleNumber(9007199254740991.0), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(vm, Identifier(&vm, "MIN_SAFE_INTEGER"), jsDoubleNumber(-9007199254740991.0), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(vm, Identifier(&vm, "NEGATIVE_INFINITY"), jsDoubleNumber(-std::numeric_limits<double>::infinity()), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(vm, Identifier(&vm, "POSITIVE_INFINITY"), jsDoubleNumber(std::numeric_limits<double>::infinity()), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(vm, Identifier(&vm, "NaN"), jsNaN(), DontDelete | DontEnum | ReadOnly);
</ins><span class="cx">
</span><del>-static EncodedJSValue numberConstructorNaNValue(ExecState*, JSObject*, EncodedJSValue, PropertyName)
-{
- return JSValue::encode(jsNaN());
</del><ins>+ putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier(&vm, "isFinite"), 1, numberConstructorFuncIsFinite, NoIntrinsic, DontEnum | Function);
+ putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier(&vm, "isInteger"), 1, numberConstructorFuncIsInteger, NoIntrinsic, DontEnum | Function);
+ putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier(&vm, "isNaN"), 1, numberConstructorFuncIsNaN, NoIntrinsic, DontEnum | Function);
+ putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier(&vm, "isSafeInteger"), 1, numberConstructorFuncIsSafeInteger, NoIntrinsic, DontEnum | Function);
+ putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier(&vm, "parseFloat"), 1, globalFuncParseFloat, NoIntrinsic, DontEnum | Function);
+ putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier(&vm, "parseInt"), 1, globalFuncParseInt, NoIntrinsic, DontEnum | Function);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static EncodedJSValue numberConstructorNegInfinity(ExecState*, JSObject*, EncodedJSValue, PropertyName)
-{
- return JSValue::encode(jsNumber(-std::numeric_limits<double>::infinity()));
-}
-
-static EncodedJSValue numberConstructorPosInfinity(ExecState*, JSObject*, EncodedJSValue, PropertyName)
-{
- return JSValue::encode(jsNumber(std::numeric_limits<double>::infinity()));
-}
-
-static EncodedJSValue numberConstructorMaxValue(ExecState*, JSObject*, EncodedJSValue, PropertyName)
-{
- return JSValue::encode(jsNumber(1.7976931348623157E+308));
-}
-
-static EncodedJSValue numberConstructorMinValue(ExecState*, JSObject*, EncodedJSValue, PropertyName)
-{
- return JSValue::encode(jsNumber(5E-324));
-}
-
</del><span class="cx"> // ECMA 15.7.1
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL constructWithNumberConstructor(ExecState* exec)
</span><span class="cx"> {
</span><span class="lines">@@ -129,4 +103,50 @@
</span><span class="cx"> return CallTypeHost;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// ECMA-262 20.1.2.2
+static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsFinite(ExecState* exec)
+{
+ JSValue argument = exec->argument(0);
+ return JSValue::encode(jsBoolean(argument.isNumber() && (argument.isInt32() || std::isfinite(argument.asDouble()))));
+}
+
+// ECMA-262 20.1.2.3
+static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsInteger(ExecState* exec)
+{
+ JSValue argument = exec->argument(0);
+ bool isInteger;
+ if (argument.isInt32())
+ isInteger = true;
+ else if (!argument.isDouble())
+ isInteger = false;
+ else {
+ double number = argument.asDouble();
+ isInteger = std::isfinite(number) && trunc(number) == number;
+ }
+ return JSValue::encode(jsBoolean(isInteger));
+}
+
+// ECMA-262 20.1.2.4
+static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsNaN(ExecState* exec)
+{
+ JSValue argument = exec->argument(0);
+ return JSValue::encode(jsBoolean(argument.isDouble() && std::isnan(argument.asDouble())));
+}
+
+// ECMA-262 20.1.2.5
+static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsSafeInteger(ExecState* exec)
+{
+ JSValue argument = exec->argument(0);
+ bool isInteger;
+ if (argument.isInt32())
+ isInteger = true;
+ else if (!argument.isDouble())
+ isInteger = false;
+ else {
+ double number = argument.asDouble();
+ isInteger = trunc(number) == number && std::abs(number) <= 9007199254740991.0;
+ }
+ return JSValue::encode(jsBoolean(isInteger));
+}
+
</ins><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeNumberConstructorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/NumberConstructor.h (174048 => 174049)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/NumberConstructor.h        2014-09-29 01:18:30 UTC (rev 174048)
+++ trunk/Source/JavaScriptCore/runtime/NumberConstructor.h        2014-09-29 01:52:42 UTC (rev 174049)
</span><span class="lines">@@ -38,9 +38,6 @@
</span><span class="cx"> return constructor;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
- JSValue getValueProperty(ExecState*, int token) const;
-
</del><span class="cx"> DECLARE_INFO;
</span><span class="cx">
</span><span class="cx"> static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
</span><span class="lines">@@ -48,8 +45,6 @@
</span><span class="cx"> return Structure::create(vm, globalObject, proto, TypeInfo(ObjectType, StructureFlags), info());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
-
</del><span class="cx"> protected:
</span><span class="cx"> void finishCreation(VM&, NumberPrototype*);
</span><span class="cx"> static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
</span></span></pre>
</div>
</div>
</body>
</html>