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

Unified Diff: src/types.cc

Issue 219523003: Provide Type::Contains methods. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Allow raw pointers Created 6 years, 9 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/typing.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 e269582ca0293b73b68009c39ed129ec0e7a6c81..95ad4ca689b65218239dfb140421f258e92598c5 100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -271,7 +271,7 @@ int TypeImpl<Config>::GlbBitset() {
// Most precise _current_ type of a value (usually its class).
template<class Config>
-typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::OfCurrently(
+typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::NowOf(
i::Handle<i::Object> value, Region* region) {
if (value->IsSmi() ||
i::HeapObject::cast(*value)->map()->instance_type() == HEAP_NUMBER_TYPE ||
@@ -326,7 +326,7 @@ bool TypeImpl<Config>::SlowIs(TypeImpl* that) {
template<class Config>
-bool TypeImpl<Config>::IsCurrently(TypeImpl* that) {
+bool TypeImpl<Config>::NowIs(TypeImpl* that) {
return this->Is(that) ||
(this->IsConstant() && that->IsClass() &&
this->AsConstant()->IsHeapObject() &&
@@ -378,6 +378,23 @@ bool TypeImpl<Config>::Maybe(TypeImpl* that) {
template<class Config>
+bool TypeImpl<Config>::Contains(i::Object* value) {
+ if (this->IsConstant()) {
+ return *this->AsConstant() == value;
+ }
+ return Config::from_bitset(LubBitset(value))->Is(this);
+}
+
+
+template<class Config>
+bool TypeImpl<Config>::NowContains(i::Object* value) {
+ return this->Contains(value) ||
+ (this->IsClass() && value->IsHeapObject() &&
+ *this->AsClass() == i::HeapObject::cast(value)->map());
+}
+
+
+template<class Config>
bool TypeImpl<Config>::InUnion(UnionedHandle unioned, int current_size) {
ASSERT(!this->IsUnion());
for (int i = 0; i < current_size; ++i) {
« no previous file with comments | « src/types.h ('k') | src/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698