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

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

Issue 2065503002: [builtins] Introduce proper Float64Atan and Float64Atan2 operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [WIP] Fix GCC/Win32. Created 4 years, 6 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/external-reference-table.cc ('k') | src/runtime/runtime.h » ('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 (function(global, utils) { 5 (function(global, utils) {
6 "use strict"; 6 "use strict";
7 7
8 %CheckIsBootstrapping(); 8 %CheckIsBootstrapping();
9 9
10 // ------------------------------------------------------------------- 10 // -------------------------------------------------------------------
(...skipping 11 matching lines...) Expand all
22 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); 22 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
23 23
24 //------------------------------------------------------------------- 24 //-------------------------------------------------------------------
25 25
26 // ECMA 262 - 15.8.2.1 26 // ECMA 262 - 15.8.2.1
27 function MathAbs(x) { 27 function MathAbs(x) {
28 x = +x; 28 x = +x;
29 return (x > 0) ? x : 0 - x; 29 return (x > 0) ? x : 0 - x;
30 } 30 }
31 31
32 // ECMA 262 - 15.8.2.5
33 // The naming of y and x matches the spec, as does the order in which
34 // ToNumber (valueOf) is called.
35 function MathAtan2JS(y, x) {
36 y = +y;
37 x = +x;
38 return %MathAtan2(y, x);
39 }
40
41 // ECMA 262 - 15.8.2.8 32 // ECMA 262 - 15.8.2.8
42 function MathExp(x) { 33 function MathExp(x) {
43 return %MathExpRT(TO_NUMBER(x)); 34 return %MathExpRT(TO_NUMBER(x));
44 } 35 }
45 36
46 // ECMA 262 - 15.8.2.13 37 // ECMA 262 - 15.8.2.13
47 function MathPowJS(x, y) { 38 function MathPowJS(x, y) {
48 return %_MathPow(TO_NUMBER(x), TO_NUMBER(y)); 39 return %_MathPow(TO_NUMBER(x), TO_NUMBER(y));
49 } 40 }
50 41
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 "SQRT1_2", 0.7071067811865476, 178 "SQRT1_2", 0.7071067811865476,
188 "SQRT2", 1.4142135623730951 179 "SQRT2", 1.4142135623730951
189 ]); 180 ]);
190 181
191 // Set up non-enumerable functions of the Math object and 182 // Set up non-enumerable functions of the Math object and
192 // set their names. 183 // set their names.
193 utils.InstallFunctions(GlobalMath, DONT_ENUM, [ 184 utils.InstallFunctions(GlobalMath, DONT_ENUM, [
194 "random", MathRandom, 185 "random", MathRandom,
195 "abs", MathAbs, 186 "abs", MathAbs,
196 "exp", MathExp, 187 "exp", MathExp,
197 "atan2", MathAtan2JS,
198 "pow", MathPowJS, 188 "pow", MathPowJS,
199 "sign", MathSign, 189 "sign", MathSign,
200 "asinh", MathAsinh, 190 "asinh", MathAsinh,
201 "acosh", MathAcosh, 191 "acosh", MathAcosh,
202 "atanh", MathAtanh, 192 "atanh", MathAtanh,
203 "hypot", MathHypot, 193 "hypot", MathHypot,
204 "cbrt", MathCbrt 194 "cbrt", MathCbrt
205 ]); 195 ]);
206 196
207 %SetForceInlineFlag(MathAbs); 197 %SetForceInlineFlag(MathAbs);
208 %SetForceInlineFlag(MathAtan2JS);
209 %SetForceInlineFlag(MathRandom); 198 %SetForceInlineFlag(MathRandom);
210 %SetForceInlineFlag(MathSign); 199 %SetForceInlineFlag(MathSign);
211 200
212 // ------------------------------------------------------------------- 201 // -------------------------------------------------------------------
213 // Exports 202 // Exports
214 203
215 utils.Export(function(to) { 204 utils.Export(function(to) {
216 to.MathAbs = MathAbs; 205 to.MathAbs = MathAbs;
217 to.MathExp = MathExp; 206 to.MathExp = MathExp;
218 to.IntRandom = MathRandomRaw; 207 to.IntRandom = MathRandomRaw;
219 }); 208 });
220 209
221 }) 210 })
OLDNEW
« no previous file with comments | « src/external-reference-table.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698