Lines Matching defs:Smi
17 // Smi represents integer Numbers that can be stored in 31 bits.
22 // Smi stands for small integer.
23 class Smi : public Object {
27 constexpr Smi() : Object() {}
28 explicit constexpr Smi(Address ptr) : Object(ptr) {
34 inline Smi ToUint32Smi() {
35 if (value() <= 0) return Smi::FromInt(0);
36 return Smi::FromInt(static_cast<uint32_t>(value()));
39 // Convert a Smi object to an int.
41 return Smi::cast(object).value();
44 // Convert a value to a Smi object.
45 static inline constexpr Smi FromInt(int value) {
46 DCHECK(Smi::IsValid(value));
47 return Smi(Internals::IntToSmi(value));
50 static inline Smi FromIntptr(intptr_t value) {
51 DCHECK(Smi::IsValid(value));
53 return Smi((static_cast<Address>(value) << smi_shift_bits) | kSmiTag);
56 // Given {value} in [0, 2^31-1], force it into Smi range by changing at most
58 static inline Smi From31BitPattern(int value) {
59 return Smi::FromInt((value << (32 - kSmiValueSize)) >>
65 static inline Smi FromEnum(E value) {
70 // Returns whether value can be represented in a Smi.
82 // Returns the result (a tagged Smi) as a raw Address for ExternalReference
84 V8_EXPORT_PRIVATE static Address LexicographicCompare(Isolate* isolate, Smi x,
85 Smi y);
87 DECL_CAST(Smi)
91 DECL_VERIFIER(Smi)
95 static inline constexpr Smi zero() { return Smi::FromInt(0); }
99 // Smi value for filling in not-yet initialized tagged field values with a
110 static constexpr Smi uninitialized_deserialization_value() {
111 return Smi(kNullAddress);
115 CAST_ACCESSOR(Smi)