Treat uninitialized as internal type.

TEST=cctest/test-types
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/232913002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20650 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
bmeurer@chromium.org 2014-04-10 11:51:03 +00:00
parent cf4eddd3f8
commit 990b57ba1d
2 changed files with 19 additions and 2 deletions

View File

@ -177,8 +177,8 @@ int TypeImpl<Config>::LubBitset(i::Map* map) {
if (map == heap->the_hole_map()) return kAny; // TODO(rossberg): kNone?
if (map == heap->null_map()) return kNull;
if (map == heap->boolean_map()) return kBoolean;
if (map == heap->uninitialized_map()) return kNone;
ASSERT(map == heap->no_interceptor_result_sentinel_map() ||
ASSERT(map == heap->uninitialized_map() ||
map == heap->no_interceptor_result_sentinel_map() ||
map == heap->termination_exception_map() ||
map == heap->arguments_marker_map());
return kInternal & kTaggedPtr;

View File

@ -48,11 +48,14 @@ class Types {
object_map = isolate->factory()->NewMap(JS_OBJECT_TYPE, 3 * kPointerSize);
array_map = isolate->factory()->NewMap(JS_ARRAY_TYPE, 4 * kPointerSize);
uninitialized_map = isolate->factory()->uninitialized_map();
ObjectClass = Type::Class(object_map, region);
ArrayClass = Type::Class(array_map, region);
UninitializedClass = Type::Class(uninitialized_map, region);
maps.push_back(object_map);
maps.push_back(array_map);
maps.push_back(uninitialized_map);
for (MapVector::iterator it = maps.begin(); it != maps.end(); ++it) {
types.push_back(Type::Class(*it, region));
}
@ -62,17 +65,20 @@ class Types {
object1 = isolate->factory()->NewJSObjectFromMap(object_map);
object2 = isolate->factory()->NewJSObjectFromMap(object_map);
array = isolate->factory()->NewJSArray(20);
uninitialized = isolate->factory()->uninitialized_value();
SmiConstant = Type::Constant(smi, region);
Signed32Constant = Type::Constant(signed32, region);
ObjectConstant1 = Type::Constant(object1, region);
ObjectConstant2 = Type::Constant(object2, region);
ArrayConstant = Type::Constant(array, region);
UninitializedConstant = Type::Constant(uninitialized, region);
values.push_back(smi);
values.push_back(signed32);
values.push_back(object1);
values.push_back(object2);
values.push_back(array);
values.push_back(uninitialized);
for (ValueVector::iterator it = values.begin(); it != values.end(); ++it) {
types.push_back(Type::Constant(*it, region));
}
@ -92,21 +98,25 @@ class Types {
TypeHandle ObjectClass;
TypeHandle ArrayClass;
TypeHandle UninitializedClass;
TypeHandle SmiConstant;
TypeHandle Signed32Constant;
TypeHandle ObjectConstant1;
TypeHandle ObjectConstant2;
TypeHandle ArrayConstant;
TypeHandle UninitializedConstant;
Handle<i::Map> object_map;
Handle<i::Map> array_map;
Handle<i::Map> uninitialized_map;
Handle<i::Smi> smi;
Handle<i::HeapNumber> signed32;
Handle<i::JSObject> object1;
Handle<i::JSObject> object2;
Handle<i::JSArray> array;
Handle<i::Oddball> uninitialized;
typedef std::vector<TypeHandle> TypeVector;
typedef std::vector<Handle<i::Map> > MapVector;
@ -548,6 +558,13 @@ struct Tests : Rep {
CheckUnordered(T.Object, T.Proxy);
CheckUnordered(T.Array, T.Function);
CheckSub(T.UninitializedClass, T.Internal);
CheckSub(T.UninitializedConstant, T.Internal);
CheckUnordered(T.UninitializedClass, T.Null);
CheckUnordered(T.UninitializedClass, T.Undefined);
CheckUnordered(T.UninitializedConstant, T.Null);
CheckUnordered(T.UninitializedConstant, T.Undefined);
// Structural types
CheckSub(T.ObjectClass, T.Object);
CheckSub(T.ArrayClass, T.Object);