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

Side by Side Diff: test/cctest/types-fuzz.h

Issue 1217803004: Add a type for objects with typed properties. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 years, 5 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
« no previous file with comments | « test/cctest/test-types.cc ('k') | 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 TypeHandle Function1(TypeHandle result, TypeHandle receiver, TypeHandle arg) { 208 TypeHandle Function1(TypeHandle result, TypeHandle receiver, TypeHandle arg) {
209 TypeHandle type = Type::Function(result, receiver, 1, region_); 209 TypeHandle type = Type::Function(result, receiver, 1, region_);
210 type->AsFunction()->InitParameter(0, arg); 210 type->AsFunction()->InitParameter(0, arg);
211 return type; 211 return type;
212 } 212 }
213 213
214 TypeHandle Function2(TypeHandle result, TypeHandle arg1, TypeHandle arg2) { 214 TypeHandle Function2(TypeHandle result, TypeHandle arg1, TypeHandle arg2) {
215 return Type::Function(result, arg1, arg2, region_); 215 return Type::Function(result, arg1, arg2, region_);
216 } 216 }
217 217
218 TypeHandle ExplicitObject(int size) { return Type::Object(size, region_); }
219
218 TypeHandle Union(TypeHandle t1, TypeHandle t2) { 220 TypeHandle Union(TypeHandle t1, TypeHandle t2) {
219 return Type::Union(t1, t2, region_); 221 return Type::Union(t1, t2, region_);
220 } 222 }
221 223
222 TypeHandle Intersect(TypeHandle t1, TypeHandle t2) { 224 TypeHandle Intersect(TypeHandle t1, TypeHandle t2) {
223 return Type::Intersect(t1, t2, region_); 225 return Type::Intersect(t1, t2, region_);
224 } 226 }
225 227
226 TypeHandle Representation(TypeHandle t) { 228 TypeHandle Representation(TypeHandle t) {
227 return Type::Representation(t, region_); 229 return Type::Representation(t, region_);
228 } 230 }
229 231
230 // TypeHandle Semantic(TypeHandle t) { return Intersect(t, 232 // TypeHandle Semantic(TypeHandle t) { return Intersect(t,
231 // MaskSemanticForTesting); } 233 // MaskSemanticForTesting); }
232 TypeHandle Semantic(TypeHandle t) { return Type::Semantic(t, region_); } 234 TypeHandle Semantic(TypeHandle t) { return Type::Semantic(t, region_); }
233 235
234 template<class Type2, class TypeHandle2> 236 template<class Type2, class TypeHandle2>
235 TypeHandle Convert(TypeHandle2 t) { 237 TypeHandle Convert(TypeHandle2 t) {
236 return Type::template Convert<Type2>(t, region_); 238 return Type::template Convert<Type2>(t, region_);
237 } 239 }
238 240
239 TypeHandle Random() { 241 TypeHandle Random() {
240 return types[rng_->NextInt(static_cast<int>(types.size()))]; 242 return types[rng_->NextInt(static_cast<int>(types.size()))];
241 } 243 }
242 244
245 TypeHandle ExplicitAny() { return Type::Any(region_); }
246
243 TypeHandle Fuzz(int depth = 4) { 247 TypeHandle Fuzz(int depth = 4) {
244 switch (rng_->NextInt(depth == 0 ? 3 : 20)) { 248 switch (rng_->NextInt(depth == 0 ? 3 : 20)) {
245 case 0: { // bitset 249 case 0: { // bitset
246 #define COUNT_BITSET_TYPES(type, value) + 1 250 #define COUNT_BITSET_TYPES(type, value) + 1
247 int n = 0 PROPER_BITSET_TYPE_LIST(COUNT_BITSET_TYPES); 251 int n = 0 PROPER_BITSET_TYPE_LIST(COUNT_BITSET_TYPES);
248 #undef COUNT_BITSET_TYPES 252 #undef COUNT_BITSET_TYPES
249 // Pick a bunch of named bitsets and return their intersection. 253 // Pick a bunch of named bitsets and return their intersection.
250 TypeHandle result = Type::Any(region_); 254 TypeHandle result = Type::Any(region_);
251 for (int i = 0, m = 1 + rng_->NextInt(3); i < m; ++i) { 255 for (int i = 0, m = 1 + rng_->NextInt(3); i < m; ++i) {
252 int j = rng_->NextInt(n); 256 int j = rng_->NextInt(n);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 325
322 private: 326 private:
323 Region* region_; 327 Region* region_;
324 v8::base::RandomNumberGenerator* rng_; 328 v8::base::RandomNumberGenerator* rng_;
325 }; 329 };
326 330
327 331
328 } } // namespace v8::internal 332 } } // namespace v8::internal
329 333
330 #endif 334 #endif
OLDNEW
« no previous file with comments | « test/cctest/test-types.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698