Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: test/cctest/test-types.cc

Issue 240603004: Fix handlification bug in test (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix use of rand Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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...) Expand 10 before | Expand all | Expand 10 after
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 int arity = rng_.NextInt(3);
284 TypeHandle type = Type::Function(result, receiver, arity, region_);
282 for (int i = 0; i < type->AsFunction()->Arity(); ++i) { 285 for (int i = 0; i < type->AsFunction()->Arity(); ++i) {
283 type->AsFunction()->InitParameter(i, Fuzz(depth - 1)); 286 TypeHandle parameter = Fuzz(depth - 1);
287 type->AsFunction()->InitParameter(i, parameter);
284 } 288 }
285 } 289 }
286 default: { // union 290 default: { // union
287 int n = rng_.NextInt(10); 291 int n = rng_.NextInt(10);
288 TypeHandle type = None; 292 TypeHandle type = None;
289 for (int i = 0; i < n; ++i) { 293 for (int i = 0; i < n; ++i) {
290 type = Type::Union(type, Fuzz(depth - 1), region_); 294 TypeHandle operand = Fuzz(depth - 1);
295 type = Type::Union(type, operand, region_);
291 } 296 }
292 return type; 297 return type;
293 } 298 }
294 } 299 }
295 UNREACHABLE(); 300 UNREACHABLE();
296 } 301 }
297 302
298 private: 303 private:
299 Region* region_; 304 Region* region_;
300 RandomNumberGenerator rng_; 305 RandomNumberGenerator rng_;
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 ZoneTests().Intersect2(); 1741 ZoneTests().Intersect2();
1737 HeapTests().Intersect2(); 1742 HeapTests().Intersect2();
1738 } 1743 }
1739 1744
1740 1745
1741 TEST(Convert) { 1746 TEST(Convert) {
1742 CcTest::InitializeVM(); 1747 CcTest::InitializeVM();
1743 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); 1748 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>();
1744 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); 1749 HeapTests().Convert<Type, Type*, Zone, ZoneRep>();
1745 } 1750 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698