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

Unified Diff: src/compiler/types.cc

Issue 2379573002: [turbofan] Type::Contains() and Constants() is unnecessary. (Closed)
Patch Set: Created 4 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
Index: src/compiler/types.cc
diff --git a/src/compiler/types.cc b/src/compiler/types.cc
index 618bccebe752bc73aa5d1197adab6227c70da25b..43d2f804837b1ce596b0c8a7235e63dc11b18b49 100644
--- a/src/compiler/types.cc
+++ b/src/compiler/types.cc
@@ -516,18 +516,6 @@ Type* Type::GetRange() {
return NULL;
}
-bool Type::Contains(i::Object* value) {
- DisallowHeapAllocation no_allocation;
- for (Iterator<i::Object> it = this->Constants(); !it.Done(); it.Advance()) {
- if (*it.Current() == value) return true;
- }
- if (IsInteger(value)) {
- Type* range = this->GetRange();
- if (range != NULL && Contains(range->AsRange(), value)) return true;
- }
- return BitsetType::New(BitsetType::Lub(value))->Is(this);
-}
-
bool UnionType::Wellformed() {
DisallowHeapAllocation no_allocation;
// This checks the invariants of the union representation:
@@ -863,52 +851,6 @@ int Type::NumConstants() {
}
}
-template <class T>
-Type* Type::Iterator<T>::get_type() {
- DCHECK(!Done());
- return type_->IsUnion() ? type_->AsUnion()->Get(index_) : type_;
-}
-
-// C++ cannot specialise nested templates, so we have to go through this
-// contortion with an auxiliary template to simulate it.
-template <class T>
-struct TypeImplIteratorAux {
- static bool matches(Type* type);
- static i::Handle<T> current(Type* type);
-};
-
-template <>
-struct TypeImplIteratorAux<i::Object> {
- static bool matches(Type* type) { return type->IsConstant(); }
- static i::Handle<i::Object> current(Type* type) {
- return type->AsConstant()->Value();
- }
-};
-
-template <class T>
-bool Type::Iterator<T>::matches(Type* type) {
- return TypeImplIteratorAux<T>::matches(type);
-}
-
-template <class T>
-i::Handle<T> Type::Iterator<T>::Current() {
- return TypeImplIteratorAux<T>::current(get_type());
-}
-
-template <class T>
-void Type::Iterator<T>::Advance() {
- DisallowHeapAllocation no_allocation;
- ++index_;
- if (type_->IsUnion()) {
- for (int n = type_->AsUnion()->Length(); index_ < n; ++index_) {
- if (matches(type_->AsUnion()->Get(index_))) return;
- }
- } else if (index_ == 0 && matches(type_)) {
- return;
- }
- index_ = -1;
-}
-
// -----------------------------------------------------------------------------
// Printing.
@@ -1014,11 +956,6 @@ BitsetType::bitset BitsetType::UnsignedSmall() {
return i::SmiValuesAre31Bits() ? kUnsigned30 : kUnsigned31;
}
-// -----------------------------------------------------------------------------
-// Instantiations.
-
-template class Type::Iterator<i::Object>;
-
} // namespace compiler
} // namespace internal
} // namespace v8
« src/compiler/types.h ('K') | « src/compiler/types.h ('k') | test/cctest/test-types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698