OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> | 5 #include <limits.h> |
6 #include <stdarg.h> | 6 #include <stdarg.h> |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 } | 483 } |
484 | 484 |
485 | 485 |
486 double StringToDouble(UnicodeCache* unicode_cache, | 486 double StringToDouble(UnicodeCache* unicode_cache, |
487 String* string, | 487 String* string, |
488 int flags, | 488 int flags, |
489 double empty_string_val) { | 489 double empty_string_val) { |
490 DisallowHeapAllocation no_gc; | 490 DisallowHeapAllocation no_gc; |
491 String::FlatContent flat = string->GetFlatContent(); | 491 String::FlatContent flat = string->GetFlatContent(); |
492 // ECMA-262 section 15.1.2.3, empty string is NaN | 492 // ECMA-262 section 15.1.2.3, empty string is NaN |
493 if (flat.IsAscii()) { | 493 if (flat.IsOneByte()) { |
494 return StringToDouble( | 494 return StringToDouble( |
495 unicode_cache, flat.ToOneByteVector(), flags, empty_string_val); | 495 unicode_cache, flat.ToOneByteVector(), flags, empty_string_val); |
496 } else { | 496 } else { |
497 return StringToDouble( | 497 return StringToDouble( |
498 unicode_cache, flat.ToUC16Vector(), flags, empty_string_val); | 498 unicode_cache, flat.ToUC16Vector(), flags, empty_string_val); |
499 } | 499 } |
500 } | 500 } |
501 | 501 |
502 | 502 |
503 } } // namespace v8::internal | 503 } } // namespace v8::internal |
OLD | NEW |