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

Side by Side Diff: src/js/math.js

Issue 1455123002: [turbofan] Check word32 -> float64 conversion with input type/output truncation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Get rid of the guards Created 5 years, 1 month 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/compiler/simplified-lowering.cc ('k') | no next file » | 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 (function(global, utils) { 5 (function(global, utils) {
6 "use strict"; 6 "use strict";
7 7
8 %CheckIsBootstrapping(); 8 %CheckIsBootstrapping();
9 9
10 // ------------------------------------------------------------------- 10 // -------------------------------------------------------------------
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 if (x == 0 || !NUMBER_IS_FINITE(x)) return x; 275 if (x == 0 || !NUMBER_IS_FINITE(x)) return x;
276 return x >= 0 ? CubeRoot(x) : -CubeRoot(-x); 276 return x >= 0 ? CubeRoot(x) : -CubeRoot(-x);
277 } 277 }
278 278
279 macro NEWTON_ITERATION_CBRT(x, approx) 279 macro NEWTON_ITERATION_CBRT(x, approx)
280 (1.0 / 3.0) * (x / (approx * approx) + 2 * approx); 280 (1.0 / 3.0) * (x / (approx * approx) + 2 * approx);
281 endmacro 281 endmacro
282 282
283 function CubeRoot(x) { 283 function CubeRoot(x) {
284 var approx_hi = MathFloorJS(%_DoubleHi(x) / 3) + 0x2A9F7893; 284 var approx_hi = MathFloorJS(%_DoubleHi(x) / 3) + 0x2A9F7893;
285 var approx = %_ConstructDouble(approx_hi, 0); 285 var approx = %_ConstructDouble(approx_hi | 0, 0);
286 approx = NEWTON_ITERATION_CBRT(x, approx); 286 approx = NEWTON_ITERATION_CBRT(x, approx);
287 approx = NEWTON_ITERATION_CBRT(x, approx); 287 approx = NEWTON_ITERATION_CBRT(x, approx);
288 approx = NEWTON_ITERATION_CBRT(x, approx); 288 approx = NEWTON_ITERATION_CBRT(x, approx);
289 return NEWTON_ITERATION_CBRT(x, approx); 289 return NEWTON_ITERATION_CBRT(x, approx);
290 } 290 }
291 291
292 // ------------------------------------------------------------------- 292 // -------------------------------------------------------------------
293 293
294 %AddNamedProperty(GlobalMath, toStringTagSymbol, "Math", READ_ONLY | DONT_ENUM); 294 %AddNamedProperty(GlobalMath, toStringTagSymbol, "Math", READ_ONLY | DONT_ENUM);
295 295
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 utils.Export(function(to) { 358 utils.Export(function(to) {
359 to.MathAbs = MathAbs; 359 to.MathAbs = MathAbs;
360 to.MathExp = MathExp; 360 to.MathExp = MathExp;
361 to.MathFloor = MathFloorJS; 361 to.MathFloor = MathFloorJS;
362 to.IntRandom = MathRandomRaw; 362 to.IntRandom = MathRandomRaw;
363 to.MathMax = MathMax; 363 to.MathMax = MathMax;
364 to.MathMin = MathMin; 364 to.MathMin = MathMin;
365 }); 365 });
366 366
367 }) 367 })
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698