Line data Source code
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
3 : // found in the LICENSE file.
4 :
5 : #include "src/runtime/runtime-utils.h"
6 :
7 : #include "src/arguments.h"
8 : #include "src/conversions-inl.h"
9 : #include "src/date.h"
10 : #include "src/factory.h"
11 : #include "src/isolate-inl.h"
12 : #include "src/messages.h"
13 :
14 : namespace v8 {
15 : namespace internal {
16 :
17 2318826 : RUNTIME_FUNCTION(Runtime_IsDate) {
18 : SealHandleScope shs(isolate);
19 : DCHECK_EQ(1, args.length());
20 1159413 : CONVERT_ARG_CHECKED(Object, obj, 0);
21 1159413 : return isolate->heap()->ToBoolean(obj->IsJSDate());
22 : }
23 :
24 :
25 10500 : RUNTIME_FUNCTION(Runtime_ThrowNotDateError) {
26 5250 : HandleScope scope(isolate);
27 : DCHECK_EQ(0, args.length());
28 10500 : THROW_NEW_ERROR_RETURN_FAILURE(isolate,
29 5250 : NewTypeError(MessageTemplate::kNotDateObject));
30 : }
31 :
32 :
33 44 : RUNTIME_FUNCTION(Runtime_DateCurrentTime) {
34 22 : HandleScope scope(isolate);
35 : DCHECK_EQ(0, args.length());
36 44 : return *isolate->factory()->NewNumber(JSDate::CurrentTimeValue(isolate));
37 : }
38 :
39 : } // namespace internal
40 : } // namespace v8
|