OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 255 matching lines...) Loading... | |
266 } | 266 } |
267 case 1: { // class | 267 case 1: { // class |
268 int i = rng_.NextInt(static_cast<int>(maps.size())); | 268 int i = rng_.NextInt(static_cast<int>(maps.size())); |
269 return Type::Class(maps[i], region_); | 269 return Type::Class(maps[i], region_); |
270 } | 270 } |
271 case 2: { // constant | 271 case 2: { // constant |
272 int i = rng_.NextInt(static_cast<int>(values.size())); | 272 int i = rng_.NextInt(static_cast<int>(values.size())); |
273 return Type::Constant(values[i], region_); | 273 return Type::Constant(values[i], region_); |
274 } | 274 } |
275 case 3: // array | 275 case 3: // array |
276 return Type::Array(Fuzz(depth / 2), region_); | 276 TypeHandle element = Fuzz(depth / 2); |
277 return Type::Array(element, region_); | |
277 case 4: | 278 case 4: |
278 case 5: | 279 case 5: |
279 case 6: { // function | 280 case 6: { // function |
280 TypeHandle type = Type::Function( | 281 TypeHandle result = Fuzz(depth / 2); |
281 Fuzz(depth / 2), Fuzz(depth / 2), rand() % 3, region_); | 282 TypeHandle receiver = Fuzz(depth / 2); |
283 TypeHandle type = Type::Function(result, receiver, rand() % 3, region_); | |
Benedikt Meurer
2014/04/17 09:25:33
rng_.NextInt(3)
rossberg
2014/04/17 09:27:46
Done.
| |
282 for (int i = 0; i < type->AsFunction()->Arity(); ++i) { | 284 for (int i = 0; i < type->AsFunction()->Arity(); ++i) { |
283 type->AsFunction()->InitParameter(i, Fuzz(depth - 1)); | 285 TypeHandle parameter = Fuzz(depth - 1); |
286 type->AsFunction()->InitParameter(i, parameter); | |
284 } | 287 } |
285 } | 288 } |
286 default: { // union | 289 default: { // union |
287 int n = rng_.NextInt(10); | 290 int n = rng_.NextInt(10); |
288 TypeHandle type = None; | 291 TypeHandle type = None; |
289 for (int i = 0; i < n; ++i) { | 292 for (int i = 0; i < n; ++i) { |
290 type = Type::Union(type, Fuzz(depth - 1), region_); | 293 TypeHandle operand = Fuzz(depth - 1); |
294 type = Type::Union(type, operand, region_); | |
291 } | 295 } |
292 return type; | 296 return type; |
293 } | 297 } |
294 } | 298 } |
295 UNREACHABLE(); | 299 UNREACHABLE(); |
296 } | 300 } |
297 | 301 |
298 private: | 302 private: |
299 Region* region_; | 303 Region* region_; |
300 RandomNumberGenerator rng_; | 304 RandomNumberGenerator rng_; |
(...skipping 1435 matching lines...) Loading... | |
1736 ZoneTests().Intersect2(); | 1740 ZoneTests().Intersect2(); |
1737 HeapTests().Intersect2(); | 1741 HeapTests().Intersect2(); |
1738 } | 1742 } |
1739 | 1743 |
1740 | 1744 |
1741 TEST(Convert) { | 1745 TEST(Convert) { |
1742 CcTest::InitializeVM(); | 1746 CcTest::InitializeVM(); |
1743 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); | 1747 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); |
1744 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); | 1748 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); |
1745 } | 1749 } |
OLD | NEW |