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

Side by Side Diff: src/math.js

Issue 1053143005: Collect type feedback on result of Math.[round|ceil|floor] (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: MIPS port Created 5 years, 7 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/ic/ic.cc ('k') | src/mips/code-stubs-mips.cc » ('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 var rngstate; // Initialized to a Uint32Array during genesis. 5 var rngstate; // Initialized to a Uint32Array during genesis.
6 6
7 var $abs; 7 var $abs;
8 var $exp; 8 var $exp;
9 var $floor; 9 var $floor;
10 var $max; 10 var $max;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // The naming of y and x matches the spec, as does the order in which 45 // The naming of y and x matches the spec, as does the order in which
46 // ToNumber (valueOf) is called. 46 // ToNumber (valueOf) is called.
47 function MathAtan2JS(y, x) { 47 function MathAtan2JS(y, x) {
48 y = +y; 48 y = +y;
49 x = +x; 49 x = +x;
50 return %_MathAtan2(y, x); 50 return %_MathAtan2(y, x);
51 } 51 }
52 52
53 // ECMA 262 - 15.8.2.6 53 // ECMA 262 - 15.8.2.6
54 function MathCeil(x) { 54 function MathCeil(x) {
55 return -%_MathFloor(-x); 55 return -MathFloorJS(-x);
56 } 56 }
57 57
58 // ECMA 262 - 15.8.2.8 58 // ECMA 262 - 15.8.2.8
59 function MathExp(x) { 59 function MathExp(x) {
60 return %MathExpRT(TO_NUMBER_INLINE(x)); 60 return %MathExpRT(TO_NUMBER_INLINE(x));
61 } 61 }
62 62
63 // ECMA 262 - 15.8.2.9 63 // ECMA 262 - 15.8.2.9
64 function MathFloorJS(x) { 64 function MathFloorJS(x) {
65 return %_MathFloor(+x); 65 return %MathFloor(+x);
66 } 66 }
67 67
68 // ECMA 262 - 15.8.2.10 68 // ECMA 262 - 15.8.2.10
69 function MathLog(x) { 69 function MathLog(x) {
70 return %_MathLogRT(TO_NUMBER_INLINE(x)); 70 return %_MathLogRT(TO_NUMBER_INLINE(x));
71 } 71 }
72 72
73 // ECMA 262 - 15.8.2.11 73 // ECMA 262 - 15.8.2.11
74 function MathMax(arg1, arg2) { // length == 2 74 function MathMax(arg1, arg2) { // length == 2
75 var length = %_ArgumentsLength(); 75 var length = %_ArgumentsLength();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 x = +x; 160 x = +x;
161 if (x > 0) return 1; 161 if (x > 0) return 1;
162 if (x < 0) return -1; 162 if (x < 0) return -1;
163 // -0, 0 or NaN. 163 // -0, 0 or NaN.
164 return x; 164 return x;
165 } 165 }
166 166
167 // ES6 draft 09-27-13, section 20.2.2.34. 167 // ES6 draft 09-27-13, section 20.2.2.34.
168 function MathTrunc(x) { 168 function MathTrunc(x) {
169 x = +x; 169 x = +x;
170 if (x > 0) return %_MathFloor(x); 170 if (x > 0) return MathFloorJS(x);
171 if (x < 0) return -%_MathFloor(-x); 171 if (x < 0) return -MathFloorJS(-x);
172 // -0, 0 or NaN. 172 // -0, 0 or NaN.
173 return x; 173 return x;
174 } 174 }
175 175
176 // ES6 draft 09-27-13, section 20.2.2.33. 176 // ES6 draft 09-27-13, section 20.2.2.33.
177 function MathTanh(x) { 177 function MathTanh(x) {
178 if (!IS_NUMBER(x)) x = NonNumberToNumber(x); 178 if (!IS_NUMBER(x)) x = NonNumberToNumber(x);
179 // Idempotent for +/-0. 179 // Idempotent for +/-0.
180 if (x === 0) return x; 180 if (x === 0) return x;
181 // Returns +/-1 for +/-Infinity. 181 // Returns +/-1 for +/-Infinity.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 %SetInlineBuiltinFlag(MathTrunc); 354 %SetInlineBuiltinFlag(MathTrunc);
355 355
356 // Expose to the global scope. 356 // Expose to the global scope.
357 $abs = MathAbs; 357 $abs = MathAbs;
358 $exp = MathExp; 358 $exp = MathExp;
359 $floor = MathFloorJS; 359 $floor = MathFloorJS;
360 $max = MathMax; 360 $max = MathMax;
361 $min = MathMin; 361 $min = MathMin;
362 362
363 })(); 363 })();
OLDNEW
« no previous file with comments | « src/ic/ic.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698