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/handles/handles.h" 11 #include "src/heap/heap-write-barrier-inl.h" 12 #include "src/objects/objects-inl.h" 13 #include "src/objects/string-inl.h" 14 15 // Has to be the last include (doesn't have include guards): 16 #include "src/objects/object-macros.h" 17 18 namespace v8 { 19 namespace internal { 20 21 #include "torque-generated/src/objects/oddball-tq-inl.inc" 22 TQ_OBJECT_CONSTRUCTORS_IMPL(Oddball)23TQ_OBJECT_CONSTRUCTORS_IMPL(Oddball) 24 25 void Oddball::set_to_number_raw_as_bits(uint64_t bits) { 26 // Bug(v8:8875): HeapNumber's double may be unaligned. 27 base::WriteUnalignedValue<uint64_t>(field_address(kToNumberRawOffset), bits); 28 } 29 kind()30byte Oddball::kind() const { return TorqueGeneratedOddball::kind(); } 31 set_kind(byte value)32void Oddball::set_kind(byte value) { TorqueGeneratedOddball::set_kind(value); } 33 34 // static ToNumber(Isolate * isolate,Handle<Oddball> input)35Handle<Object> Oddball::ToNumber(Isolate* isolate, Handle<Oddball> input) { 36 return Handle<Object>(input->to_number(), isolate); 37 } 38 DEF_GETTER(HeapObject,IsBoolean,bool)39DEF_GETTER(HeapObject, IsBoolean, bool) { 40 return IsOddball(isolate) && 41 ((Oddball::cast(*this).kind() & Oddball::kNotBooleanMask) == 0); 42 } 43 44 } // namespace internal 45 } // namespace v8 46 47 #include "src/objects/object-macros-undef.h" 48 49 #endif // V8_OBJECTS_ODDBALL_INL_H_ 50