| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 | 5 |
| 6 #ifdef V8_I18N_SUPPORT | 6 #ifdef V8_I18N_SUPPORT |
| 7 #include "src/runtime/runtime-utils.h" | 7 #include "src/runtime/runtime-utils.h" |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/api-natives.h" | 10 #include "src/api-natives.h" |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 | 465 |
| 466 | 466 |
| 467 RUNTIME_FUNCTION(Runtime_InternalNumberParse) { | 467 RUNTIME_FUNCTION(Runtime_InternalNumberParse) { |
| 468 HandleScope scope(isolate); | 468 HandleScope scope(isolate); |
| 469 | 469 |
| 470 DCHECK(args.length() == 2); | 470 DCHECK(args.length() == 2); |
| 471 | 471 |
| 472 CONVERT_ARG_HANDLE_CHECKED(JSObject, number_format_holder, 0); | 472 CONVERT_ARG_HANDLE_CHECKED(JSObject, number_format_holder, 0); |
| 473 CONVERT_ARG_HANDLE_CHECKED(String, number_string, 1); | 473 CONVERT_ARG_HANDLE_CHECKED(String, number_string, 1); |
| 474 | 474 |
| 475 isolate->CountUsage(v8::Isolate::UseCounterFeature::kIntlV8Parse); |
| 476 |
| 475 v8::String::Utf8Value utf8_number(v8::Utils::ToLocal(number_string)); | 477 v8::String::Utf8Value utf8_number(v8::Utils::ToLocal(number_string)); |
| 476 icu::UnicodeString u_number(icu::UnicodeString::fromUTF8(*utf8_number)); | 478 icu::UnicodeString u_number(icu::UnicodeString::fromUTF8(*utf8_number)); |
| 477 icu::DecimalFormat* number_format = | 479 icu::DecimalFormat* number_format = |
| 478 NumberFormat::UnpackNumberFormat(isolate, number_format_holder); | 480 NumberFormat::UnpackNumberFormat(isolate, number_format_holder); |
| 479 if (!number_format) return isolate->ThrowIllegalOperation(); | 481 if (!number_format) return isolate->ThrowIllegalOperation(); |
| 480 | 482 |
| 481 UErrorCode status = U_ZERO_ERROR; | 483 UErrorCode status = U_ZERO_ERROR; |
| 482 icu::Formattable result; | 484 icu::Formattable result; |
| 483 // ICU 4.6 doesn't support parseCurrency call. We need to wait for ICU49 | 485 // ICU 4.6 doesn't support parseCurrency call. We need to wait for ICU49 |
| 484 // to be part of Chrome. | 486 // to be part of Chrome. |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { | 744 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { |
| 743 return *isolate->factory()->NewStringFromStaticChars("ideo"); | 745 return *isolate->factory()->NewStringFromStaticChars("ideo"); |
| 744 } else { | 746 } else { |
| 745 return *isolate->factory()->NewStringFromStaticChars("unknown"); | 747 return *isolate->factory()->NewStringFromStaticChars("unknown"); |
| 746 } | 748 } |
| 747 } | 749 } |
| 748 } // namespace internal | 750 } // namespace internal |
| 749 } // namespace v8 | 751 } // namespace v8 |
| 750 | 752 |
| 751 #endif // V8_I18N_SUPPORT | 753 #endif // V8_I18N_SUPPORT |
| OLD | NEW |