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

Unified Diff: src/objects.cc

Issue 1407233013: [runtime] Refactor Object::Equals to make exception cases explicit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 86964bb694c30c37a940be93d1839e610cc7f564..40f4650b77b398dc7b4e12622eb7ee5623966222 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -291,9 +291,8 @@ Maybe<bool> Object::Equals(Handle<Object> x, Handle<Object> y) {
} else if (y->IsString()) {
return Just(NumberEquals(x, String::ToNumber(Handle<String>::cast(y))));
} else if (y->IsJSReceiver() && !y->IsUndetectableObject()) {
- if (JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(y)).ToHandle(&y)) {
- continue;
- } else {
+ if (!JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(y))
+ .ToHandle(&y)) {
return Nothing<bool>();
}
} else {
@@ -310,9 +309,8 @@ Maybe<bool> Object::Equals(Handle<Object> x, Handle<Object> y) {
x = String::ToNumber(Handle<String>::cast(x));
return Just(NumberEquals(*x, Handle<Oddball>::cast(y)->to_number()));
} else if (y->IsJSReceiver() && !y->IsUndetectableObject()) {
- if (JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(y)).ToHandle(&y)) {
- continue;
- } else {
+ if (!JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(y))
+ .ToHandle(&y)) {
return Nothing<bool>();
}
} else {
@@ -332,7 +330,6 @@ Maybe<bool> Object::Equals(Handle<Object> x, Handle<Object> y) {
return Nothing<bool>();
}
x = Oddball::ToNumber(Handle<Oddball>::cast(x));
- continue;
} else {
return Just(false);
}
@@ -340,9 +337,8 @@ Maybe<bool> Object::Equals(Handle<Object> x, Handle<Object> y) {
if (y->IsSymbol()) {
return Just(x.is_identical_to(y));
} else if (y->IsJSReceiver() && !y->IsUndetectableObject()) {
- if (JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(y)).ToHandle(&y)) {
- continue;
- } else {
+ if (!JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(y))
+ .ToHandle(&y)) {
return Nothing<bool>();
}
} else {
@@ -353,9 +349,8 @@ Maybe<bool> Object::Equals(Handle<Object> x, Handle<Object> y) {
return Just(Simd128Value::Equals(Handle<Simd128Value>::cast(x),
Handle<Simd128Value>::cast(y)));
} else if (y->IsJSReceiver() && !y->IsUndetectableObject()) {
- if (JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(y)).ToHandle(&y)) {
- continue;
- } else {
+ if (!JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(y))
+ .ToHandle(&y)) {
return Nothing<bool>();
}
} else {
@@ -368,11 +363,8 @@ Maybe<bool> Object::Equals(Handle<Object> x, Handle<Object> y) {
return Just(false);
} else if (y->IsBoolean()) {
y = Oddball::ToNumber(Handle<Oddball>::cast(y));
- continue;
- } else if (JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(x))
- .ToHandle(&x)) {
- continue;
- } else {
+ } else if (!JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(x))
+ .ToHandle(&x)) {
return Nothing<bool>();
}
} else {
@@ -380,7 +372,6 @@ Maybe<bool> Object::Equals(Handle<Object> x, Handle<Object> y) {
(x->IsNull() || x->IsUndefined() || x->IsUndetectableObject()) &&
(y->IsNull() || y->IsUndefined() || y->IsUndetectableObject()));
}
- UNREACHABLE();
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698