Revision: 18015
Author: [email protected]
Date: Fri Nov 22 13:16:40 2013 UTC
Log: Introduce Type::IsCurrently
[email protected]
BUG=
Review URL: https://codereview.chromium.org/83003003
http://code.google.com/p/v8/source/detail?r=18015
Modified:
/branches/bleeding_edge/src/ic.cc
/branches/bleeding_edge/src/types.cc
/branches/bleeding_edge/src/types.h
=======================================
--- /branches/bleeding_edge/src/ic.cc Wed Nov 20 13:25:40 2013 UTC
+++ /branches/bleeding_edge/src/ic.cc Fri Nov 22 13:16:40 2013 UTC
@@ -783,7 +783,7 @@
: Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate())),
isolate());
- PatchCache(handle(Type::CurrentOf(cache_object), isolate()), name, code);
+ PatchCache(handle(Type::OfCurrently(cache_object), isolate()), name,
code);
TRACE_IC("CallIC", name);
}
@@ -1148,7 +1148,7 @@
code = ComputeHandler(lookup, object, name);
}
- PatchCache(handle(Type::CurrentOf(object), isolate()), name, code);
+ PatchCache(handle(Type::OfCurrently(object), isolate()), name, code);
TRACE_IC("LoadIC", name);
}
@@ -1609,7 +1609,7 @@
Handle<Code> code = ComputeHandler(lookup, receiver, name, value);
- PatchCache(handle(Type::CurrentOf(receiver), isolate()), name, code);
+ PatchCache(handle(Type::OfCurrently(receiver), isolate()), name, code);
TRACE_IC("StoreIC", name);
}
=======================================
--- /branches/bleeding_edge/src/types.cc Fri Nov 22 12:38:49 2013 UTC
+++ /branches/bleeding_edge/src/types.cc Fri Nov 22 13:16:40 2013 UTC
@@ -244,7 +244,7 @@
// 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 ||
@@ -295,6 +295,14 @@
return false;
}
+
+
+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.
=======================================
--- /branches/bleeding_edge/src/types.h Fri Nov 22 12:38:49 2013 UTC
+++ /branches/bleeding_edge/src/types.h Fri Nov 22 13:16:40 2013 UTC
@@ -153,12 +153,17 @@
static Type* Of(Handle<i::Object> value) {
return from_bitset(LubBitset(*value));
}
- static Type* CurrentOf(Handle<i::Object> value);
- bool Is(Type* that) { return (this == that) ? true : SlowIs(that); }
+ bool Is(Type* that) { return this == that || SlowIs(that); }
bool Is(Handle<Type> that) { return this->Is(*that); }
bool Maybe(Type* that);
bool Maybe(Handle<Type> that) { return this->Maybe(*that); }
+
+ // State-dependent versions of Of and Is that consider subtyping between
+ // a constant and its map class.
+ static Type* OfCurrently(Handle<i::Object> value);
+ bool IsCurrently(Type* that);
+ bool IsCurrently(Handle<Type> that) { return this->IsCurrently(*that); }
bool IsClass() { return is_class(); }
bool IsConstant() { return is_constant(); }
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.