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

Unified Diff: src/types.cc

Issue 83003003: Introduce Type::IsCurrently (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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') | no next file » | 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 7c54d4fb27e7db94b06c1726a9e07678bc8ead80..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.
« no previous file with comments | « src/types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698