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

Unified Diff: src/types.cc

Issue 16562003: Allow smis for singleton types (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 years, 6 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') | test/cctest/test-types.cc » ('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 2a9605531c036a9b2166d4c493fd14a9ceea0615..f7fbd2d69bee758ba41f8295be280b00894d62a9 100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -42,8 +42,14 @@ int Type::LubBitset() {
}
return bitset;
} else {
- Map* map =
- this->is_class() ? *this->as_class() : this->as_constant()->map();
+ Map* map = NULL;
+ if (this->is_class()) {
+ map = *this->as_class();
+ } else {
+ v8::internal::Object* value = this->as_constant()->value();
+ if (value->IsSmi()) return kSmi;
+ map = HeapObject::cast(value)->map();
+ }
switch (map->instance_type()) {
case STRING_TYPE:
case ASCII_STRING_TYPE:
@@ -126,7 +132,8 @@ bool Type::Is(Handle<Type> that) {
return this->is_class() && *this->as_class() == *that->as_class();
}
if (that->is_constant()) {
- return this->is_constant() && *this->as_constant() == *that->as_constant();
+ return this->is_constant() &&
+ this->as_constant()->value() == that->as_constant()->value();
}
// (T1 \/ ... \/ Tn) <= T <=> (T1 <= T) /\ ... /\ (Tn <= T)
@@ -169,7 +176,8 @@ bool Type::Maybe(Handle<Type> that) {
return that->is_class() && *this->as_class() == *that->as_class();
}
if (this->is_constant()) {
- return that->is_constant() && *this->as_constant() == *that->as_constant();
+ return that->is_constant() &&
+ this->as_constant()->value() == that->as_constant()->value();
}
// (T1 \/ ... \/ Tn) overlaps T <=> (T1 overlaps T) \/ ... \/ (Tn overlaps T)
« no previous file with comments | « src/types.h ('k') | test/cctest/test-types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698