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

Side by Side Diff: src/math.js

Issue 661179: Inline Math.sqrt(). ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // Smi or a heap number. 152 // Smi or a heap number.
153 if (n < r || (r === 0 && n === 0 && !%_IsSmi(n) && 1 / n < 0)) r = n; 153 if (n < r || (r === 0 && n === 0 && !%_IsSmi(n) && 1 / n < 0)) r = n;
154 } 154 }
155 return r; 155 return r;
156 } 156 }
157 157
158 // ECMA 262 - 15.8.2.13 158 // ECMA 262 - 15.8.2.13
159 function MathPow(x, y) { 159 function MathPow(x, y) {
160 if (!IS_NUMBER(x)) x = ToNumber(x); 160 if (!IS_NUMBER(x)) x = ToNumber(x);
161 if (!IS_NUMBER(y)) y = ToNumber(y); 161 if (!IS_NUMBER(y)) y = ToNumber(y);
162 return %_Pow(x, y); 162 return %_Math_pow(x, y);
163 } 163 }
164 164
165 // ECMA 262 - 15.8.2.14 165 // ECMA 262 - 15.8.2.14
166 function MathRandom() { 166 function MathRandom() {
167 return %_RandomPositiveSmi() / 0x40000000; 167 return %_RandomPositiveSmi() / 0x40000000;
168 } 168 }
169 169
170 // ECMA 262 - 15.8.2.15 170 // ECMA 262 - 15.8.2.15
171 function MathRound(x) { 171 function MathRound(x) {
172 if (!IS_NUMBER(x)) x = ToNumber(x); 172 if (!IS_NUMBER(x)) x = ToNumber(x);
173 return %Math_round(x); 173 return %Math_round(x);
174 } 174 }
175 175
176 // ECMA 262 - 15.8.2.16 176 // ECMA 262 - 15.8.2.16
177 function MathSin(x) { 177 function MathSin(x) {
178 if (!IS_NUMBER(x)) x = ToNumber(x); 178 if (!IS_NUMBER(x)) x = ToNumber(x);
179 return %_Math_sin(x); 179 return %_Math_sin(x);
180 } 180 }
181 181
182 // ECMA 262 - 15.8.2.17 182 // ECMA 262 - 15.8.2.17
183 function MathSqrt(x) { 183 function MathSqrt(x) {
184 if (!IS_NUMBER(x)) x = ToNumber(x); 184 if (!IS_NUMBER(x)) x = ToNumber(x);
185 return %Math_sqrt(x); 185 return %_Math_sqrt(x);
186 } 186 }
187 187
188 // ECMA 262 - 15.8.2.18 188 // ECMA 262 - 15.8.2.18
189 function MathTan(x) { 189 function MathTan(x) {
190 if (!IS_NUMBER(x)) x = ToNumber(x); 190 if (!IS_NUMBER(x)) x = ToNumber(x);
191 return %Math_tan(x); 191 return %Math_tan(x);
192 } 192 }
193 193
194 194
195 // ------------------------------------------------------------------- 195 // -------------------------------------------------------------------
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 "tan", MathTan, 254 "tan", MathTan,
255 "atan2", MathAtan2, 255 "atan2", MathAtan2,
256 "pow", MathPow, 256 "pow", MathPow,
257 "max", MathMax, 257 "max", MathMax,
258 "min", MathMin 258 "min", MathMin
259 )); 259 ));
260 }; 260 };
261 261
262 262
263 SetupMath(); 263 SetupMath();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698