Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: src/v8natives.js

Issue 990883002: Hide Math function implementations in a closure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove printf and unnecessary test case change. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/typedarray.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file relies on the fact that the following declarations have been made 5 // This file relies on the fact that the following declarations have been made
6 // in runtime.js: 6 // in runtime.js:
7 // var $Object = global.Object; 7 // var $Object = global.Object;
8 // var $Boolean = global.Boolean; 8 // var $Boolean = global.Boolean;
9 // var $Number = global.Number; 9 // var $Number = global.Number;
10 // var $Function = global.Function; 10 // var $Function = global.Function;
11 // var $Array = global.Array; 11 // var $Array = global.Array;
12 //
13 // in math.js:
14 // var $floor = MathFloor
15 12
16 var $isNaN = GlobalIsNaN; 13 var $isNaN = GlobalIsNaN;
17 var $isFinite = GlobalIsFinite; 14 var $isFinite = GlobalIsFinite;
18 15
19 // ---------------------------------------------------------------------------- 16 // ----------------------------------------------------------------------------
20 17
21 // Helper function used to install functions on objects. 18 // Helper function used to install functions on objects.
22 function InstallFunctions(object, attributes, functions) { 19 function InstallFunctions(object, attributes, functions) {
23 if (functions.length >= 8) { 20 if (functions.length >= 8) {
24 %OptimizeObjectForAddingMultipleProperties(object, functions.length >> 1); 21 %OptimizeObjectForAddingMultipleProperties(object, functions.length >> 1);
(...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 // Harmony isNaN. 1645 // Harmony isNaN.
1649 function NumberIsNaN(number) { 1646 function NumberIsNaN(number) {
1650 return IS_NUMBER(number) && NUMBER_IS_NAN(number); 1647 return IS_NUMBER(number) && NUMBER_IS_NAN(number);
1651 } 1648 }
1652 1649
1653 1650
1654 // Harmony isSafeInteger 1651 // Harmony isSafeInteger
1655 function NumberIsSafeInteger(number) { 1652 function NumberIsSafeInteger(number) {
1656 if (NumberIsFinite(number)) { 1653 if (NumberIsFinite(number)) {
1657 var integral = TO_INTEGER(number); 1654 var integral = TO_INTEGER(number);
1658 if (integral == number) 1655 if (integral == number) return $abs(integral) <= $Number.MAX_SAFE_INTEGER;
1659 return MathAbs(integral) <= $Number.MAX_SAFE_INTEGER;
1660 } 1656 }
1661 return false; 1657 return false;
1662 } 1658 }
1663 1659
1664 1660
1665 // ---------------------------------------------------------------------------- 1661 // ----------------------------------------------------------------------------
1666 1662
1667 function SetUpNumber() { 1663 function SetUpNumber() {
1668 %CheckIsBootstrapping(); 1664 %CheckIsBootstrapping();
1669 1665
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 } 1883 }
1888 if (!IS_SPEC_FUNCTION(method)) { 1884 if (!IS_SPEC_FUNCTION(method)) {
1889 throw MakeTypeError('not_iterable', [obj]); 1885 throw MakeTypeError('not_iterable', [obj]);
1890 } 1886 }
1891 var iterator = %_CallFunction(obj, method); 1887 var iterator = %_CallFunction(obj, method);
1892 if (!IS_SPEC_OBJECT(iterator)) { 1888 if (!IS_SPEC_OBJECT(iterator)) {
1893 throw MakeTypeError('not_an_iterator', [iterator]); 1889 throw MakeTypeError('not_an_iterator', [iterator]);
1894 } 1890 }
1895 return iterator; 1891 return iterator;
1896 } 1892 }
OLDNEW
« no previous file with comments | « src/typedarray.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698