Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: src/runtime/runtime-i18n.cc

Issue 1973183002: Override Date.prototype.to*String with Intl.DateTimeFormat.format Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/js/i18n.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 9 #include <memory>
10 10
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 reinterpret_cast<const uint16_t*>(field.getBuffer()), 464 reinterpret_cast<const uint16_t*>(field.getBuffer()),
465 field.length())), 465 field.length())),
466 false); 466 false);
467 467
468 JSObject::AddProperty(element, factory->value_string(), value, NONE); 468 JSObject::AddProperty(element, factory->value_string(), value, NONE);
469 RETURN_ON_EXCEPTION_VALUE( 469 RETURN_ON_EXCEPTION_VALUE(
470 isolate, JSObject::AddDataElement(array, index, element, NONE), false); 470 isolate, JSObject::AddDataElement(array, index, element, NONE), false);
471 return true; 471 return true;
472 } 472 }
473 473
474 #if 0
475 RUNTIME_FUNCTION(Runtime_UpdateTimezoneInDateFormat) {
476 HandleScope scope(isolate);
477
478 DCHECK(args.length() == 1);
479 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0);
480
481 // TODO(jshin): Updating the timezone of |date_format| everytime cached
482 // DateFormat is used is not optimal. date_format_holder can be
483 // changed to store DATE_CACHE_VERSION and update the timezone in
484 // |date_format| only when the stored DATE_CACHE_VERSION is different from
485 // the current DATE_CACHE_VERSION.
486 icu::SimpleDateFormat* date_format =
487 DateFormat::UnpackDateFormat(isolate, date_format_holder);
488 if (!date_format) return isolate->ThrowIllegalOperation();
489
490 date_format->adoptTimeZone(icu::TimeZone::createDefault());
491 return isolate->heap()->true_value();
492 }
493 #endif
494
474 } // namespace 495 } // namespace
475 496
476 RUNTIME_FUNCTION(Runtime_InternalDateFormatToParts) { 497 RUNTIME_FUNCTION(Runtime_InternalDateFormatToParts) {
477 HandleScope scope(isolate); 498 HandleScope scope(isolate);
478 Factory* factory = isolate->factory(); 499 Factory* factory = isolate->factory();
479 500
480 DCHECK(args.length() == 2); 501 DCHECK(args.length() == 2);
481 502
482 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0); 503 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0);
483 CONVERT_ARG_HANDLE_CHECKED(JSDate, date, 1); 504 CONVERT_ARG_HANDLE_CHECKED(JSDate, date, 1);
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 Handle<FixedArray> date_cache_version = 1222 Handle<FixedArray> date_cache_version =
1202 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton( 1223 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton(
1203 EternalHandles::DATE_CACHE_VERSION)); 1224 EternalHandles::DATE_CACHE_VERSION));
1204 return date_cache_version->get(0); 1225 return date_cache_version->get(0);
1205 } 1226 }
1206 1227
1207 } // namespace internal 1228 } // namespace internal
1208 } // namespace v8 1229 } // namespace v8
1209 1230
1210 #endif // V8_I18N_SUPPORT 1231 #endif // V8_I18N_SUPPORT
OLDNEW
« no previous file with comments | « src/js/i18n.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698