Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(819)

Unified Diff: src/objects.h

Issue 1694403002: [runtime] Move heap-object type check helpers to HeapObject with wrapper on Object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: drop the dcheck Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/mark-compact-inl.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 2c6e91b11057e1d06a29f7a1b2e871395b9750e9..f43210c7f62bf1c539d3ff8dcac95990ac4ff67e 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -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;
« no previous file with comments | « src/heap/mark-compact-inl.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698