Commit 6d475fb3 authored by rossberg@chromium.org's avatar rossberg@chromium.org

Fix handlification bug in test

R=bmeurer@chromium.org, mstarzinger@chromium.org
BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20835 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a6db82d8
...@@ -272,22 +272,28 @@ class Types { ...@@ -272,22 +272,28 @@ class Types {
int i = rng_.NextInt(static_cast<int>(values.size())); int i = rng_.NextInt(static_cast<int>(values.size()));
return Type::Constant(values[i], region_); return Type::Constant(values[i], region_);
} }
case 3: // array case 3: { // array
return Type::Array(Fuzz(depth / 2), region_); TypeHandle element = Fuzz(depth / 2);
return Type::Array(element, region_);
}
case 4: case 4:
case 5: case 5:
case 6: { // function case 6: { // function
TypeHandle type = Type::Function( TypeHandle result = Fuzz(depth / 2);
Fuzz(depth / 2), Fuzz(depth / 2), rand() % 3, region_); TypeHandle receiver = Fuzz(depth / 2);
int arity = rng_.NextInt(3);
TypeHandle type = Type::Function(result, receiver, arity, region_);
for (int i = 0; i < type->AsFunction()->Arity(); ++i) { for (int i = 0; i < type->AsFunction()->Arity(); ++i) {
type->AsFunction()->InitParameter(i, Fuzz(depth - 1)); TypeHandle parameter = Fuzz(depth - 1);
type->AsFunction()->InitParameter(i, parameter);
} }
} }
default: { // union default: { // union
int n = rng_.NextInt(10); int n = rng_.NextInt(10);
TypeHandle type = None; TypeHandle type = None;
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
type = Type::Union(type, Fuzz(depth - 1), region_); TypeHandle operand = Fuzz(depth - 1);
type = Type::Union(type, operand, region_);
} }
return type; return type;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment