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

Side by Side Diff: src/math.js

Issue 149177: Optimize Date construction and string concatenation with... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 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 | « src/date-delay.js ('k') | src/runtime.js » ('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 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 // ECMA 262 - 15.8.2.8 89 // ECMA 262 - 15.8.2.8
90 function MathExp(x) { 90 function MathExp(x) {
91 if (!IS_NUMBER(x)) x = ToNumber(x); 91 if (!IS_NUMBER(x)) x = ToNumber(x);
92 return %Math_exp(x); 92 return %Math_exp(x);
93 } 93 }
94 94
95 // ECMA 262 - 15.8.2.9 95 // ECMA 262 - 15.8.2.9
96 function MathFloor(x) { 96 function MathFloor(x) {
97 if (!IS_NUMBER(x)) x = ToNumber(x); 97 if (!IS_NUMBER(x)) x = ToNumber(x);
98 if (0 < x && x <= 0x7FFFFFFF) { 98 // It's more common to call this with a positive number that's out
99 // of range than negative numbers; check the upper bound first.
100 if (x <= 0x7FFFFFFF && x > 0) {
99 // Numbers in the range [0, 2^31) can be floored by converting 101 // Numbers in the range [0, 2^31) can be floored by converting
100 // them to an unsigned 32-bit value using the shift operator. 102 // them to an unsigned 32-bit value using the shift operator.
101 // We avoid doing so for -0, because the result of Math.floor(-0) 103 // We avoid doing so for -0, because the result of Math.floor(-0)
102 // has to be -0, which wouldn't be the case with the shift. 104 // has to be -0, which wouldn't be the case with the shift.
103 return x << 0; 105 return x << 0;
104 } else { 106 } else {
105 return %Math_floor(x); 107 return %Math_floor(x);
106 } 108 }
107 } 109 }
108 110
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 "tan", MathTan, 235 "tan", MathTan,
234 "atan2", MathAtan2, 236 "atan2", MathAtan2,
235 "pow", MathPow, 237 "pow", MathPow,
236 "max", MathMax, 238 "max", MathMax,
237 "min", MathMin 239 "min", MathMin
238 )); 240 ));
239 }; 241 };
240 242
241 243
242 SetupMath(); 244 SetupMath();
OLDNEW
« no previous file with comments | « src/date-delay.js ('k') | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698