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

Side by Side Diff: src/objects-inl.h

Issue 1337993005: [runtime] Replace the EQUALS builtin with proper Object::Equals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Michi's nit. 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
« no previous file with comments | « src/objects.cc ('k') | src/runtime.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 bool Object::IsFalse() const { 1075 bool Object::IsFalse() const {
1076 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kFalse; 1076 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kFalse;
1077 } 1077 }
1078 1078
1079 1079
1080 bool Object::IsArgumentsMarker() const { 1080 bool Object::IsArgumentsMarker() const {
1081 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kArgumentMarker; 1081 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kArgumentMarker;
1082 } 1082 }
1083 1083
1084 1084
1085 double Object::Number() { 1085 double Object::Number() const {
1086 DCHECK(IsNumber()); 1086 DCHECK(IsNumber());
1087 return IsSmi() 1087 return IsSmi()
1088 ? static_cast<double>(reinterpret_cast<Smi*>(this)->value()) 1088 ? static_cast<double>(reinterpret_cast<const Smi*>(this)->value())
1089 : reinterpret_cast<HeapNumber*>(this)->value(); 1089 : reinterpret_cast<const HeapNumber*>(this)->value();
1090 } 1090 }
1091 1091
1092 1092
1093 bool Object::IsNaN() const { 1093 bool Object::IsNaN() const {
1094 return this->IsHeapNumber() && std::isnan(HeapNumber::cast(this)->value()); 1094 return this->IsHeapNumber() && std::isnan(HeapNumber::cast(this)->value());
1095 } 1095 }
1096 1096
1097 1097
1098 bool Object::IsMinusZero() const { 1098 bool Object::IsMinusZero() const {
1099 return this->IsHeapNumber() && 1099 return this->IsHeapNumber() &&
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 if (this->Is##Type()) { \ 1560 if (this->Is##Type()) { \
1561 if (!that->Is##Type()) return false; \ 1561 if (!that->Is##Type()) return false; \
1562 return Type::cast(this)->Equals(Type::cast(that)); \ 1562 return Type::cast(this)->Equals(Type::cast(that)); \
1563 } 1563 }
1564 SIMD128_TYPES(SIMD128_VALUE) 1564 SIMD128_TYPES(SIMD128_VALUE)
1565 #undef SIMD128_VALUE 1565 #undef SIMD128_VALUE
1566 return false; 1566 return false;
1567 } 1567 }
1568 1568
1569 1569
1570 // static
1571 bool Simd128Value::Equals(Handle<Simd128Value> one, Handle<Simd128Value> two) {
1572 return one->Equals(*two);
1573 }
1574
1575
1570 #define SIMD128_VALUE_EQUALS(TYPE, Type, type, lane_count, lane_type) \ 1576 #define SIMD128_VALUE_EQUALS(TYPE, Type, type, lane_count, lane_type) \
1571 bool Type::Equals(Type* that) { \ 1577 bool Type::Equals(Type* that) { \
1572 for (int lane = 0; lane < lane_count; ++lane) { \ 1578 for (int lane = 0; lane < lane_count; ++lane) { \
1573 if (this->get_lane(lane) != that->get_lane(lane)) return false; \ 1579 if (this->get_lane(lane) != that->get_lane(lane)) return false; \
1574 } \ 1580 } \
1575 return true; \ 1581 return true; \
1576 } 1582 }
1577 SIMD128_TYPES(SIMD128_VALUE_EQUALS) 1583 SIMD128_TYPES(SIMD128_VALUE_EQUALS)
1578 #undef SIMD128_VALUE_EQUALS 1584 #undef SIMD128_VALUE_EQUALS
1579 1585
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 byte Oddball::kind() const { 2052 byte Oddball::kind() const {
2047 return Smi::cast(READ_FIELD(this, kKindOffset))->value(); 2053 return Smi::cast(READ_FIELD(this, kKindOffset))->value();
2048 } 2054 }
2049 2055
2050 2056
2051 void Oddball::set_kind(byte value) { 2057 void Oddball::set_kind(byte value) {
2052 WRITE_FIELD(this, kKindOffset, Smi::FromInt(value)); 2058 WRITE_FIELD(this, kKindOffset, Smi::FromInt(value));
2053 } 2059 }
2054 2060
2055 2061
2062 // static
2063 Handle<Object> Oddball::ToNumber(Handle<Oddball> input) {
2064 return handle(input->to_number(), input->GetIsolate());
2065 }
2066
2067
2056 ACCESSORS(Cell, value, Object, kValueOffset) 2068 ACCESSORS(Cell, value, Object, kValueOffset)
2057 ACCESSORS(PropertyCell, dependent_code, DependentCode, kDependentCodeOffset) 2069 ACCESSORS(PropertyCell, dependent_code, DependentCode, kDependentCodeOffset)
2058 ACCESSORS(PropertyCell, property_details_raw, Object, kDetailsOffset) 2070 ACCESSORS(PropertyCell, property_details_raw, Object, kDetailsOffset)
2059 ACCESSORS(PropertyCell, value, Object, kValueOffset) 2071 ACCESSORS(PropertyCell, value, Object, kValueOffset)
2060 2072
2061 2073
2062 PropertyDetails PropertyCell::property_details() { 2074 PropertyDetails PropertyCell::property_details() {
2063 return PropertyDetails(Smi::cast(property_details_raw())); 2075 return PropertyDetails(Smi::cast(property_details_raw()));
2064 } 2076 }
2065 2077
(...skipping 5839 matching lines...) Expand 10 before | Expand all | Expand 10 after
7905 #undef READ_INT64_FIELD 7917 #undef READ_INT64_FIELD
7906 #undef WRITE_INT64_FIELD 7918 #undef WRITE_INT64_FIELD
7907 #undef READ_BYTE_FIELD 7919 #undef READ_BYTE_FIELD
7908 #undef WRITE_BYTE_FIELD 7920 #undef WRITE_BYTE_FIELD
7909 #undef NOBARRIER_READ_BYTE_FIELD 7921 #undef NOBARRIER_READ_BYTE_FIELD
7910 #undef NOBARRIER_WRITE_BYTE_FIELD 7922 #undef NOBARRIER_WRITE_BYTE_FIELD
7911 7923
7912 } } // namespace v8::internal 7924 } } // namespace v8::internal
7913 7925
7914 #endif // V8_OBJECTS_INL_H_ 7926 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698