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

Side by Side Diff: src/runtime.cc

Issue 384132: Small parseInt optimizations (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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 | src/v8natives.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-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 i += step; 3378 i += step;
3379 } 3379 }
3380 return destination; 3380 return destination;
3381 } 3381 }
3382 3382
3383 3383
3384 static Object* Runtime_StringParseInt(Arguments args) { 3384 static Object* Runtime_StringParseInt(Arguments args) {
3385 NoHandleAllocation ha; 3385 NoHandleAllocation ha;
3386 3386
3387 CONVERT_CHECKED(String, s, args[0]); 3387 CONVERT_CHECKED(String, s, args[0]);
3388 CONVERT_DOUBLE_CHECKED(n, args[1]); 3388 CONVERT_SMI_CHECKED(radix, args[1]);
3389 int radix = FastD2I(n);
3390 3389
3391 s->TryFlattenIfNotFlat(); 3390 s->TryFlattenIfNotFlat();
3392 3391
3393 int len = s->length(); 3392 int len = s->length();
3394 int i; 3393 int i;
3395 3394
3396 // Skip leading white space. 3395 // Skip leading white space.
3397 for (i = 0; i < len && Scanner::kIsWhiteSpace.get(s->Get(i)); i++) ; 3396 for (i = 0; i < len && Scanner::kIsWhiteSpace.get(s->Get(i)); i++) ;
3398 if (i == len) return Heap::nan_value(); 3397 if (i == len) return Heap::nan_value();
3399 3398
(...skipping 4502 matching lines...) Expand 10 before | Expand all | Expand 10 after
7902 } else { 7901 } else {
7903 // Handle last resort GC and make sure to allow future allocations 7902 // Handle last resort GC and make sure to allow future allocations
7904 // to grow the heap without causing GCs (if possible). 7903 // to grow the heap without causing GCs (if possible).
7905 Counters::gc_last_resort_from_js.Increment(); 7904 Counters::gc_last_resort_from_js.Increment();
7906 Heap::CollectAllGarbage(false); 7905 Heap::CollectAllGarbage(false);
7907 } 7906 }
7908 } 7907 }
7909 7908
7910 7909
7911 } } // namespace v8::internal 7910 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698