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

Side by Side Diff: src/v8natives.js

Issue 21507: Experimental: port bleeding_edge r1276 (a grab bag of optimizations)... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 11 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
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // ECMA-262 - 15.1.2.2 74 // ECMA-262 - 15.1.2.2
75 function GlobalParseInt(string, radix) { 75 function GlobalParseInt(string, radix) {
76 if (radix === void 0) { 76 if (radix === void 0) {
77 radix = 0; 77 radix = 0;
78 // Some people use parseInt instead of Math.floor. This 78 // Some people use parseInt instead of Math.floor. This
79 // optimization makes parseInt on a Smi 12 times faster (60ns 79 // optimization makes parseInt on a Smi 12 times faster (60ns
80 // vs 800ns). The following optimization makes parseInt on a 80 // vs 800ns). The following optimization makes parseInt on a
81 // non-Smi number 9 times faster (230ns vs 2070ns). Together 81 // non-Smi number 9 times faster (230ns vs 2070ns). Together
82 // they make parseInt on a string 1.4% slower (274ns vs 270ns). 82 // they make parseInt on a string 1.4% slower (274ns vs 270ns).
83 if (%_IsSmi(string)) return string; 83 if (%_IsSmi(string)) return string;
84 if (IS_NUMBER(string)) { 84 if (IS_NUMBER(string) &&
85 if (string >= 0.01 && string < 1e9) 85 ((string < -0.01 && -1e9 < string) ||
86 return $floor(string); 86 (0.01 < string && string < 1e9))) {
87 if (string <= -0.01 && string > -1e9) 87 // Truncate number.
88 return - $floor(-string); 88 return string | 0;
89 } 89 }
90 } else { 90 } else {
91 radix = TO_INT32(radix); 91 radix = TO_INT32(radix);
92 if (!(radix == 0 || (2 <= radix && radix <= 36))) 92 if (!(radix == 0 || (2 <= radix && radix <= 36)))
93 return $NaN; 93 return $NaN;
94 } 94 }
95 return %StringParseInt(ToString(string), radix); 95 return %StringParseInt(ToString(string), radix);
96 } 96 }
97 97
98 98
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 // ---------------------------------------------------------------------------- 531 // ----------------------------------------------------------------------------
532 532
533 function SetupFunction() { 533 function SetupFunction() {
534 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 534 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
535 "toString", FunctionToString 535 "toString", FunctionToString
536 )); 536 ));
537 } 537 }
538 538
539 SetupFunction(); 539 SetupFunction();
540 540
OLDNEW
« src/codegen-ia32.cc ('K') | « src/string.js ('k') | test/mjsunit/date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698