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

Side by Side Diff: src/conversions.cc

Issue 6903171: Don't allow whitespace after sign characters in parseInt. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 7 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 | test/mjsunit/regress/regress-955.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 if (!AdvanceToNonspace(unicode_cache, &current, end)) { 247 if (!AdvanceToNonspace(unicode_cache, &current, end)) {
248 return empty_string_val; 248 return empty_string_val;
249 } 249 }
250 250
251 bool negative = false; 251 bool negative = false;
252 bool leading_zero = false; 252 bool leading_zero = false;
253 253
254 if (*current == '+') { 254 if (*current == '+') {
255 // Ignore leading sign; skip following spaces. 255 // Ignore leading sign; skip following spaces.
256 ++current; 256 ++current;
257 if (!AdvanceToNonspace(unicode_cache, &current, end)) { 257 if (current == end) {
258 return JUNK_STRING_VALUE; 258 return JUNK_STRING_VALUE;
259 } 259 }
260 } else if (*current == '-') { 260 } else if (*current == '-') {
261 ++current; 261 ++current;
262 if (!AdvanceToNonspace(unicode_cache, &current, end)) { 262 if (current == end) {
263 return JUNK_STRING_VALUE; 263 return JUNK_STRING_VALUE;
264 } 264 }
265 negative = true; 265 negative = true;
266 } 266 }
267 267
268 if (radix == 0) { 268 if (radix == 0) {
269 // Radix detection. 269 // Radix detection.
270 if (*current == '0') { 270 if (*current == '0') {
271 ++current; 271 ++current;
272 if (current == end) return SignedZero(negative); 272 if (current == end) return SignedZero(negative);
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 (n == 0 ? v8::internal::dtoa_lock_zero : v8::internal::dtoa_lock_one)->Lock(); 1113 (n == 0 ? v8::internal::dtoa_lock_zero : v8::internal::dtoa_lock_one)->Lock();
1114 } 1114 }
1115 1115
1116 1116
1117 void FREE_DTOA_LOCK(int n) { 1117 void FREE_DTOA_LOCK(int n) {
1118 ASSERT(n == 0 || n == 1); 1118 ASSERT(n == 0 || n == 1);
1119 (n == 0 ? v8::internal::dtoa_lock_zero : v8::internal::dtoa_lock_one)-> 1119 (n == 0 ? v8::internal::dtoa_lock_zero : v8::internal::dtoa_lock_one)->
1120 Unlock(); 1120 Unlock();
1121 } 1121 }
1122 } 1122 }
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-955.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698