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_ODDBALL_INL_H_
6 : #define V8_OBJECTS_ODDBALL_INL_H_
7 :
8 : #include "src/objects/oddball.h"
9 :
10 : #include "src/heap/heap-write-barrier-inl.h"
11 :
12 : // Has to be the last include (doesn't have include guards):
13 : #include "src/objects/object-macros.h"
14 :
15 : namespace v8 {
16 : namespace internal {
17 :
18 12208710602 : OBJECT_CONSTRUCTORS_IMPL(Oddball, HeapObject)
19 :
20 6104728499 : CAST_ACCESSOR(Oddball)
21 :
22 : double Oddball::to_number_raw() const {
23 : return READ_DOUBLE_FIELD(this, kToNumberRawOffset);
24 : }
25 :
26 : void Oddball::set_to_number_raw(double value) {
27 560 : WRITE_DOUBLE_FIELD(this, kToNumberRawOffset, value);
28 : }
29 :
30 : void Oddball::set_to_number_raw_as_bits(uint64_t bits) {
31 112 : WRITE_UINT64_FIELD(this, kToNumberRawOffset, bits);
32 : }
33 :
34 8102097 : ACCESSORS(Oddball, to_string, String, kToStringOffset)
35 9378099 : ACCESSORS(Oddball, to_number, Object, kToNumberOffset)
36 8076 : ACCESSORS(Oddball, type_of, String, kTypeOfOffset)
37 :
38 40400842 : byte Oddball::kind() const { return Smi::ToInt(READ_FIELD(this, kKindOffset)); }
39 :
40 : void Oddball::set_kind(byte value) {
41 952 : WRITE_FIELD(this, kKindOffset, Smi::FromInt(value));
42 : }
43 :
44 : // static
45 3124913 : Handle<Object> Oddball::ToNumber(Isolate* isolate, Handle<Oddball> input) {
46 6249826 : return handle(input->to_number(), isolate);
47 : }
48 :
49 : } // namespace internal
50 : } // namespace v8
51 :
52 : #include "src/objects/object-macros-undef.h"
53 :
54 : #endif // V8_OBJECTS_ODDBALL_INL_H_
|