Commit 099271a1 authored by verwaest's avatar verwaest Committed by Commit bot

[runtime] Move heap-object type check helpers to HeapObject with wrapper on Object

BUG=

Review URL: https://codereview.chromium.org/1694403002

Cr-Commit-Position: refs/heads/master@{#34034}
parent 4a58b46e
......@@ -2646,7 +2646,7 @@ void Heap::CreateInitialObjects() {
set_arguments_marker(
*factory->NewOddball(factory->arguments_marker_map(), "arguments_marker",
handle(Smi::FromInt(-4), isolate()), "undefined",
Oddball::kArgumentMarker));
Oddball::kArgumentsMarker));
set_no_interceptor_result_sentinel(*factory->NewOddball(
factory->no_interceptor_result_sentinel_map(),
......
......@@ -94,7 +94,7 @@ void MarkCompactCollector::ForceRecordSlot(HeapObject* object, Object** slot,
void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) {
if (GetNextCandidate(shared_info) == NULL) {
if (GetNextCandidate(shared_info) == nullptr) {
SetNextCandidate(shared_info, shared_function_info_candidates_head_);
shared_function_info_candidates_head_ = shared_info;
}
......@@ -103,7 +103,7 @@ void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) {
void CodeFlusher::AddCandidate(JSFunction* function) {
DCHECK(function->code() == function->shared()->code());
if (GetNextCandidate(function)->IsUndefined()) {
if (function->next_function_link()->IsUndefined()) {
SetNextCandidate(function, jsfunction_candidates_head_);
jsfunction_candidates_head_ = function;
}
......
......@@ -54,14 +54,11 @@ int PropertyDetails::field_width_in_words() const {
return representation().IsDouble() ? kDoubleSize / kPointerSize : 1;
}
#define TYPE_CHECKER(type, instancetype) \
bool Object::Is##type() const { \
return Object::IsHeapObject() && \
HeapObject::cast(this)->map()->instance_type() == instancetype; \
bool HeapObject::Is##type() const { \
return map()->instance_type() == instancetype; \
}
#define CAST_ACCESSOR(type) \
type* type::cast(Object* object) { \
SLOW_DCHECK(object->Is##type()); \
......@@ -128,25 +125,20 @@ int PropertyDetails::field_width_in_words() const {
set_##field(BooleanBit::set(field(), offset, value)); \
}
bool Object::IsFixedArrayBase() const {
bool HeapObject::IsFixedArrayBase() const {
return IsFixedArray() || IsFixedDoubleArray() || IsFixedTypedArrayBase();
}
bool Object::IsFixedArray() const {
if (!IsHeapObject()) return false;
InstanceType instance_type = HeapObject::cast(this)->map()->instance_type();
bool HeapObject::IsFixedArray() const {
InstanceType instance_type = map()->instance_type();
return instance_type == FIXED_ARRAY_TYPE ||
instance_type == TRANSITION_ARRAY_TYPE;
}
// External objects are not extensible, so the map check is enough.
bool Object::IsExternal() const {
return Object::IsHeapObject() &&
HeapObject::cast(this)->map() ==
HeapObject::cast(this)->GetHeap()->external_map();
bool HeapObject::IsExternal() const {
return map() == GetHeap()->external_map();
}
......@@ -155,113 +147,90 @@ TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE)
TYPE_CHECKER(Symbol, SYMBOL_TYPE)
TYPE_CHECKER(Simd128Value, SIMD128_VALUE_TYPE)
#define SIMD128_TYPE_CHECKER(TYPE, Type, type, lane_count, lane_type) \
bool Object::Is##Type() const { \
return Object::IsHeapObject() && \
HeapObject::cast(this)->map() == \
HeapObject::cast(this)->GetHeap()->type##_map(); \
}
bool HeapObject::Is##Type() const { return map() == GetHeap()->type##_map(); }
SIMD128_TYPES(SIMD128_TYPE_CHECKER)
#undef SIMD128_TYPE_CHECKER
#define IS_TYPE_FUNCTION_DEF(type_) \
bool Object::Is##type_() const { \
return IsHeapObject() && HeapObject::cast(this)->Is##type_(); \
}
HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF)
ODDBALL_LIST(IS_TYPE_FUNCTION_DEF)
#undef IS_TYPE_FUNCTION_DEF
bool Object::IsString() const {
return Object::IsHeapObject()
&& HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE;
bool HeapObject::IsString() const {
return map()->instance_type() < FIRST_NONSTRING_TYPE;
}
bool Object::IsName() const {
STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE);
return Object::IsHeapObject() &&
HeapObject::cast(this)->map()->instance_type() <= LAST_NAME_TYPE;
bool HeapObject::IsName() const {
return map()->instance_type() <= LAST_NAME_TYPE;
}
bool Object::IsUniqueName() const {
bool HeapObject::IsUniqueName() const {
return IsInternalizedString() || IsSymbol();
}
bool Object::IsFunction() const {
bool HeapObject::IsFunction() const {
STATIC_ASSERT(LAST_FUNCTION_TYPE == LAST_TYPE);
return Object::IsHeapObject() &&
HeapObject::cast(this)->map()->instance_type() >= FIRST_FUNCTION_TYPE;
return map()->instance_type() >= FIRST_FUNCTION_TYPE;
}
bool HeapObject::IsCallable() const { return map()->is_callable(); }
bool Object::IsCallable() const {
return Object::IsHeapObject() && HeapObject::cast(this)->map()->is_callable();
}
bool Object::IsConstructor() const {
return Object::IsHeapObject() &&
HeapObject::cast(this)->map()->is_constructor();
}
bool HeapObject::IsConstructor() const { return map()->is_constructor(); }
bool Object::IsTemplateInfo() const {
bool HeapObject::IsTemplateInfo() const {
return IsObjectTemplateInfo() || IsFunctionTemplateInfo();
}
bool Object::IsInternalizedString() const {
if (!this->IsHeapObject()) return false;
uint32_t type = HeapObject::cast(this)->map()->instance_type();
bool HeapObject::IsInternalizedString() const {
uint32_t type = map()->instance_type();
STATIC_ASSERT(kNotInternalizedTag != 0);
return (type & (kIsNotStringMask | kIsNotInternalizedMask)) ==
(kStringTag | kInternalizedTag);
}
bool Object::IsConsString() const {
bool HeapObject::IsConsString() const {
if (!IsString()) return false;
return StringShape(String::cast(this)).IsCons();
}
bool Object::IsSlicedString() const {
bool HeapObject::IsSlicedString() const {
if (!IsString()) return false;
return StringShape(String::cast(this)).IsSliced();
}
bool Object::IsSeqString() const {
bool HeapObject::IsSeqString() const {
if (!IsString()) return false;
return StringShape(String::cast(this)).IsSequential();
}
bool Object::IsSeqOneByteString() const {
bool HeapObject::IsSeqOneByteString() const {
if (!IsString()) return false;
return StringShape(String::cast(this)).IsSequential() &&
String::cast(this)->IsOneByteRepresentation();
}
bool Object::IsSeqTwoByteString() const {
bool HeapObject::IsSeqTwoByteString() const {
if (!IsString()) return false;
return StringShape(String::cast(this)).IsSequential() &&
String::cast(this)->IsTwoByteRepresentation();
}
bool Object::IsExternalString() const {
bool HeapObject::IsExternalString() const {
if (!IsString()) return false;
return StringShape(String::cast(this)).IsExternal();
}
bool Object::IsExternalOneByteString() const {
bool HeapObject::IsExternalOneByteString() const {
if (!IsString()) return false;
return StringShape(String::cast(this)).IsExternal() &&
String::cast(this)->IsOneByteRepresentation();
}
bool Object::IsExternalTwoByteString() const {
bool HeapObject::IsExternalTwoByteString() const {
if (!IsString()) return false;
return StringShape(String::cast(this)).IsExternal() &&
String::cast(this)->IsTwoByteRepresentation();
......@@ -661,10 +630,8 @@ TYPE_CHECKER(ByteArray, BYTE_ARRAY_TYPE)
TYPE_CHECKER(BytecodeArray, BYTECODE_ARRAY_TYPE)
TYPE_CHECKER(FreeSpace, FREE_SPACE_TYPE)
bool Object::IsFiller() const {
if (!Object::IsHeapObject()) return false;
InstanceType instance_type = HeapObject::cast(this)->map()->instance_type();
bool HeapObject::IsFiller() const {
InstanceType instance_type = map()->instance_type();
return instance_type == FREE_SPACE_TYPE || instance_type == FILLER_TYPE;
}
......@@ -676,35 +643,23 @@ bool Object::IsFiller() const {
TYPED_ARRAYS(TYPED_ARRAY_TYPE_CHECKER)
#undef TYPED_ARRAY_TYPE_CHECKER
bool Object::IsFixedTypedArrayBase() const {
if (!Object::IsHeapObject()) return false;
InstanceType instance_type =
HeapObject::cast(this)->map()->instance_type();
bool HeapObject::IsFixedTypedArrayBase() const {
InstanceType instance_type = map()->instance_type();
return (instance_type >= FIRST_FIXED_TYPED_ARRAY_TYPE &&
instance_type <= LAST_FIXED_TYPED_ARRAY_TYPE);
}
bool Object::IsJSReceiver() const {
bool HeapObject::IsJSReceiver() const {
STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
return IsHeapObject() &&
HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_RECEIVER_TYPE;
return map()->instance_type() >= FIRST_JS_RECEIVER_TYPE;
}
bool Object::IsJSObject() const {
bool HeapObject::IsJSObject() const {
STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE);
return IsHeapObject() && HeapObject::cast(this)->map()->IsJSObjectMap();
}
bool Object::IsJSProxy() const {
if (!Object::IsHeapObject()) return false;
return HeapObject::cast(this)->map()->IsJSProxyMap();
return map()->IsJSObjectMap();
}
bool HeapObject::IsJSProxy() const { return map()->IsJSProxyMap(); }
TYPE_CHECKER(JSSet, JS_SET_TYPE)
TYPE_CHECKER(JSMap, JS_MAP_TYPE)
......@@ -718,35 +673,25 @@ TYPE_CHECKER(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE)
TYPE_CHECKER(WeakFixedArray, FIXED_ARRAY_TYPE)
TYPE_CHECKER(TransitionArray, TRANSITION_ARRAY_TYPE)
bool Object::IsJSWeakCollection() const {
bool HeapObject::IsJSWeakCollection() const {
return IsJSWeakMap() || IsJSWeakSet();
}
bool HeapObject::IsDescriptorArray() const { return IsFixedArray(); }
bool Object::IsDescriptorArray() const {
return IsFixedArray();
}
bool Object::IsArrayList() const { return IsFixedArray(); }
bool HeapObject::IsArrayList() const { return IsFixedArray(); }
bool Object::IsLayoutDescriptor() const {
return IsSmi() || IsFixedTypedArrayBase();
}
bool HeapObject::IsTypeFeedbackVector() const { return IsFixedArray(); }
bool Object::IsTypeFeedbackVector() const { return IsFixedArray(); }
bool Object::IsTypeFeedbackMetadata() const { return IsFixedArray(); }
bool Object::IsLiteralsArray() const { return IsFixedArray(); }
bool HeapObject::IsTypeFeedbackMetadata() const { return IsFixedArray(); }
bool HeapObject::IsLiteralsArray() const { return IsFixedArray(); }
bool Object::IsDeoptimizationInputData() const {
bool HeapObject::IsDeoptimizationInputData() const {
// Must be a fixed array.
if (!IsFixedArray()) return false;
......@@ -761,8 +706,7 @@ bool Object::IsDeoptimizationInputData() const {
return length >= 0 && length % DeoptimizationInputData::kDeoptEntrySize == 0;
}
bool Object::IsDeoptimizationOutputData() const {
bool HeapObject::IsDeoptimizationOutputData() const {
if (!IsFixedArray()) return false;
// There's actually no way to see the difference between a fixed array and
// a deoptimization data array. Since this is used for asserts we can check
......@@ -771,27 +715,23 @@ bool Object::IsDeoptimizationOutputData() const {
return true;
}
bool Object::IsHandlerTable() const {
bool HeapObject::IsHandlerTable() const {
if (!IsFixedArray()) return false;
// There's actually no way to see the difference between a fixed array and
// a handler table array.
return true;
}
bool Object::IsDependentCode() const {
bool HeapObject::IsDependentCode() const {
if (!IsFixedArray()) return false;
// There's actually no way to see the difference between a fixed array and
// a dependent codes array.
return true;
}
bool Object::IsContext() const {
if (!Object::IsHeapObject()) return false;
Map* map = HeapObject::cast(this)->map();
Heap* heap = map->GetHeap();
bool HeapObject::IsContext() const {
Map* map = this->map();
Heap* heap = GetHeap();
return (map == heap->function_context_map() ||
map == heap->catch_context_map() ||
map == heap->with_context_map() ||
......@@ -801,26 +741,16 @@ bool Object::IsContext() const {
map == heap->script_context_map());
}
bool Object::IsNativeContext() const {
return Object::IsHeapObject() &&
HeapObject::cast(this)->map() ==
HeapObject::cast(this)->GetHeap()->native_context_map();
bool HeapObject::IsNativeContext() const {
return map() == GetHeap()->native_context_map();
}
bool Object::IsScriptContextTable() const {
if (!Object::IsHeapObject()) return false;
Map* map = HeapObject::cast(this)->map();
Heap* heap = map->GetHeap();
return map == heap->script_context_table_map();
bool HeapObject::IsScriptContextTable() const {
return map() == GetHeap()->script_context_table_map();
}
bool Object::IsScopeInfo() const {
return Object::IsHeapObject() &&
HeapObject::cast(this)->map() ==
HeapObject::cast(this)->GetHeap()->scope_info_map();
bool HeapObject::IsScopeInfo() const {
return map() == GetHeap()->scope_info_map();
}
......@@ -845,17 +775,18 @@ TYPE_CHECKER(JSValue, JS_VALUE_TYPE)
TYPE_CHECKER(JSDate, JS_DATE_TYPE)
TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE)
bool Object::IsAbstractCode() const { return IsBytecodeArray() || IsCode(); }
bool HeapObject::IsAbstractCode() const {
return IsBytecodeArray() || IsCode();
}
bool Object::IsStringWrapper() const {
bool HeapObject::IsStringWrapper() const {
return IsJSValue() && JSValue::cast(this)->value()->IsString();
}
TYPE_CHECKER(Foreign, FOREIGN_TYPE)
bool Object::IsBoolean() const {
bool HeapObject::IsBoolean() const {
return IsOddball() &&
((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0);
}
......@@ -866,8 +797,7 @@ TYPE_CHECKER(JSArrayBuffer, JS_ARRAY_BUFFER_TYPE)
TYPE_CHECKER(JSTypedArray, JS_TYPED_ARRAY_TYPE)
TYPE_CHECKER(JSDataView, JS_DATA_VIEW_TYPE)
bool Object::IsJSArrayBufferView() const {
bool HeapObject::IsJSArrayBufferView() const {
return IsJSDataView() || IsJSTypedArray();
}
......@@ -879,22 +809,14 @@ template <> inline bool Is<JSArray>(Object* obj) {
return obj->IsJSArray();
}
bool Object::IsHashTable() const {
return Object::IsHeapObject() &&
HeapObject::cast(this)->map() ==
HeapObject::cast(this)->GetHeap()->hash_table_map();
bool HeapObject::IsHashTable() const {
return map() == GetHeap()->hash_table_map();
}
bool HeapObject::IsWeakHashTable() const { return IsHashTable(); }
bool Object::IsWeakHashTable() const {
return IsHashTable();
}
bool Object::IsDictionary() const {
return IsHashTable() &&
this != HeapObject::cast(this)->GetHeap()->string_table();
bool HeapObject::IsDictionary() const {
return IsHashTable() && this != GetHeap()->string_table();
}
......@@ -915,13 +837,9 @@ bool Object::IsUnseededNumberDictionary() const {
return IsDictionary();
}
bool HeapObject::IsStringTable() const { return IsHashTable(); }
bool Object::IsStringTable() const {
return IsHashTable();
}
bool Object::IsNormalizedMapCache() const {
bool HeapObject::IsNormalizedMapCache() const {
return NormalizedMapCache::IsNormalizedMapCache(this);
}
......@@ -930,51 +848,34 @@ int NormalizedMapCache::GetIndex(Handle<Map> map) {
return map->Hash() % NormalizedMapCache::kEntries;
}
bool NormalizedMapCache::IsNormalizedMapCache(const Object* obj) {
bool NormalizedMapCache::IsNormalizedMapCache(const HeapObject* obj) {
if (!obj->IsFixedArray()) return false;
if (FixedArray::cast(obj)->length() != NormalizedMapCache::kEntries) {
return false;
}
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) {
reinterpret_cast<NormalizedMapCache*>(const_cast<Object*>(obj))->
NormalizedMapCacheVerify();
reinterpret_cast<NormalizedMapCache*>(const_cast<HeapObject*>(obj))
->NormalizedMapCacheVerify();
}
#endif
return true;
}
bool HeapObject::IsCompilationCacheTable() const { return IsHashTable(); }
bool Object::IsCompilationCacheTable() const {
return IsHashTable();
}
bool Object::IsCodeCacheHashTable() const {
return IsHashTable();
}
bool Object::IsPolymorphicCodeCacheHashTable() const {
return IsHashTable();
}
bool HeapObject::IsCodeCacheHashTable() const { return IsHashTable(); }
bool Object::IsMapCache() const {
bool HeapObject::IsPolymorphicCodeCacheHashTable() const {
return IsHashTable();
}
bool HeapObject::IsMapCache() const { return IsHashTable(); }
bool Object::IsObjectHashTable() const {
return IsHashTable();
}
bool HeapObject::IsObjectHashTable() const { return IsHashTable(); }
bool Object::IsOrderedHashTable() const {
return IsHeapObject() &&
HeapObject::cast(this)->map() ==
HeapObject::cast(this)->GetHeap()->ordered_hash_table_map();
bool HeapObject::IsOrderedHashTable() const {
return map() == GetHeap()->ordered_hash_table_map();
}
......@@ -992,40 +893,30 @@ bool Object::IsPrimitive() const {
return IsSmi() || HeapObject::cast(this)->map()->IsPrimitiveMap();
}
bool Object::IsJSGlobalProxy() const {
bool result = IsHeapObject() &&
(HeapObject::cast(this)->map()->instance_type() ==
JS_GLOBAL_PROXY_TYPE);
DCHECK(!result ||
HeapObject::cast(this)->map()->is_access_check_needed());
bool HeapObject::IsJSGlobalProxy() const {
bool result = map()->instance_type() == JS_GLOBAL_PROXY_TYPE;
DCHECK(!result || map()->is_access_check_needed());
return result;
}
TYPE_CHECKER(JSGlobalObject, JS_GLOBAL_OBJECT_TYPE)
bool Object::IsUndetectableObject() const {
return IsHeapObject()
&& HeapObject::cast(this)->map()->is_undetectable();
bool HeapObject::IsUndetectableObject() const {
return map()->is_undetectable();
}
bool Object::IsAccessCheckNeeded() const {
if (!IsHeapObject()) return false;
bool HeapObject::IsAccessCheckNeeded() const {
if (IsJSGlobalProxy()) {
const JSGlobalProxy* proxy = JSGlobalProxy::cast(this);
JSGlobalObject* global = proxy->GetIsolate()->context()->global_object();
return proxy->IsDetachedFrom(global);
}
return HeapObject::cast(this)->map()->is_access_check_needed();
return map()->is_access_check_needed();
}
bool Object::IsStruct() const {
if (!IsHeapObject()) return false;
switch (HeapObject::cast(this)->map()->instance_type()) {
bool HeapObject::IsStruct() const {
switch (map()->instance_type()) {
#define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return true;
STRUCT_LIST(MAKE_STRUCT_CASE)
#undef MAKE_STRUCT_CASE
......@@ -1033,56 +924,23 @@ bool Object::IsStruct() const {
}
}
#define MAKE_STRUCT_PREDICATE(NAME, Name, name) \
bool Object::Is##Name() const { \
return Object::IsHeapObject() \
&& HeapObject::cast(this)->map()->instance_type() == NAME##_TYPE; \
return IsHeapObject() && HeapObject::cast(this)->Is##Name(); \
} \
bool HeapObject::Is##Name() const { \
return map()->instance_type() == NAME##_TYPE; \
}
STRUCT_LIST(MAKE_STRUCT_PREDICATE)
STRUCT_LIST(MAKE_STRUCT_PREDICATE)
#undef MAKE_STRUCT_PREDICATE
#define MAKE_ODDBALL_PREDICATE(Name) \
bool HeapObject::Is##Name() const { \
return IsOddball() && Oddball::cast(this)->kind() == Oddball::k##Name; \
}
ODDBALL_LIST(MAKE_ODDBALL_PREDICATE)
bool Object::IsUndefined() const {
return IsOddball() && Oddball::cast(this)->kind() == Oddball::kUndefined;
}
bool Object::IsNull() const {
return IsOddball() && Oddball::cast(this)->kind() == Oddball::kNull;
}
bool Object::IsTheHole() const {
return IsOddball() && Oddball::cast(this)->kind() == Oddball::kTheHole;
}
bool Object::IsException() const {
return IsOddball() && Oddball::cast(this)->kind() == Oddball::kException;
}
bool Object::IsUninitialized() const {
return IsOddball() && Oddball::cast(this)->kind() == Oddball::kUninitialized;
}
bool Object::IsTrue() const {
return IsOddball() && Oddball::cast(this)->kind() == Oddball::kTrue;
}
bool Object::IsFalse() const {
return IsOddball() && Oddball::cast(this)->kind() == Oddball::kFalse;
}
bool Object::IsArgumentsMarker() const {
return IsOddball() && Oddball::cast(this)->kind() == Oddball::kArgumentMarker;
}
#undef MAKE_ODDBALL_PREDICATE
double Object::Number() const {
DCHECK(IsNumber());
return IsSmi()
......@@ -6766,15 +6624,13 @@ bool JSObject::HasFixedTypedArrayElements() {
return array->IsFixedTypedArrayBase();
}
#define FIXED_TYPED_ELEMENTS_CHECK(Type, type, TYPE, ctype, size) \
bool JSObject::HasFixed##Type##Elements() { \
bool JSObject::HasFixed##Type##Elements() { \
HeapObject* array = elements(); \
DCHECK(array != NULL); \
if (!array->IsHeapObject()) \
return false; \
if (!array->IsHeapObject()) return false; \
return array->map()->instance_type() == FIXED_##TYPE##_ARRAY_TYPE; \
}
}
TYPED_ARRAYS(FIXED_TYPED_ELEMENTS_CHECK)
......
......@@ -868,10 +868,11 @@ template <class C> inline bool Is(Object* obj);
#define DECLARE_PRINTER(Name)
#endif
#define OBJECT_TYPE_LIST(V) \
V(Smi) \
V(LayoutDescriptor) \
V(HeapObject) \
V(Primitive) \
V(Number)
#define HEAP_OBJECT_TYPE_LIST(V) \
......@@ -920,7 +921,6 @@ template <class C> inline bool Is(Object* obj);
V(JSContextExtensionObject) \
V(JSGeneratorObject) \
V(JSModule) \
V(LayoutDescriptor) \
V(Map) \
V(DescriptorArray) \
V(TransitionArray) \
......@@ -973,11 +973,18 @@ template <class C> inline bool Is(Object* obj);
V(CodeCacheHashTable) \
V(PolymorphicCodeCacheHashTable) \
V(MapCache) \
V(Primitive) \
V(JSGlobalObject) \
V(JSGlobalProxy) \
V(UndetectableObject) \
V(AccessCheckNeeded) \
V(Callable) \
V(Function) \
V(Constructor) \
V(TemplateInfo) \
V(Filler) \
V(FixedArrayBase) \
V(External) \
V(Struct) \
V(Cell) \
V(PropertyCell) \
V(WeakCell) \
......@@ -985,6 +992,16 @@ template <class C> inline bool Is(Object* obj);
V(WeakHashTable) \
V(OrderedHashTable)
#define ODDBALL_LIST(V) \
V(Undefined) \
V(Null) \
V(TheHole) \
V(Exception) \
V(Uninitialized) \
V(True) \
V(False) \
V(ArgumentsMarker)
// The element types selection for CreateListFromArrayLike.
enum class ElementTypes { kAll, kStringAndSymbol };
......@@ -1002,6 +1019,7 @@ class Object {
#define IS_TYPE_FUNCTION_DECL(type_) INLINE(bool Is##type_() const);
OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
#undef IS_TYPE_FUNCTION_DECL
// A non-keyed store is of the form a.x = foo or a["x"] = foo whereas
......@@ -1030,10 +1048,6 @@ class Object {
#define MAYBE_RETURN_NULL(call) MAYBE_RETURN(call, MaybeHandle<Object>())
INLINE(bool IsFixedArrayBase() const);
INLINE(bool IsExternal() const);
INLINE(bool IsStruct() const);
#define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \
INLINE(bool Is##Name() const);
STRUCT_LIST(DECLARE_STRUCT_PREDICATE)
......@@ -1042,16 +1056,6 @@ class Object {
// ES6, section 7.2.2 IsArray. NOT to be confused with %_IsArray.
MUST_USE_RESULT static Maybe<bool> IsArray(Handle<Object> object);
// Test for JSBoundFunction or JSFunction.
INLINE(bool IsFunction() const);
// ES6, section 7.2.3 IsCallable.
INLINE(bool IsCallable() const);
// ES6, section 7.2.4 IsConstructor.
INLINE(bool IsConstructor() const);
INLINE(bool IsTemplateInfo()) const;
INLINE(bool IsNameDictionary() const);
INLINE(bool IsGlobalDictionary() const);
INLINE(bool IsSeededNumberDictionary() const);
......@@ -1060,19 +1064,6 @@ class Object {
INLINE(bool IsOrderedHashMap() const);
static bool IsPromise(Handle<Object> object);
// Oddball testing.
INLINE(bool IsUndefined() const);
INLINE(bool IsNull() const);
INLINE(bool IsTheHole() const);
INLINE(bool IsException() const);
INLINE(bool IsUninitialized() const);
INLINE(bool IsTrue() const);
INLINE(bool IsFalse() const);
INLINE(bool IsArgumentsMarker() const);
// Filler objects (fillers and free space objects).
INLINE(bool IsFiller() const);
// Extract the number.
inline double Number() const;
INLINE(bool IsNaN() const);
......@@ -1532,6 +1523,15 @@ class HeapObject: public Object {
// Convenience method to get current isolate.
inline Isolate* GetIsolate() const;
#define IS_TYPE_FUNCTION_DECL(type_) INLINE(bool Is##type_() const);
HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
#undef IS_TYPE_FUNCTION_DECL
#define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \
INLINE(bool Is##Name() const);
STRUCT_LIST(DECLARE_STRUCT_PREDICATE)
#undef DECLARE_STRUCT_PREDICATE
// Converts an address to a HeapObject pointer.
static inline HeapObject* FromAddress(Address address) {
DCHECK_TAG_ALIGNED(address);
......@@ -4381,7 +4381,7 @@ class NormalizedMapCache: public FixedArray {
DECLARE_CAST(NormalizedMapCache)
static inline bool IsNormalizedMapCache(const Object* obj);
static inline bool IsNormalizedMapCache(const HeapObject* obj);
DECLARE_VERIFIER(NormalizedMapCache)
private:
......@@ -9555,7 +9555,7 @@ class Oddball: public HeapObject {
static const byte kNotBooleanMask = ~1;
static const byte kTheHole = 2;
static const byte kNull = 3;
static const byte kArgumentMarker = 4;
static const byte kArgumentsMarker = 4;
static const byte kUndefined = 5;
static const byte kUninitialized = 6;
static const byte kOther = 7;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment