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

Unified Diff: src/types-inl.h

Issue 1636013002: Replace HeapType with a non-templated FieldType class. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tracing of generalizations Created 4 years, 11 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/types-inl.h
diff --git a/src/types-inl.h b/src/types-inl.h
index 9af4bccd2edf8962ee14b7a906d60c8da624f894..877ba134a333bddbeb4fe0c695955df6bc7b3763 100644
--- a/src/types-inl.h
+++ b/src/types-inl.h
@@ -280,207 +280,6 @@ void ZoneTypeConfig::range_set_double(ZoneTypeConfig::Range* range, int index,
range->limits[index] = value;
}
-
-// -----------------------------------------------------------------------------
-// HeapTypeConfig
-
-// static
-template<class T>
-i::Handle<T> HeapTypeConfig::handle(T* type) {
- return i::handle(type, i::HeapObject::cast(type)->GetIsolate());
-}
-
-
-// static
-template<class T>
-i::Handle<T> HeapTypeConfig::cast(i::Handle<Type> type) {
- return i::Handle<T>::cast(type);
-}
-
-
-// static
-bool HeapTypeConfig::is_bitset(Type* type) {
- return type->IsSmi();
-}
-
-
-// static
-bool HeapTypeConfig::is_class(Type* type) {
- return type->IsMap();
-}
-
-
-// static
-bool HeapTypeConfig::is_struct(Type* type, int tag) {
- DCHECK(tag != kRangeStructTag);
- return type->IsFixedArray() && struct_tag(as_struct(type)) == tag;
-}
-
-
-// static
-bool HeapTypeConfig::is_range(Type* type) {
- return type->IsFixedArray() && struct_tag(as_struct(type)) == kRangeStructTag;
-}
-
-
-// static
-HeapTypeConfig::Type::bitset HeapTypeConfig::as_bitset(Type* type) {
- // TODO(rossberg): Breaks the Smi abstraction. Fix once there is a better way.
- return static_cast<Type::bitset>(reinterpret_cast<uintptr_t>(type));
-}
-
-
-// static
-i::Handle<i::Map> HeapTypeConfig::as_class(Type* type) {
- return i::handle(i::Map::cast(type));
-}
-
-
-// static
-i::Handle<HeapTypeConfig::Struct> HeapTypeConfig::as_struct(Type* type) {
- return i::handle(Struct::cast(type));
-}
-
-
-// static
-i::Handle<HeapTypeConfig::Range> HeapTypeConfig::as_range(Type* type) {
- return i::handle(Range::cast(type));
-}
-
-
-// static
-HeapTypeConfig::Type* HeapTypeConfig::from_bitset(Type::bitset bitset) {
- // TODO(rossberg): Breaks the Smi abstraction. Fix once there is a better way.
- return reinterpret_cast<Type*>(static_cast<uintptr_t>(bitset));
-}
-
-
-// static
-i::Handle<HeapTypeConfig::Type> HeapTypeConfig::from_bitset(
- Type::bitset bitset, Isolate* isolate) {
- return i::handle(from_bitset(bitset), isolate);
-}
-
-
-// static
-i::Handle<HeapTypeConfig::Type> HeapTypeConfig::from_class(
- i::Handle<i::Map> map, Isolate* isolate) {
- return i::Handle<Type>::cast(i::Handle<Object>::cast(map));
-}
-
-
-// static
-i::Handle<HeapTypeConfig::Type> HeapTypeConfig::from_struct(
- i::Handle<Struct> structure) {
- return i::Handle<Type>::cast(i::Handle<Object>::cast(structure));
-}
-
-
-// static
-i::Handle<HeapTypeConfig::Type> HeapTypeConfig::from_range(
- i::Handle<Range> range) {
- return i::Handle<Type>::cast(i::Handle<Object>::cast(range));
-}
-
-
-// static
-i::Handle<HeapTypeConfig::Struct> HeapTypeConfig::struct_create(
- int tag, int length, Isolate* isolate) {
- i::Handle<Struct> structure = isolate->factory()->NewFixedArray(length + 1);
- structure->set(0, i::Smi::FromInt(tag));
- return structure;
-}
-
-
-// static
-void HeapTypeConfig::struct_shrink(i::Handle<Struct> structure, int length) {
- structure->Shrink(length + 1);
-}
-
-
-// static
-int HeapTypeConfig::struct_tag(i::Handle<Struct> structure) {
- return static_cast<i::Smi*>(structure->get(0))->value();
-}
-
-
-// static
-int HeapTypeConfig::struct_length(i::Handle<Struct> structure) {
- return structure->length() - 1;
-}
-
-
-// static
-i::Handle<HeapTypeConfig::Type> HeapTypeConfig::struct_get(
- i::Handle<Struct> structure, int i) {
- Type* type = static_cast<Type*>(structure->get(i + 1));
- return i::handle(type, structure->GetIsolate());
-}
-
-
-// static
-void HeapTypeConfig::struct_set(
- i::Handle<Struct> structure, int i, i::Handle<Type> type) {
- structure->set(i + 1, *type);
-}
-
-
-// static
-template<class V>
-i::Handle<V> HeapTypeConfig::struct_get_value(
- i::Handle<Struct> structure, int i) {
- V* x = static_cast<V*>(structure->get(i + 1));
- return i::handle(x, structure->GetIsolate());
-}
-
-
-// static
-template<class V>
-void HeapTypeConfig::struct_set_value(
- i::Handle<Struct> structure, int i, i::Handle<V> x) {
- structure->set(i + 1, *x);
-}
-
-
-// static
-i::Handle<HeapTypeConfig::Range> HeapTypeConfig::range_create(
- Isolate* isolate) {
- i::Handle<Range> range = isolate->factory()->NewFixedArray(4);
- range->set(0, i::Smi::FromInt(kRangeStructTag));
- return range;
-}
-
-
-// static
-int HeapTypeConfig::range_get_bitset(i::Handle<HeapTypeConfig::Range> range) {
- Type* v = static_cast<Type*>(range->get(1));
- return as_bitset(v);
-}
-
-
-// static
-void HeapTypeConfig::range_set_bitset(i::Handle<HeapTypeConfig::Range> range,
- int value) {
- range->set(1, from_bitset(value));
-}
-
-
-// static
-double HeapTypeConfig::range_get_double(i::Handle<HeapTypeConfig::Range> range,
- int index) {
- DCHECK(index >= 0 && index < 2);
- return range->get(index + 2)->Number();
-}
-
-
-// static
-void HeapTypeConfig::range_set_double(i::Handle<HeapTypeConfig::Range> range,
- int index, double value,
- Isolate* isolate) {
- DCHECK(index >= 0 && index < 2);
- i::Handle<Object> number = isolate->factory()->NewNumber(value);
- range->set(index + 2, *number);
-}
} // namespace internal
} // namespace v8
« src/ic/ic.cc ('K') | « src/types.cc ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698