Home | History | Annotate | Download | only in runtime
      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 RUNTIME_FUNCTION(Runtime_IsDate) {
     18   SealHandleScope shs(isolate);
     19   DCHECK_EQ(1, args.length());
     20   CONVERT_ARG_CHECKED(Object, obj, 0);
     21   return isolate->heap()->ToBoolean(obj->IsJSDate());
     22 }
     23 
     24 
     25 RUNTIME_FUNCTION(Runtime_ThrowNotDateError) {
     26   HandleScope scope(isolate);
     27   DCHECK_EQ(0, args.length());
     28   THROW_NEW_ERROR_RETURN_FAILURE(isolate,
     29                                  NewTypeError(MessageTemplate::kNotDateObject));
     30 }
     31 
     32 
     33 RUNTIME_FUNCTION(Runtime_DateCurrentTime) {
     34   HandleScope scope(isolate);
     35   DCHECK_EQ(0, args.length());
     36   return *isolate->factory()->NewNumber(JSDate::CurrentTimeValue(isolate));
     37 }
     38 
     39 }  // namespace internal
     40 }  // namespace v8
     41