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

Unified Diff: src/objects.h

Issue 2028983002: Introduce IsUndefined(Isolate*) and IsTheHole(Isolate*) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase master Created 4 years, 6 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/mips64/code-stubs-mips64.cc ('k') | src/objects.cc » ('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 371c4854f6108949035c9af8df91575cba9a08fa..27b832d4f566c3a95017241e88218e44c7328ac6 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1064,6 +1064,9 @@ class Object {
STRUCT_LIST(DECLARE_STRUCT_PREDICATE)
#undef DECLARE_STRUCT_PREDICATE
+ INLINE(bool IsTheHole(Isolate* isolate) const);
+ INLINE(bool IsUndefined(Isolate* isolate) const);
+
// ES6, section 7.2.2 IsArray. NOT to be confused with %_IsArray.
MUST_USE_RESULT static Maybe<bool> IsArray(Handle<Object> object);
@@ -1551,6 +1554,7 @@ class HeapObject: public Object {
// Convenience method to get current isolate.
inline Isolate* GetIsolate() const;
+// TODO(cbruni): clean up once isolate-based versions are in place.
#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)
@@ -1560,6 +1564,9 @@ class HeapObject: public Object {
STRUCT_LIST(DECLARE_STRUCT_PREDICATE)
#undef DECLARE_STRUCT_PREDICATE
+ INLINE(bool IsTheHole(Isolate* isolate) const);
+ INLINE(bool IsUndefined(Isolate* isolate) const);
+
// Converts an address to a HeapObject pointer.
static inline HeapObject* FromAddress(Address address) {
DCHECK_TAG_ALIGNED(address);
@@ -3875,7 +3882,7 @@ class OrderedHashTable: public FixedArray {
int KeyToFirstEntry(Object* key) {
Object* hash = key->GetHash();
// If the object does not have an identity hash, it was never used as a key
- if (hash->IsUndefined()) return kNotFound;
+ if (hash->IsUndefined(GetIsolate())) return kNotFound;
return HashToEntry(Smi::cast(hash)->value());
}
@@ -3884,7 +3891,7 @@ class OrderedHashTable: public FixedArray {
return Smi::cast(next_entry)->value();
}
- // use KeyAt(i)->IsTheHole() to determine if this is a deleted entry.
+ // use KeyAt(i)->IsTheHole(isolate) to determine if this is a deleted entry.
Object* KeyAt(int entry) {
DCHECK_LT(entry, this->UsedCapacity());
return get(EntryToIndex(entry));
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698