Revision: 22926
Author: [email protected]
Date: Wed Aug 6 12:41:37 2014 UTC
Log: Fix a bug in type fuzzing and several handlification bugs
elsewhere.
[email protected]
BUG=
Review URL: https://codereview.chromium.org/444883005
http://code.google.com/p/v8/source/detail?r=22926
Modified:
/branches/bleeding_edge/src/types.cc
/branches/bleeding_edge/test/cctest/test-types.cc
=======================================
--- /branches/bleeding_edge/src/types.cc Wed Aug 6 09:26:49 2014 UTC
+++ /branches/bleeding_edge/src/types.cc Wed Aug 6 12:41:37 2014 UTC
@@ -425,7 +425,7 @@
} else if (this->IsArray()) {
return ArrayType::New(this->AsArray()->Element(), bound, region);
} else if (this->IsFunction()) {
- FunctionType* function = this->AsFunction();
+ FunctionHandle function = Config::handle(this->AsFunction());
int arity = function->Arity();
FunctionHandle type = FunctionType::New(
function->Result(), function->Receiver(), bound, arity, region);
@@ -747,36 +747,37 @@
if (type->IsBitset()) {
return BitsetType::New(type->AsBitset(), region);
} else if (type->IsClass()) {
- return ClassType::New(
- type->AsClass()->Map(),
- BitsetType::New(type->BitsetLub(), region), region);
+ TypeHandle bound = BitsetType::New(type->BitsetLub(), region);
+ return ClassType::New(type->AsClass()->Map(), bound, region);
} else if (type->IsConstant()) {
- return ConstantType::New(
- type->AsConstant()->Value(),
- Convert<OtherType>(type->AsConstant()->Bound(), region), region);
+ TypeHandle bound = Convert<OtherType>(type->AsConstant()->Bound(),
region);
+ return ConstantType::New(type->AsConstant()->Value(), bound, region);
} else if (type->IsContext()) {
+ TypeHandle bound = Convert<OtherType>(type->AsContext()->Bound(),
region);
TypeHandle outer = Convert<OtherType>(type->AsContext()->Outer(),
region);
- return ContextType::New(outer, region);
+ return ContextType::New(outer, bound, region);
} else if (type->IsUnion()) {
int length = type->AsUnion()->Length();
UnionHandle unioned = UnionType::New(length, region);
for (int i = 0; i < length; ++i) {
- unioned->Set(i, Convert<OtherType>(type->AsUnion()->Get(i), region));
+ TypeHandle t = Convert<OtherType>(type->AsUnion()->Get(i), region);
+ unioned->Set(i, t);
}
return unioned;
} else if (type->IsArray()) {
- return ArrayType::New(
- Convert<OtherType>(type->AsArray()->Element(), region),
- Convert<OtherType>(type->AsArray()->Bound(), region), region);
+ TypeHandle element = Convert<OtherType>(type->AsArray()->Element(),
region);
+ TypeHandle bound = Convert<OtherType>(type->AsArray()->Bound(),
region);
+ return ArrayType::New(element, bound, region);
} else if (type->IsFunction()) {
+ TypeHandle res = Convert<OtherType>(type->AsFunction()->Result(),
region);
+ TypeHandle rcv = Convert<OtherType>(type->AsFunction()->Receiver(),
region);
+ TypeHandle bound = Convert<OtherType>(type->AsFunction()->Bound(),
region);
FunctionHandle function = FunctionType::New(
- Convert<OtherType>(type->AsFunction()->Result(), region),
- Convert<OtherType>(type->AsFunction()->Receiver(), region),
- Convert<OtherType>(type->AsFunction()->Bound(), region),
- type->AsFunction()->Arity(), region);
+ res, rcv, bound, type->AsFunction()->Arity(), region);
for (int i = 0; i < function->Arity(); ++i) {
- function->InitParameter(i,
- Convert<OtherType>(type->AsFunction()->Parameter(i), region));
+ TypeHandle param = Convert<OtherType>(
+ type->AsFunction()->Parameter(i), region);
+ function->InitParameter(i, param);
}
return function;
} else {
=======================================
--- /branches/bleeding_edge/test/cctest/test-types.cc Tue Aug 5 11:27:26
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-types.cc Wed Aug 6 12:41:37
2014 UTC
@@ -277,16 +277,16 @@
return Type::Array(element, region_);
}
case 5:
- case 6:
- case 7: { // function
+ case 6: { // function
TypeHandle result = Fuzz(depth / 2);
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) {
- TypeHandle parameter = Fuzz(depth - 1);
+ TypeHandle parameter = Fuzz(depth / 2);
type->AsFunction()->InitParameter(i, parameter);
}
+ return type;
}
default: { // union
int n = rng_->NextInt(10);
--
--
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/d/optout.