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

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

Issue 2684313003: Remove SIMD.js from V8. (Closed)
Patch Set: Rebase. Created 3 years, 10 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/BUILD.gn ('k') | test/cctest/cctest.gyp » ('j') | 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 AnyArray = AstType::Array(Any, zone); 109 AnyArray = AstType::Array(Any, zone);
110 110
111 SignedFunction1 = AstType::Function(SignedSmall, SignedSmall, zone); 111 SignedFunction1 = AstType::Function(SignedSmall, SignedSmall, zone);
112 NumberFunction1 = AstType::Function(Number, Number, zone); 112 NumberFunction1 = AstType::Function(Number, Number, zone);
113 NumberFunction2 = AstType::Function(Number, Number, Number, zone); 113 NumberFunction2 = AstType::Function(Number, Number, Number, zone);
114 MethodFunction = AstType::Function(String, Object, 0, zone); 114 MethodFunction = AstType::Function(String, Object, 0, zone);
115 115
116 for (int i = 0; i < 30; ++i) { 116 for (int i = 0; i < 30; ++i) {
117 types.push_back(Fuzz()); 117 types.push_back(Fuzz());
118 } 118 }
119 USE(isolate_); // Currently unused.
119 } 120 }
120 121
121 Handle<i::Map> object_map; 122 Handle<i::Map> object_map;
122 Handle<i::Map> array_map; 123 Handle<i::Map> array_map;
123 Handle<i::Map> number_map; 124 Handle<i::Map> number_map;
124 Handle<i::Map> uninitialized_map; 125 Handle<i::Map> uninitialized_map;
125 126
126 Handle<i::Smi> smi; 127 Handle<i::Smi> smi;
127 Handle<i::HeapNumber> signed32; 128 Handle<i::HeapNumber> signed32;
128 Handle<i::JSObject> object1; 129 Handle<i::JSObject> object1;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 AstType* result = Fuzz(depth / 2); 281 AstType* result = Fuzz(depth / 2);
281 AstType* receiver = Fuzz(depth / 2); 282 AstType* receiver = Fuzz(depth / 2);
282 int arity = rng_->NextInt(3); 283 int arity = rng_->NextInt(3);
283 AstType* type = AstType::Function(result, receiver, arity, zone_); 284 AstType* type = AstType::Function(result, receiver, arity, zone_);
284 for (int i = 0; i < type->AsFunction()->Arity(); ++i) { 285 for (int i = 0; i < type->AsFunction()->Arity(); ++i) {
285 AstType* parameter = Fuzz(depth / 2); 286 AstType* parameter = Fuzz(depth / 2);
286 type->AsFunction()->InitParameter(i, parameter); 287 type->AsFunction()->InitParameter(i, parameter);
287 } 288 }
288 return type; 289 return type;
289 } 290 }
290 case 8: { // simd
291 static const int num_simd_types =
292 #define COUNT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) +1
293 SIMD128_TYPES(COUNT_SIMD_TYPE);
294 #undef COUNT_SIMD_TYPE
295 AstType* (*simd_constructors[num_simd_types])(Isolate*, Zone*) = {
296 #define COUNT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) &AstType::Name,
297 SIMD128_TYPES(COUNT_SIMD_TYPE)
298 #undef COUNT_SIMD_TYPE
299 };
300 return simd_constructors[rng_->NextInt(num_simd_types)](isolate_,
301 zone_);
302 }
303 default: { // union 291 default: { // union
304 int n = rng_->NextInt(10); 292 int n = rng_->NextInt(10);
305 AstType* type = None; 293 AstType* type = None;
306 for (int i = 0; i < n; ++i) { 294 for (int i = 0; i < n; ++i) {
307 AstType* operand = Fuzz(depth - 1); 295 AstType* operand = Fuzz(depth - 1);
308 type = AstType::Union(type, operand, zone_); 296 type = AstType::Union(type, operand, zone_);
309 } 297 }
310 return type; 298 return type;
311 } 299 }
312 } 300 }
313 UNREACHABLE(); 301 UNREACHABLE();
314 } 302 }
315 303
316 Zone* zone() { return zone_; } 304 Zone* zone() { return zone_; }
317 305
318 private: 306 private:
319 Zone* zone_; 307 Zone* zone_;
320 Isolate* isolate_; 308 Isolate* isolate_;
321 v8::base::RandomNumberGenerator* rng_; 309 v8::base::RandomNumberGenerator* rng_;
322 }; 310 };
323 311
324 } // namespace internal 312 } // namespace internal
325 } // namespace v8 313 } // namespace v8
326 314
327 #endif 315 #endif
OLDNEW
« no previous file with comments | « test/cctest/BUILD.gn ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698