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

Unified Diff: src/objects-inl.h

Issue 2060213002: Revert of Replace all remaining Oddball checks with new function (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 0b9d12cff2c21d1308f48aaf5f233860cb991ff5..25e1d7d74b4c70993c4367a81e65a2270ecad947 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -162,17 +162,24 @@
return IsHeapObject() && HeapObject::cast(this)->Is##type_(); \
}
HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF)
-#undef IS_TYPE_FUNCTION_DEF
-
-#define IS_TYPE_FUNCTION_DEF(Type, Value) \
- bool Object::Is##Type(Isolate* isolate) const { \
- return this == isolate->heap()->Value(); \
- } \
- bool HeapObject::Is##Type(Isolate* isolate) const { \
- return this == isolate->heap()->Value(); \
- }
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();
+}
bool HeapObject::IsString() const {
return map()->instance_type() < FIRST_NONSTRING_TYPE;
@@ -294,12 +301,12 @@
Handle<Object> Object::NewStorageFor(Isolate* isolate,
Handle<Object> object,
Representation representation) {
- if (representation.IsSmi() && object->IsUninitialized(isolate)) {
+ if (representation.IsSmi() && object->IsUninitialized()) {
return handle(Smi::FromInt(0), isolate);
}
if (!representation.IsDouble()) return object;
double value;
- if (object->IsUninitialized(isolate)) {
+ if (object->IsUninitialized()) {
value = 0;
} else if (object->IsMutableHeapNumber()) {
value = HeapNumber::cast(*object)->value();
@@ -313,7 +320,7 @@
Handle<Object> Object::WrapForRead(Isolate* isolate,
Handle<Object> object,
Representation representation) {
- DCHECK(!object->IsUninitialized(isolate));
+ DCHECK(!object->IsUninitialized());
if (!representation.IsDouble()) {
DCHECK(object->FitsRepresentation(representation));
return object;
@@ -948,6 +955,13 @@
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)
+
+#undef MAKE_ODDBALL_PREDICATE
double Object::Number() const {
DCHECK(IsNumber());
return IsSmi()
@@ -973,8 +987,7 @@
return Representation::Smi();
} else if (FLAG_track_double_fields && IsHeapNumber()) {
return Representation::Double();
- } else if (FLAG_track_computed_fields &&
- IsUninitialized(HeapObject::cast(this)->GetIsolate())) {
+ } else if (FLAG_track_computed_fields && IsUninitialized()) {
return Representation::None();
} else if (FLAG_track_heap_object_fields) {
DCHECK(IsHeapObject());
@@ -2188,9 +2201,7 @@
FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor);
if (details.representation().IsDouble()) {
// Nothing more to be done.
- if (value->IsUninitialized(this->GetIsolate())) {
- return;
- }
+ if (value->IsUninitialized()) return;
if (IsUnboxedDoubleField(index)) {
RawFastDoublePropertyAtPut(index, value->Number());
} else {
@@ -2287,8 +2298,8 @@
DCHECK(IsHeapObject());
Isolate* isolate = HeapObject::cast(this)->GetIsolate();
if (!(IsString() || IsSymbol() || IsJSReceiver() || IsHeapNumber() ||
- IsSimd128Value() || IsUndefined(isolate) || IsTrue(isolate) ||
- IsFalse(isolate) || IsNull(isolate))) {
+ IsSimd128Value() || IsUndefined(isolate) || IsTrue() || IsFalse() ||
+ IsNull())) {
FATAL("API call returned invalid object");
}
#endif // DEBUG
@@ -5283,7 +5294,7 @@
void Map::set_prototype(Object* value, WriteBarrierMode mode) {
- DCHECK(value->IsNull(GetIsolate()) || value->IsJSReceiver());
+ DCHECK(value->IsNull() || value->IsJSReceiver());
WRITE_FIELD(this, kPrototypeOffset, value);
CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode);
}
@@ -7312,9 +7323,8 @@
void AccessorPair::SetComponents(Object* getter, Object* setter) {
- Isolate* isolate = GetIsolate();
- if (!getter->IsNull(isolate)) set_getter(getter);
- if (!setter->IsNull(isolate)) set_setter(setter);
+ if (!getter->IsNull()) set_getter(getter);
+ if (!setter->IsNull()) set_setter(setter);
}
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698