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

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

Issue 2695653005: Revert of Remove SIMD.js from V8. (Closed)
Patch Set: 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.
120 } 119 }
121 120
122 Handle<i::Map> object_map; 121 Handle<i::Map> object_map;
123 Handle<i::Map> array_map; 122 Handle<i::Map> array_map;
124 Handle<i::Map> number_map; 123 Handle<i::Map> number_map;
125 Handle<i::Map> uninitialized_map; 124 Handle<i::Map> uninitialized_map;
126 125
127 Handle<i::Smi> smi; 126 Handle<i::Smi> smi;
128 Handle<i::HeapNumber> signed32; 127 Handle<i::HeapNumber> signed32;
129 Handle<i::JSObject> object1; 128 Handle<i::JSObject> object1;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 AstType* result = Fuzz(depth / 2); 280 AstType* result = Fuzz(depth / 2);
282 AstType* receiver = Fuzz(depth / 2); 281 AstType* receiver = Fuzz(depth / 2);
283 int arity = rng_->NextInt(3); 282 int arity = rng_->NextInt(3);
284 AstType* type = AstType::Function(result, receiver, arity, zone_); 283 AstType* type = AstType::Function(result, receiver, arity, zone_);
285 for (int i = 0; i < type->AsFunction()->Arity(); ++i) { 284 for (int i = 0; i < type->AsFunction()->Arity(); ++i) {
286 AstType* parameter = Fuzz(depth / 2); 285 AstType* parameter = Fuzz(depth / 2);
287 type->AsFunction()->InitParameter(i, parameter); 286 type->AsFunction()->InitParameter(i, parameter);
288 } 287 }
289 return type; 288 return type;
290 } 289 }
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 }
291 default: { // union 303 default: { // union
292 int n = rng_->NextInt(10); 304 int n = rng_->NextInt(10);
293 AstType* type = None; 305 AstType* type = None;
294 for (int i = 0; i < n; ++i) { 306 for (int i = 0; i < n; ++i) {
295 AstType* operand = Fuzz(depth - 1); 307 AstType* operand = Fuzz(depth - 1);
296 type = AstType::Union(type, operand, zone_); 308 type = AstType::Union(type, operand, zone_);
297 } 309 }
298 return type; 310 return type;
299 } 311 }
300 } 312 }
301 UNREACHABLE(); 313 UNREACHABLE();
302 } 314 }
303 315
304 Zone* zone() { return zone_; } 316 Zone* zone() { return zone_; }
305 317
306 private: 318 private:
307 Zone* zone_; 319 Zone* zone_;
308 Isolate* isolate_; 320 Isolate* isolate_;
309 v8::base::RandomNumberGenerator* rng_; 321 v8::base::RandomNumberGenerator* rng_;
310 }; 322 };
311 323
312 } // namespace internal 324 } // namespace internal
313 } // namespace v8 325 } // namespace v8
314 326
315 #endif 327 #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