forked from microsoft/hermes-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JSDate.cpp
48 lines (40 loc) · 1.32 KB
/
JSDate.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "hermes/VM/JSDate.h"
#include "hermes/VM/BuildMetadata.h"
#include "hermes/VM/Runtime-inline.h"
namespace hermes {
namespace vm {
//===----------------------------------------------------------------------===//
// class JSDate
const ObjectVTable JSDate::vt{
VTable(CellKind::DateKind, cellSize<JSDate>()),
JSDate::_getOwnIndexedRangeImpl,
JSDate::_haveOwnIndexedImpl,
JSDate::_getOwnIndexedPropertyFlagsImpl,
JSDate::_getOwnIndexedImpl,
JSDate::_setOwnIndexedImpl,
JSDate::_deleteOwnIndexedImpl,
JSDate::_checkAllOwnIndexedImpl,
};
void DateBuildMeta(const GCCell *cell, Metadata::Builder &mb) {
mb.addJSObjectOverlapSlots(JSObject::numOverlapSlots<JSDate>());
ObjectBuildMeta(cell, mb);
mb.setVTable(&JSDate::vt.base);
}
PseudoHandle<JSDate>
JSDate::create(Runtime *runtime, double value, Handle<JSObject> parentHandle) {
auto *cell = runtime->makeAFixed<JSDate>(
runtime,
value,
parentHandle,
runtime->getHiddenClassForPrototype(
*parentHandle, numOverlapSlots<JSDate>()));
return JSObjectInit::initToPseudoHandle(runtime, cell);
}
} // namespace vm
} // namespace hermes