| OLD | NEW |
| 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 6996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7007 if (HasHashCode()) return this; | 7007 if (HasHashCode()) return this; |
| 7008 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); | 7008 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); |
| 7009 DCHECK(canonical->IsInternalizedString()); | 7009 DCHECK(canonical->IsInternalizedString()); |
| 7010 DCHECK(SlowEquals(canonical)); | 7010 DCHECK(SlowEquals(canonical)); |
| 7011 DCHECK(canonical->HasHashCode()); | 7011 DCHECK(canonical->HasHashCode()); |
| 7012 return canonical; | 7012 return canonical; |
| 7013 } | 7013 } |
| 7014 | 7014 |
| 7015 | 7015 |
| 7016 // static | 7016 // static |
| 7017 Maybe<bool> Object::GreaterThan(Handle<Object> x, Handle<Object> y, | 7017 Maybe<bool> Object::GreaterThan(Handle<Object> x, Handle<Object> y) { |
| 7018 Strength strength) { | 7018 Maybe<ComparisonResult> result = Compare(x, y); |
| 7019 Maybe<ComparisonResult> result = Compare(x, y, strength); | |
| 7020 if (result.IsJust()) { | 7019 if (result.IsJust()) { |
| 7021 switch (result.FromJust()) { | 7020 switch (result.FromJust()) { |
| 7022 case ComparisonResult::kGreaterThan: | 7021 case ComparisonResult::kGreaterThan: |
| 7023 return Just(true); | 7022 return Just(true); |
| 7024 case ComparisonResult::kLessThan: | 7023 case ComparisonResult::kLessThan: |
| 7025 case ComparisonResult::kEqual: | 7024 case ComparisonResult::kEqual: |
| 7026 case ComparisonResult::kUndefined: | 7025 case ComparisonResult::kUndefined: |
| 7027 return Just(false); | 7026 return Just(false); |
| 7028 } | 7027 } |
| 7029 } | 7028 } |
| 7030 return Nothing<bool>(); | 7029 return Nothing<bool>(); |
| 7031 } | 7030 } |
| 7032 | 7031 |
| 7033 | 7032 |
| 7034 // static | 7033 // static |
| 7035 Maybe<bool> Object::GreaterThanOrEqual(Handle<Object> x, Handle<Object> y, | 7034 Maybe<bool> Object::GreaterThanOrEqual(Handle<Object> x, Handle<Object> y) { |
| 7036 Strength strength) { | 7035 Maybe<ComparisonResult> result = Compare(x, y); |
| 7037 Maybe<ComparisonResult> result = Compare(x, y, strength); | |
| 7038 if (result.IsJust()) { | 7036 if (result.IsJust()) { |
| 7039 switch (result.FromJust()) { | 7037 switch (result.FromJust()) { |
| 7040 case ComparisonResult::kEqual: | 7038 case ComparisonResult::kEqual: |
| 7041 case ComparisonResult::kGreaterThan: | 7039 case ComparisonResult::kGreaterThan: |
| 7042 return Just(true); | 7040 return Just(true); |
| 7043 case ComparisonResult::kLessThan: | 7041 case ComparisonResult::kLessThan: |
| 7044 case ComparisonResult::kUndefined: | 7042 case ComparisonResult::kUndefined: |
| 7045 return Just(false); | 7043 return Just(false); |
| 7046 } | 7044 } |
| 7047 } | 7045 } |
| 7048 return Nothing<bool>(); | 7046 return Nothing<bool>(); |
| 7049 } | 7047 } |
| 7050 | 7048 |
| 7051 | 7049 |
| 7052 // static | 7050 // static |
| 7053 Maybe<bool> Object::LessThan(Handle<Object> x, Handle<Object> y, | 7051 Maybe<bool> Object::LessThan(Handle<Object> x, Handle<Object> y) { |
| 7054 Strength strength) { | 7052 Maybe<ComparisonResult> result = Compare(x, y); |
| 7055 Maybe<ComparisonResult> result = Compare(x, y, strength); | |
| 7056 if (result.IsJust()) { | 7053 if (result.IsJust()) { |
| 7057 switch (result.FromJust()) { | 7054 switch (result.FromJust()) { |
| 7058 case ComparisonResult::kLessThan: | 7055 case ComparisonResult::kLessThan: |
| 7059 return Just(true); | 7056 return Just(true); |
| 7060 case ComparisonResult::kEqual: | 7057 case ComparisonResult::kEqual: |
| 7061 case ComparisonResult::kGreaterThan: | 7058 case ComparisonResult::kGreaterThan: |
| 7062 case ComparisonResult::kUndefined: | 7059 case ComparisonResult::kUndefined: |
| 7063 return Just(false); | 7060 return Just(false); |
| 7064 } | 7061 } |
| 7065 } | 7062 } |
| 7066 return Nothing<bool>(); | 7063 return Nothing<bool>(); |
| 7067 } | 7064 } |
| 7068 | 7065 |
| 7069 | 7066 |
| 7070 // static | 7067 // static |
| 7071 Maybe<bool> Object::LessThanOrEqual(Handle<Object> x, Handle<Object> y, | 7068 Maybe<bool> Object::LessThanOrEqual(Handle<Object> x, Handle<Object> y) { |
| 7072 Strength strength) { | 7069 Maybe<ComparisonResult> result = Compare(x, y); |
| 7073 Maybe<ComparisonResult> result = Compare(x, y, strength); | |
| 7074 if (result.IsJust()) { | 7070 if (result.IsJust()) { |
| 7075 switch (result.FromJust()) { | 7071 switch (result.FromJust()) { |
| 7076 case ComparisonResult::kEqual: | 7072 case ComparisonResult::kEqual: |
| 7077 case ComparisonResult::kLessThan: | 7073 case ComparisonResult::kLessThan: |
| 7078 return Just(true); | 7074 return Just(true); |
| 7079 case ComparisonResult::kGreaterThan: | 7075 case ComparisonResult::kGreaterThan: |
| 7080 case ComparisonResult::kUndefined: | 7076 case ComparisonResult::kUndefined: |
| 7081 return Just(false); | 7077 return Just(false); |
| 7082 } | 7078 } |
| 7083 } | 7079 } |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7844 #undef WRITE_INT64_FIELD | 7840 #undef WRITE_INT64_FIELD |
| 7845 #undef READ_BYTE_FIELD | 7841 #undef READ_BYTE_FIELD |
| 7846 #undef WRITE_BYTE_FIELD | 7842 #undef WRITE_BYTE_FIELD |
| 7847 #undef NOBARRIER_READ_BYTE_FIELD | 7843 #undef NOBARRIER_READ_BYTE_FIELD |
| 7848 #undef NOBARRIER_WRITE_BYTE_FIELD | 7844 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7849 | 7845 |
| 7850 } // namespace internal | 7846 } // namespace internal |
| 7851 } // namespace v8 | 7847 } // namespace v8 |
| 7852 | 7848 |
| 7853 #endif // V8_OBJECTS_INL_H_ | 7849 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |