v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
oddball-inl.h
Go to the documentation of this file.
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
9// Include the non-inl header before the rest of the headers.
10
11#include "src/handles/handles.h"
15
16// Has to be the last include (doesn't have include guards):
18
19namespace v8 {
20namespace internal {
21
22double Oddball::to_number_raw() const { return to_number_raw_.value(); }
23void Oddball::set_to_number_raw(double value) {
25}
26
28 // Bug(v8:8875): HeapNumber's double may be unaligned.
30}
31
34 to_string_.store(this, value, mode);
35}
36
39 to_number_.store(this, value, mode);
40}
41
42Tagged<String> Oddball::type_of() const { return type_of_.load(); }
44 type_of_.store(this, value, mode);
45}
46
47uint8_t Oddball::kind() const { return kind_.load().value(); }
48
49void Oddball::set_kind(uint8_t value) {
50 kind_.store(this, Smi::FromInt(value));
51}
52
53// static
56 return handle(input->to_number(), isolate);
57}
58
60 return IsOddball(obj, cage_base) &&
61 ((Cast<Oddball>(obj)->kind() & Oddball::kNotBooleanMask) == 0);
62}
63
64bool Boolean::ToBool(Isolate* isolate) const {
65 DCHECK(IsBoolean(this, isolate));
66 return IsTrue(this, isolate);
67}
68
69} // namespace internal
70} // namespace v8
71
73
74#endif // V8_OBJECTS_ODDBALL_INL_H_
V8_INLINE bool ToBool(Isolate *isolate) const
Definition oddball-inl.h:64
TaggedMember< Smi > kind_
Definition oddball.h:73
void set_kind(uint8_t kind)
Definition oddball-inl.h:49
static V8_WARN_UNUSED_RESULT Handle< Number > ToNumber(Isolate *isolate, DirectHandle< Oddball > input)
Definition oddball-inl.h:54
void set_to_number(Tagged< Number > value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Definition oddball-inl.h:38
void set_to_string(Tagged< String > value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Definition oddball-inl.h:33
Tagged< String > type_of() const
Definition oddball-inl.h:42
Tagged< String > to_string() const
Definition oddball-inl.h:32
uint8_t kind() const
Definition oddball-inl.h:47
void set_type_of(Tagged< String > value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Definition oddball-inl.h:43
TaggedMember< Number > to_number_
Definition oddball.h:71
Tagged< Number > to_number() const
Definition oddball-inl.h:37
void set_to_number_raw_as_bits(uint64_t bits)
Definition oddball-inl.h:27
TaggedMember< String > type_of_
Definition oddball.h:72
TaggedMember< String > to_string_
Definition oddball.h:70
static constexpr uint8_t kNotBooleanMask
Definition oddball.h:55
UnalignedDoubleMember to_number_raw_
Definition oddball.h:69
static constexpr Tagged< Smi > FromInt(int value)
Definition smi.h:38
void set_value_as_bits(uint64_t value)
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
Definition handles-inl.h:72
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Definition casting.h:150
#define DEF_HEAP_OBJECT_PREDICATE(holder, name)
#define DCHECK(condition)
Definition logging.h:482