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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 7058 matching lines...) Expand 10 before | Expand all | Expand 10 after
7069 DCHECK(IsInternalizedString()); 7069 DCHECK(IsInternalizedString());
7070 if (HasHashCode()) return this; 7070 if (HasHashCode()) return this;
7071 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); 7071 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot));
7072 DCHECK(canonical->IsInternalizedString()); 7072 DCHECK(canonical->IsInternalizedString());
7073 DCHECK(SlowEquals(canonical)); 7073 DCHECK(SlowEquals(canonical));
7074 DCHECK(canonical->HasHashCode()); 7074 DCHECK(canonical->HasHashCode());
7075 return canonical; 7075 return canonical;
7076 } 7076 }
7077 7077
7078 7078
7079 // static
7080 Maybe<bool> Object::GreaterThan(Handle<Object> x, Handle<Object> y,
7081 Strength strength) {
7082 Maybe<ComparisonResult> result = Compare(x, y, strength);
7083 if (result.IsJust()) {
7084 switch (result.FromJust()) {
7085 case ComparisonResult::kGreaterThan:
7086 return Just(true);
7087 case ComparisonResult::kLessThan:
7088 case ComparisonResult::kEqual:
7089 case ComparisonResult::kUndefined:
7090 return Just(false);
7091 }
7092 }
7093 return Nothing<bool>();
7094 }
7095
7096
7097 // static
7098 Maybe<bool> Object::GreaterThanOrEqual(Handle<Object> x, Handle<Object> y,
7099 Strength strength) {
7100 Maybe<ComparisonResult> result = Compare(x, y, strength);
7101 if (result.IsJust()) {
7102 switch (result.FromJust()) {
7103 case ComparisonResult::kEqual:
7104 case ComparisonResult::kGreaterThan:
7105 return Just(true);
7106 case ComparisonResult::kLessThan:
7107 case ComparisonResult::kUndefined:
7108 return Just(false);
7109 }
7110 }
7111 return Nothing<bool>();
7112 }
7113
7114
7115 // static
7116 Maybe<bool> Object::LessThan(Handle<Object> x, Handle<Object> y,
7117 Strength strength) {
7118 Maybe<ComparisonResult> result = Compare(x, y, strength);
7119 if (result.IsJust()) {
7120 switch (result.FromJust()) {
7121 case ComparisonResult::kLessThan:
7122 return Just(true);
7123 case ComparisonResult::kEqual:
7124 case ComparisonResult::kGreaterThan:
7125 case ComparisonResult::kUndefined:
7126 return Just(false);
7127 }
7128 }
7129 return Nothing<bool>();
7130 }
7131
7132
7133 // static
7134 Maybe<bool> Object::LessThanOrEqual(Handle<Object> x, Handle<Object> y,
7135 Strength strength) {
7136 Maybe<ComparisonResult> result = Compare(x, y, strength);
7137 if (result.IsJust()) {
7138 switch (result.FromJust()) {
7139 case ComparisonResult::kEqual:
7140 case ComparisonResult::kLessThan:
7141 return Just(true);
7142 case ComparisonResult::kGreaterThan:
7143 case ComparisonResult::kUndefined:
7144 return Just(false);
7145 }
7146 }
7147 return Nothing<bool>();
7148 }
7149
7150
7079 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, 7151 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object,
7080 Handle<Name> name, 7152 Handle<Name> name,
7081 LanguageMode language_mode) { 7153 LanguageMode language_mode) {
7082 LookupIterator it = 7154 LookupIterator it =
7083 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name); 7155 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name);
7084 return GetProperty(&it, language_mode); 7156 return GetProperty(&it, language_mode);
7085 } 7157 }
7086 7158
7087 7159
7088 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, 7160 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object,
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
7943 #undef READ_INT64_FIELD 8015 #undef READ_INT64_FIELD
7944 #undef WRITE_INT64_FIELD 8016 #undef WRITE_INT64_FIELD
7945 #undef READ_BYTE_FIELD 8017 #undef READ_BYTE_FIELD
7946 #undef WRITE_BYTE_FIELD 8018 #undef WRITE_BYTE_FIELD
7947 #undef NOBARRIER_READ_BYTE_FIELD 8019 #undef NOBARRIER_READ_BYTE_FIELD
7948 #undef NOBARRIER_WRITE_BYTE_FIELD 8020 #undef NOBARRIER_WRITE_BYTE_FIELD
7949 8021
7950 } } // namespace v8::internal 8022 } } // namespace v8::internal
7951 8023
7952 #endif // V8_OBJECTS_INL_H_ 8024 #endif // V8_OBJECTS_INL_H_
OLDNEW
« 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