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

Unified Diff: src/objects-inl.h

Issue 1350113002: [runtime] Replace COMPARE/COMPARE_STRONG with proper Object::Compare. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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
« src/objects.cc ('K') | « src/objects.cc ('k') | src/runtime.js » ('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 22736dc4b7f03567bcbc094fe075f7949498f90a..1e0b6838af4aad30ed35c1f920cfef9069d21dda 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -7076,6 +7076,78 @@ String* String::GetForwardedInternalizedString() {
}
+// static
+Maybe<bool> Object::GreaterThan(Handle<Object> x, Handle<Object> y,
+ Strength strength) {
+ Maybe<ComparisonResult> result = Compare(x, y, strength);
+ if (result.IsJust()) {
+ switch (result.FromJust()) {
+ case ComparisonResult::kGreaterThan:
+ return Just(true);
+ case ComparisonResult::kLessThan:
+ case ComparisonResult::kEqual:
+ case ComparisonResult::kUndefined:
+ return Just(false);
+ }
+ }
+ return Nothing<bool>();
+}
+
+
+// static
+Maybe<bool> Object::GreaterThanOrEqual(Handle<Object> x, Handle<Object> y,
+ Strength strength) {
+ Maybe<ComparisonResult> result = Compare(x, y, strength);
+ if (result.IsJust()) {
+ switch (result.FromJust()) {
+ case ComparisonResult::kEqual:
+ case ComparisonResult::kGreaterThan:
+ return Just(true);
+ case ComparisonResult::kLessThan:
+ case ComparisonResult::kUndefined:
+ return Just(false);
+ }
+ }
+ return Nothing<bool>();
+}
+
+
+// static
+Maybe<bool> Object::LessThan(Handle<Object> x, Handle<Object> y,
+ Strength strength) {
+ Maybe<ComparisonResult> result = Compare(x, y, strength);
+ if (result.IsJust()) {
+ switch (result.FromJust()) {
+ case ComparisonResult::kLessThan:
+ return Just(true);
+ case ComparisonResult::kEqual:
+ case ComparisonResult::kGreaterThan:
+ case ComparisonResult::kUndefined:
+ return Just(false);
+ }
+ }
+ return Nothing<bool>();
+}
+
+
+// static
+Maybe<bool> Object::LessThanOrEqual(Handle<Object> x, Handle<Object> y,
+ Strength strength) {
+ Maybe<ComparisonResult> result = Compare(x, y, strength);
+ if (result.IsJust()) {
+ switch (result.FromJust()) {
+ case ComparisonResult::kEqual:
+ case ComparisonResult::kLessThan:
+ return Just(true);
+ case ComparisonResult::kGreaterThan:
+ case ComparisonResult::kUndefined:
+ return Just(false);
+ }
+ }
+ return Nothing<bool>();
+}
+
+
MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object,
Handle<Name> name,
LanguageMode language_mode) {
« src/objects.cc ('K') | « src/objects.cc ('k') | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698