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

Unified Diff: src/runtime/runtime-date.cc

Issue 1985423003: Invalidate defaultObjects if timezone changes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: added unit test for function DateCacheVersion Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/test-date.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-date.cc
diff --git a/src/runtime/runtime-date.cc b/src/runtime/runtime-date.cc
index 96292ad1c5fb50fbab87ab530d15923c070bf6a5..bea5562d464af8b1e426f26e33010cac239f8e5d 100644
--- a/src/runtime/runtime-date.cc
+++ b/src/runtime/runtime-date.cc
@@ -36,5 +36,26 @@ RUNTIME_FUNCTION(Runtime_DateCurrentTime) {
return *isolate->factory()->NewNumber(JSDate::CurrentTimeValue(isolate));
}
+RUNTIME_FUNCTION(Runtime_DateCacheVersion) {
Dan Ehrenberg 2016/05/18 17:39:57 If this is only used by Intl, better to put it in
pgorszkowski 2016/05/20 13:14:00 Done.
+ HandleScope scope(isolate);
+ DCHECK_EQ(0, args.length());
+ if (isolate->serializer_enabled()) return isolate->heap()->undefined_value();
+ if (!isolate->eternal_handles()->Exists(EternalHandles::DATE_CACHE_VERSION)) {
+ Handle<FixedArray> date_cache_version =
+ isolate->factory()->NewFixedArray(1, TENURED);
+ date_cache_version->set(0, Smi::FromInt(0));
+ isolate->eternal_handles()->CreateSingleton(
+ isolate, *date_cache_version, EternalHandles::DATE_CACHE_VERSION);
+ }
+ Handle<FixedArray> date_cache_version =
+ Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton(
+ EternalHandles::DATE_CACHE_VERSION));
+ // Return result as a JS array.
+ Handle<JSObject> result =
+ isolate->factory()->NewJSObject(isolate->array_function());
Dan Ehrenberg 2016/05/18 17:39:57 Why is this wrapped in an array, rather than just
pgorszkowski 2016/05/19 11:07:57 Currently it is kept as FixedArray, should we chan
+ JSArray::SetContent(Handle<JSArray>::cast(result), date_cache_version);
+ return *result;
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/test-date.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698