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 #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 Loading... | |
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 |
OLD | NEW |