| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 RUNTIME_FUNCTION(Runtime_InternalDateFormat) { | 345 RUNTIME_FUNCTION(Runtime_InternalDateFormat) { |
| 346 HandleScope scope(isolate); | 346 HandleScope scope(isolate); |
| 347 | 347 |
| 348 DCHECK(args.length() == 2); | 348 DCHECK(args.length() == 2); |
| 349 | 349 |
| 350 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0); | 350 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0); |
| 351 CONVERT_ARG_HANDLE_CHECKED(JSDate, date, 1); | 351 CONVERT_ARG_HANDLE_CHECKED(JSDate, date, 1); |
| 352 | 352 |
| 353 Handle<Object> value; | 353 Handle<Object> value; |
| 354 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, | 354 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, |
| 355 Execution::ToNumber(isolate, date)); | 355 Object::ToNumber(isolate, date)); |
| 356 | 356 |
| 357 icu::SimpleDateFormat* date_format = | 357 icu::SimpleDateFormat* date_format = |
| 358 DateFormat::UnpackDateFormat(isolate, date_format_holder); | 358 DateFormat::UnpackDateFormat(isolate, date_format_holder); |
| 359 if (!date_format) return isolate->ThrowIllegalOperation(); | 359 if (!date_format) return isolate->ThrowIllegalOperation(); |
| 360 | 360 |
| 361 icu::UnicodeString result; | 361 icu::UnicodeString result; |
| 362 date_format->format(value->Number(), result); | 362 date_format->format(value->Number(), result); |
| 363 | 363 |
| 364 Handle<String> result_str; | 364 Handle<String> result_str; |
| 365 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 365 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 RUNTIME_FUNCTION(Runtime_InternalNumberFormat) { | 439 RUNTIME_FUNCTION(Runtime_InternalNumberFormat) { |
| 440 HandleScope scope(isolate); | 440 HandleScope scope(isolate); |
| 441 | 441 |
| 442 DCHECK(args.length() == 2); | 442 DCHECK(args.length() == 2); |
| 443 | 443 |
| 444 CONVERT_ARG_HANDLE_CHECKED(JSObject, number_format_holder, 0); | 444 CONVERT_ARG_HANDLE_CHECKED(JSObject, number_format_holder, 0); |
| 445 CONVERT_ARG_HANDLE_CHECKED(Object, number, 1); | 445 CONVERT_ARG_HANDLE_CHECKED(Object, number, 1); |
| 446 | 446 |
| 447 Handle<Object> value; | 447 Handle<Object> value; |
| 448 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, | 448 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, |
| 449 Execution::ToNumber(isolate, number)); | 449 Object::ToNumber(isolate, number)); |
| 450 | 450 |
| 451 icu::DecimalFormat* number_format = | 451 icu::DecimalFormat* number_format = |
| 452 NumberFormat::UnpackNumberFormat(isolate, number_format_holder); | 452 NumberFormat::UnpackNumberFormat(isolate, number_format_holder); |
| 453 if (!number_format) return isolate->ThrowIllegalOperation(); | 453 if (!number_format) return isolate->ThrowIllegalOperation(); |
| 454 | 454 |
| 455 icu::UnicodeString result; | 455 icu::UnicodeString result; |
| 456 number_format->format(value->Number(), result); | 456 number_format->format(value->Number(), result); |
| 457 | 457 |
| 458 Handle<String> result_str; | 458 Handle<String> result_str; |
| 459 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 459 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { | 743 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { |
| 744 return *isolate->factory()->NewStringFromStaticChars("ideo"); | 744 return *isolate->factory()->NewStringFromStaticChars("ideo"); |
| 745 } else { | 745 } else { |
| 746 return *isolate->factory()->NewStringFromStaticChars("unknown"); | 746 return *isolate->factory()->NewStringFromStaticChars("unknown"); |
| 747 } | 747 } |
| 748 } | 748 } |
| 749 } // namespace internal | 749 } // namespace internal |
| 750 } // namespace v8 | 750 } // namespace v8 |
| 751 | 751 |
| 752 #endif // V8_I18N_SUPPORT | 752 #endif // V8_I18N_SUPPORT |
| OLD | NEW |