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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 v8::String::Utf8Value utf8_date(v8::Utils::ToLocal(date_string)); | 382 v8::String::Utf8Value utf8_date(v8::Utils::ToLocal(date_string)); |
383 icu::UnicodeString u_date(icu::UnicodeString::fromUTF8(*utf8_date)); | 383 icu::UnicodeString u_date(icu::UnicodeString::fromUTF8(*utf8_date)); |
384 icu::SimpleDateFormat* date_format = | 384 icu::SimpleDateFormat* date_format = |
385 DateFormat::UnpackDateFormat(isolate, date_format_holder); | 385 DateFormat::UnpackDateFormat(isolate, date_format_holder); |
386 if (!date_format) return isolate->ThrowIllegalOperation(); | 386 if (!date_format) return isolate->ThrowIllegalOperation(); |
387 | 387 |
388 UErrorCode status = U_ZERO_ERROR; | 388 UErrorCode status = U_ZERO_ERROR; |
389 UDate date = date_format->parse(u_date, status); | 389 UDate date = date_format->parse(u_date, status); |
390 if (U_FAILURE(status)) return isolate->heap()->undefined_value(); | 390 if (U_FAILURE(status)) return isolate->heap()->undefined_value(); |
391 | 391 |
392 Handle<Object> result; | 392 Handle<JSDate> result; |
393 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 393 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
394 isolate, result, Execution::NewDate(isolate, static_cast<double>(date))); | 394 isolate, result, |
395 DCHECK(result->IsJSDate()); | 395 JSDate::New(isolate->date_function(), isolate->date_function(), |
| 396 static_cast<double>(date))); |
396 return *result; | 397 return *result; |
397 } | 398 } |
398 | 399 |
399 | 400 |
400 RUNTIME_FUNCTION(Runtime_CreateNumberFormat) { | 401 RUNTIME_FUNCTION(Runtime_CreateNumberFormat) { |
401 HandleScope scope(isolate); | 402 HandleScope scope(isolate); |
402 | 403 |
403 DCHECK(args.length() == 3); | 404 DCHECK(args.length() == 3); |
404 | 405 |
405 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0); | 406 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { | 743 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { |
743 return *isolate->factory()->NewStringFromStaticChars("ideo"); | 744 return *isolate->factory()->NewStringFromStaticChars("ideo"); |
744 } else { | 745 } else { |
745 return *isolate->factory()->NewStringFromStaticChars("unknown"); | 746 return *isolate->factory()->NewStringFromStaticChars("unknown"); |
746 } | 747 } |
747 } | 748 } |
748 } // namespace internal | 749 } // namespace internal |
749 } // namespace v8 | 750 } // namespace v8 |
750 | 751 |
751 #endif // V8_I18N_SUPPORT | 752 #endif // V8_I18N_SUPPORT |
OLD | NEW |