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

Side by Side Diff: src/v8natives.js

Issue 3141022: Using array index hash code for string-to-number conversion. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 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/runtime.js ('k') | src/x64/codegen-x64.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 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 (-1e9 < string && string < -0.01))) { 104 (-1e9 < string && string < -0.01))) {
105 // Truncate number. 105 // Truncate number.
106 return string | 0; 106 return string | 0;
107 } 107 }
108 radix = 0; 108 radix = 0;
109 } else { 109 } else {
110 radix = TO_INT32(radix); 110 radix = TO_INT32(radix);
111 if (!(radix == 0 || (2 <= radix && radix <= 36))) 111 if (!(radix == 0 || (2 <= radix && radix <= 36)))
112 return $NaN; 112 return $NaN;
113 } 113 }
114 return %StringParseInt(ToString(string), radix); 114 string = TO_STRING_INLINE(string);
115 if (%_HasCachedArrayIndex(string) &&
116 (radix == 0 || radix == 10)) {
117 return %_GetCachedArrayIndex(string);
118 }
119 return %StringParseInt(string, radix);
115 } 120 }
116 121
117 122
118 // ECMA-262 - 15.1.2.3 123 // ECMA-262 - 15.1.2.3
119 function GlobalParseFloat(string) { 124 function GlobalParseFloat(string) {
120 return %StringParseFloat(ToString(string)); 125 string = TO_STRING_INLINE(string);
126 if (%_HasCachedArrayIndex(string)) return %_GetCachedArrayIndex(string);
127 return %StringParseFloat(string);
121 } 128 }
122 129
123 130
124 function GlobalEval(x) { 131 function GlobalEval(x) {
125 if (!IS_STRING(x)) return x; 132 if (!IS_STRING(x)) return x;
126 133
127 var global_receiver = %GlobalReceiver(global); 134 var global_receiver = %GlobalReceiver(global);
128 var this_is_global_receiver = (this === global_receiver); 135 var this_is_global_receiver = (this === global_receiver);
129 var global_is_detached = (global === global_receiver); 136 var global_is_detached = (global === global_receiver);
130 137
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 // ---------------------------------------------------------------------------- 1187 // ----------------------------------------------------------------------------
1181 1188
1182 function SetupFunction() { 1189 function SetupFunction() {
1183 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1190 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1184 "bind", FunctionBind, 1191 "bind", FunctionBind,
1185 "toString", FunctionToString 1192 "toString", FunctionToString
1186 )); 1193 ));
1187 } 1194 }
1188 1195
1189 SetupFunction(); 1196 SetupFunction();
OLDNEW
« no previous file with comments | « src/runtime.js ('k') | src/x64/codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698