1 // Copyright 2014 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.
5 #ifndef V8_PROPERTY_DETAILS_INL_H_
6 #define V8_PROPERTY_DETAILS_INL_H_
8 #include "src/conversions.h"
9 #include "src/objects.h"
10 #include "src/property-details.h"
11 #include "src/types.h"
16 inline bool Representation::CanContainDouble(double value) {
17 if (IsDouble() || is_more_general_than(Representation::Double())) {
20 if (IsInt32Double(value)) {
21 if (IsInteger32()) return true;
22 if (IsSmi()) return Smi::IsValid(static_cast<int32_t>(value));
28 Representation Representation::FromType(Type* type) {
29 DisallowHeapAllocation no_allocation;
30 if (type->Is(Type::None())) return Representation::None();
31 if (type->Is(Type::SignedSmall())) return Representation::Smi();
32 if (type->Is(Type::Signed32())) return Representation::Integer32();
33 if (type->Is(Type::Number())) return Representation::Double();
34 return Representation::Tagged();
37 } } // namespace v8::internal
39 #endif // V8_PROPERTY_DETAILS_INL_H_