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

Unified Diff: src/objects-inl.h

Issue 2028983002: Introduce IsUndefined(Isolate*) and IsTheHole(Isolate*) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixing wrongly wrapped lines Created 4 years, 7 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
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 364376c722776fcc01303b035e798130db116054..44f7b9e647daa8367da4238737eadfa04bc8eafb 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -162,6 +162,22 @@ HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF)
ODDBALL_LIST(IS_TYPE_FUNCTION_DEF)
#undef IS_TYPE_FUNCTION_DEF
+bool HeapObject::IsTheHole(Isolate* isolate) const {
+ return this == isolate->heap()->the_hole_value();
+}
+
+bool HeapObject::IsUndefined(Isolate* isolate) const {
+ return this == isolate->heap()->undefined_value();
+}
+
+bool Object::IsTheHole(Isolate* isolate) const {
+ return this == isolate->heap()->the_hole_value();
+}
+
+bool Object::IsUndefined(Isolate* isolate) const {
+ return this == isolate->heap()->undefined_value();
+}
Toon Verwaest 2016/06/01 12:36:17 We should replace the versions above with these ve
+
bool HeapObject::IsString() const {
return map()->instance_type() < FIRST_NONSTRING_TYPE;
}
@@ -244,7 +260,6 @@ bool HeapObject::IsExternalTwoByteString() const {
String::cast(this)->IsTwoByteRepresentation();
}
-
bool Object::HasValidElements() {
// Dictionary is covered under FixedArray.
return IsFixedArray() || IsFixedDoubleArray() || IsFixedTypedArrayBase();
@@ -3021,7 +3036,8 @@ bool HashTableBase::IsKey(Heap* heap, Object* k) {
}
bool HashTableBase::IsKey(Object* k) {
- return !k->IsTheHole() && !k->IsUndefined();
+ Isolate* isolate = this->GetIsolate();
+ return !k->IsTheHole(isolate) && !k->IsUndefined(isolate);
}

Powered by Google App Engine
This is Rietveld 408576698