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

Unified Diff: src/types.cc

Issue 148593004: A64: Synchronize with r18084. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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
« no previous file with comments | « src/types.h ('k') | src/v8.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/types.cc
diff --git a/src/types.cc b/src/types.cc
index 9c576c07de9714c5aa9d24b5d39575ecadb45e85..485ba885187364ed2b99098865eec3197b2c47dc 100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -244,7 +244,7 @@ int Type::GlbBitset() {
// Most precise _current_ type of a value (usually its class).
-Type* Type::CurrentOf(Handle<i::Object> value) {
+Type* Type::OfCurrently(Handle<i::Object> value) {
if (value->IsSmi()) return Smi();
i::Map* map = i::HeapObject::cast(*value)->map();
if (map->instance_type() == HEAP_NUMBER_TYPE ||
@@ -297,6 +297,14 @@ bool Type::SlowIs(Type* that) {
}
+bool Type::IsCurrently(Type* that) {
+ return this->Is(that) ||
+ (this->is_constant() && that->is_class() &&
+ this->as_constant()->IsHeapObject() &&
+ i::HeapObject::cast(*this->as_constant())->map() == *that->as_class());
+}
+
+
// Check this overlaps that.
bool Type::Maybe(Type* that) {
// Fast path for bitsets.
@@ -525,25 +533,35 @@ void Type::TypePrint() {
}
+const char* Type::bitset_name(int bitset) {
+ switch (bitset) {
+ #define PRINT_COMPOSED_TYPE(type, value) case k##type: return #type;
+ BITSET_TYPE_LIST(PRINT_COMPOSED_TYPE)
+ #undef PRINT_COMPOSED_TYPE
+ default:
+ return NULL;
+ }
+}
+
+
void Type::TypePrint(FILE* out) {
if (is_bitset()) {
- int val = as_bitset();
- const char* composed_name = GetComposedName(val);
- if (composed_name != NULL) {
- PrintF(out, "%s", composed_name);
- return;
- }
- bool first_entry = true;
- PrintF(out, "{");
- for (unsigned i = 0; i < sizeof(val)*8; ++i) {
- int mask = (1 << i);
- if ((val & mask) != 0) {
- if (!first_entry) PrintF(out, ",");
- first_entry = false;
- PrintF(out, "%s", GetPrimitiveName(mask));
+ int bitset = as_bitset();
+ const char* name = bitset_name(bitset);
+ if (name != NULL) {
+ PrintF(out, "%s", name);
+ } else {
+ bool is_first = true;
+ PrintF(out, "(");
+ for (int mask = 1; mask != 0; mask = mask << 1) {
+ if ((bitset & mask) != 0) {
+ if (!is_first) PrintF(out, " | ");
+ is_first = false;
+ PrintF(out, "%s", bitset_name(mask));
+ }
}
+ PrintF(out, ")");
}
- PrintF(out, "}");
} else if (is_constant()) {
PrintF(out, "Constant(%p : ", static_cast<void*>(*as_constant()));
from_bitset(LubBitset())->TypePrint(out);
@@ -553,14 +571,14 @@ void Type::TypePrint(FILE* out) {
from_bitset(LubBitset())->TypePrint(out);
PrintF(")");
} else if (is_union()) {
- PrintF(out, "{");
+ PrintF(out, "(");
Handle<Unioned> unioned = as_union();
for (int i = 0; i < unioned->length(); ++i) {
Handle<Type> type_i = union_get(unioned, i);
- if (i > 0) PrintF(out, ",");
+ if (i > 0) PrintF(out, " | ");
type_i->TypePrint(out);
}
- PrintF(out, "}");
+ PrintF(out, ")");
}
}
#endif
« no previous file with comments | « src/types.h ('k') | src/v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698