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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/test-date.cc » ('j') | 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 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions-inl.h" 8 #include "src/conversions-inl.h"
9 #include "src/date.h" 9 #include "src/date.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 18 matching lines...) Expand all
29 NewTypeError(MessageTemplate::kNotDateObject)); 29 NewTypeError(MessageTemplate::kNotDateObject));
30 } 30 }
31 31
32 32
33 RUNTIME_FUNCTION(Runtime_DateCurrentTime) { 33 RUNTIME_FUNCTION(Runtime_DateCurrentTime) {
34 HandleScope scope(isolate); 34 HandleScope scope(isolate);
35 DCHECK_EQ(0, args.length()); 35 DCHECK_EQ(0, args.length());
36 return *isolate->factory()->NewNumber(JSDate::CurrentTimeValue(isolate)); 36 return *isolate->factory()->NewNumber(JSDate::CurrentTimeValue(isolate));
37 } 37 }
38 38
39 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.
40 HandleScope scope(isolate);
41 DCHECK_EQ(0, args.length());
42 if (isolate->serializer_enabled()) return isolate->heap()->undefined_value();
43 if (!isolate->eternal_handles()->Exists(EternalHandles::DATE_CACHE_VERSION)) {
44 Handle<FixedArray> date_cache_version =
45 isolate->factory()->NewFixedArray(1, TENURED);
46 date_cache_version->set(0, Smi::FromInt(0));
47 isolate->eternal_handles()->CreateSingleton(
48 isolate, *date_cache_version, EternalHandles::DATE_CACHE_VERSION);
49 }
50 Handle<FixedArray> date_cache_version =
51 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton(
52 EternalHandles::DATE_CACHE_VERSION));
53 // Return result as a JS array.
54 Handle<JSObject> result =
55 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
56 JSArray::SetContent(Handle<JSArray>::cast(result), date_cache_version);
57 return *result;
58 }
59
39 } // namespace internal 60 } // namespace internal
40 } // namespace v8 61 } // namespace v8
OLDNEW
« 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