OLD | NEW |
---|---|
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 3369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3380 i += step; | 3380 i += step; |
3381 } | 3381 } |
3382 return destination; | 3382 return destination; |
3383 } | 3383 } |
3384 | 3384 |
3385 | 3385 |
3386 static Object* Runtime_StringParseInt(Arguments args) { | 3386 static Object* Runtime_StringParseInt(Arguments args) { |
3387 NoHandleAllocation ha; | 3387 NoHandleAllocation ha; |
3388 | 3388 |
3389 CONVERT_CHECKED(String, s, args[0]); | 3389 CONVERT_CHECKED(String, s, args[0]); |
3390 CONVERT_DOUBLE_CHECKED(n, args[1]); | 3390 CONVERT_SMI_CHECKED(radix, args[1]); |
Erik Corry
2009/11/11 11:16:49
This version doesn't work if the argument is not a
Lasse Reichstein
2009/11/11 11:43:34
It's perfectly fine to throw an exception for a no
Erik Corry
2009/11/13 12:24:23
My apologies, I was too fast with this comment. T
| |
3391 int radix = FastD2I(n); | |
3392 | 3391 |
3393 s->TryFlattenIfNotFlat(); | 3392 s->TryFlattenIfNotFlat(); |
3394 | 3393 |
3395 int len = s->length(); | 3394 int len = s->length(); |
3396 int i; | 3395 int i; |
3397 | 3396 |
3398 // Skip leading white space. | 3397 // Skip leading white space. |
3399 for (i = 0; i < len && Scanner::kIsWhiteSpace.get(s->Get(i)); i++) ; | 3398 for (i = 0; i < len && Scanner::kIsWhiteSpace.get(s->Get(i)); i++) ; |
3400 if (i == len) return Heap::nan_value(); | 3399 if (i == len) return Heap::nan_value(); |
3401 | 3400 |
(...skipping 4484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7886 } else { | 7885 } else { |
7887 // Handle last resort GC and make sure to allow future allocations | 7886 // Handle last resort GC and make sure to allow future allocations |
7888 // to grow the heap without causing GCs (if possible). | 7887 // to grow the heap without causing GCs (if possible). |
7889 Counters::gc_last_resort_from_js.Increment(); | 7888 Counters::gc_last_resort_from_js.Increment(); |
7890 Heap::CollectAllGarbage(false); | 7889 Heap::CollectAllGarbage(false); |
7891 } | 7890 } |
7892 } | 7891 } |
7893 | 7892 |
7894 | 7893 |
7895 } } // namespace v8::internal | 7894 } } // namespace v8::internal |
OLD | NEW |