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