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

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

Issue 163563003: Harmony: implement Math.cbrt, Math.expm1 and Math.log1p. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: uploaded new Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // Binary search. 167 // Binary search.
168 if ((x & 0xFFFF0000) === 0) { x <<= 16; result += 16; }; 168 if ((x & 0xFFFF0000) === 0) { x <<= 16; result += 16; };
169 if ((x & 0xFF000000) === 0) { x <<= 8; result += 8; }; 169 if ((x & 0xFF000000) === 0) { x <<= 8; result += 8; };
170 if ((x & 0xF0000000) === 0) { x <<= 4; result += 4; }; 170 if ((x & 0xF0000000) === 0) { x <<= 4; result += 4; };
171 if ((x & 0xC0000000) === 0) { x <<= 2; result += 2; }; 171 if ((x & 0xC0000000) === 0) { x <<= 2; result += 2; };
172 if ((x & 0x80000000) === 0) { x <<= 1; result += 1; }; 172 if ((x & 0x80000000) === 0) { x <<= 1; result += 1; };
173 return result; 173 return result;
174 } 174 }
175 175
176 176
177 //ES6 draft 09-27-13, section 20.2.2.9.
178 function MathCbrt(x) {
179 return %Math_cbrt(TO_NUMBER_INLINE(x));
180 }
181
182
183 //ES6 draft 09-27-13, section 20.2.2.14.
184 function MathExpm1(x) {
185 return %Math_expm1(TO_NUMBER_INLINE(x));
186 }
187
188
189 //ES6 draft 09-27-13, section 20.2.2.20.
190 function MathLog1p(x) {
191 return %Math_log1p(TO_NUMBER_INLINE(x));
192 }
193
194
177 function ExtendMath() { 195 function ExtendMath() {
178 %CheckIsBootstrapping(); 196 %CheckIsBootstrapping();
179 197
180 // Set up the non-enumerable functions on the Math object. 198 // Set up the non-enumerable functions on the Math object.
181 InstallFunctions($Math, DONT_ENUM, $Array( 199 InstallFunctions($Math, DONT_ENUM, $Array(
182 "sign", MathSign, 200 "sign", MathSign,
183 "trunc", MathTrunc, 201 "trunc", MathTrunc,
184 "sinh", MathSinh, 202 "sinh", MathSinh,
185 "cosh", MathCosh, 203 "cosh", MathCosh,
186 "tanh", MathTanh, 204 "tanh", MathTanh,
187 "asinh", MathAsinh, 205 "asinh", MathAsinh,
188 "acosh", MathAcosh, 206 "acosh", MathAcosh,
189 "atanh", MathAtanh, 207 "atanh", MathAtanh,
190 "log10", MathLog10, 208 "log10", MathLog10,
191 "log2", MathLog2, 209 "log2", MathLog2,
192 "hypot", MathHypot, 210 "hypot", MathHypot,
193 "fround", MathFround, 211 "fround", MathFround,
194 "clz32", MathClz32 212 "clz32", MathClz32,
213 "cbrt", MathCbrt,
214 "log1p", MathLog1p,
215 "expm1", MathExpm1
195 )); 216 ));
196 } 217 }
197 218
198 219
199 ExtendMath(); 220 ExtendMath();
OLDNEW
« no previous file with comments | « no previous file | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698