Line data Source code
1 : // Copyright 2018 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 : #ifndef V8_OBJECTS_HEAP_NUMBER_INL_H_
6 : #define V8_OBJECTS_HEAP_NUMBER_INL_H_
7 :
8 : #include "src/objects/heap-number.h"
9 :
10 : #include "src/objects-inl.h"
11 : #include "src/objects/heap-object-inl.h"
12 :
13 : // Has to be the last include (doesn't have include guards):
14 : #include "src/objects/object-macros.h"
15 :
16 : namespace v8 {
17 : namespace internal {
18 :
19 : OBJECT_CONSTRUCTORS_IMPL(HeapNumberBase, HeapObject)
20 18277174 : OBJECT_CONSTRUCTORS_IMPL(HeapNumber, HeapNumberBase)
21 69174 : OBJECT_CONSTRUCTORS_IMPL(MutableHeapNumber, HeapNumberBase)
22 :
23 9138588 : CAST_ACCESSOR(HeapNumber)
24 34587 : CAST_ACCESSOR(MutableHeapNumber)
25 :
26 6317 : double HeapNumberBase::value() const {
27 19970423 : return READ_DOUBLE_FIELD(*this, kValueOffset);
28 : }
29 :
30 224 : void HeapNumberBase::set_value(double value) {
31 4415313 : WRITE_DOUBLE_FIELD(*this, kValueOffset, value);
32 224 : }
33 :
34 : uint64_t HeapNumberBase::value_as_bits() const {
35 51049 : return READ_UINT64_FIELD(*this, kValueOffset);
36 : }
37 :
38 56 : void HeapNumberBase::set_value_as_bits(uint64_t bits) {
39 23161 : WRITE_UINT64_FIELD(*this, kValueOffset, bits);
40 56 : }
41 :
42 : int HeapNumberBase::get_exponent() {
43 : return ((READ_INT_FIELD(*this, kExponentOffset) & kExponentMask) >>
44 : kExponentShift) -
45 : kExponentBias;
46 : }
47 :
48 : int HeapNumberBase::get_sign() {
49 : return READ_INT_FIELD(*this, kExponentOffset) & kSignMask;
50 : }
51 :
52 : } // namespace internal
53 : } // namespace v8
54 :
55 : #include "src/objects/object-macros-undef.h"
56 :
57 : #endif // V8_OBJECTS_HEAP_NUMBER_INL_H_
|