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

Unified Diff: src/types.cc

Issue 230463003: Fix various bugs in the type systems, and improve test coverage. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 6 years, 8 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 2f91d876c619865527b91b091d348655ca2cb5a1..f6a430bbc962934128d089fb1af6baa2d1a51ab6 100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -306,10 +306,14 @@ bool TypeImpl<Config>::SlowIs(TypeImpl* that) {
template<class Config>
bool TypeImpl<Config>::NowIs(TypeImpl* that) {
- return this->Is(that) ||
- (this->IsConstant() && that->IsClass() &&
- this->AsConstant()->IsHeapObject() &&
- i::HeapObject::cast(*this->AsConstant())->map() == *that->AsClass());
+ if (this->Is(that)) return true;
+ if (this->IsConstant() && this->AsConstant()->IsHeapObject()) {
+ i::Handle<i::Map> map(i::HeapObject::cast(*this->AsConstant())->map());
+ for (Iterator<i::Map> it = that->Classes(); !it.Done(); it.Advance()) {
+ if (*it.Current() == *map) return true;
+ }
+ }
+ return false;
}
@@ -358,8 +362,8 @@ bool TypeImpl<Config>::Maybe(TypeImpl* that) {
template<class Config>
bool TypeImpl<Config>::Contains(i::Object* value) {
- if (this->IsConstant()) {
- return *this->AsConstant() == value;
+ for (Iterator<i::Object> it = this->Constants(); !it.Done(); it.Advance()) {
+ if (*it.Current() == value) return true;
}
return Config::from_bitset(LubBitset(value))->Is(this);
}
« 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