| OLD | NEW |
| 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 18 matching lines...) Expand all Loading... |
| 29 #define V8_TEST_CCTEST_TYPES_H_ | 29 #define V8_TEST_CCTEST_TYPES_H_ |
| 30 | 30 |
| 31 #include "src/base/utils/random-number-generator.h" | 31 #include "src/base/utils/random-number-generator.h" |
| 32 #include "src/factory.h" | 32 #include "src/factory.h" |
| 33 #include "src/isolate.h" | 33 #include "src/isolate.h" |
| 34 #include "src/v8.h" | 34 #include "src/v8.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 | |
| 40 class Types { | 39 class Types { |
| 41 public: | 40 public: |
| 42 Types(Zone* zone, Isolate* isolate, v8::base::RandomNumberGenerator* rng) | 41 Types(Zone* zone, Isolate* isolate, v8::base::RandomNumberGenerator* rng) |
| 43 : zone_(zone), isolate_(isolate), rng_(rng) { | 42 : zone_(zone), isolate_(isolate), rng_(rng) { |
| 44 #define DECLARE_TYPE(name, value) \ | 43 #define DECLARE_TYPE(name, value) \ |
| 45 name = Type::name(); \ | 44 name = AstType::name(); \ |
| 46 types.push_back(name); | 45 types.push_back(name); |
| 47 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) | 46 AST_PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) |
| 48 #undef DECLARE_TYPE | 47 #undef DECLARE_TYPE |
| 49 | 48 |
| 50 SignedSmall = Type::SignedSmall(); | 49 SignedSmall = AstType::SignedSmall(); |
| 51 UnsignedSmall = Type::UnsignedSmall(); | 50 UnsignedSmall = AstType::UnsignedSmall(); |
| 52 | 51 |
| 53 object_map = isolate->factory()->NewMap( | 52 object_map = |
| 54 JS_OBJECT_TYPE, JSObject::kHeaderSize); | 53 isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
| 55 array_map = isolate->factory()->NewMap( | 54 array_map = isolate->factory()->NewMap(JS_ARRAY_TYPE, JSArray::kSize); |
| 56 JS_ARRAY_TYPE, JSArray::kSize); | 55 number_map = |
| 57 number_map = isolate->factory()->NewMap( | 56 isolate->factory()->NewMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); |
| 58 HEAP_NUMBER_TYPE, HeapNumber::kSize); | |
| 59 uninitialized_map = isolate->factory()->uninitialized_map(); | 57 uninitialized_map = isolate->factory()->uninitialized_map(); |
| 60 ObjectClass = Type::Class(object_map, zone); | 58 ObjectClass = AstType::Class(object_map, zone); |
| 61 ArrayClass = Type::Class(array_map, zone); | 59 ArrayClass = AstType::Class(array_map, zone); |
| 62 NumberClass = Type::Class(number_map, zone); | 60 NumberClass = AstType::Class(number_map, zone); |
| 63 UninitializedClass = Type::Class(uninitialized_map, zone); | 61 UninitializedClass = AstType::Class(uninitialized_map, zone); |
| 64 | 62 |
| 65 maps.push_back(object_map); | 63 maps.push_back(object_map); |
| 66 maps.push_back(array_map); | 64 maps.push_back(array_map); |
| 67 maps.push_back(uninitialized_map); | 65 maps.push_back(uninitialized_map); |
| 68 for (MapVector::iterator it = maps.begin(); it != maps.end(); ++it) { | 66 for (MapVector::iterator it = maps.begin(); it != maps.end(); ++it) { |
| 69 types.push_back(Type::Class(*it, zone)); | 67 types.push_back(AstType::Class(*it, zone)); |
| 70 } | 68 } |
| 71 | 69 |
| 72 smi = handle(Smi::FromInt(666), isolate); | 70 smi = handle(Smi::FromInt(666), isolate); |
| 73 signed32 = isolate->factory()->NewHeapNumber(0x40000000); | 71 signed32 = isolate->factory()->NewHeapNumber(0x40000000); |
| 74 object1 = isolate->factory()->NewJSObjectFromMap(object_map); | 72 object1 = isolate->factory()->NewJSObjectFromMap(object_map); |
| 75 object2 = isolate->factory()->NewJSObjectFromMap(object_map); | 73 object2 = isolate->factory()->NewJSObjectFromMap(object_map); |
| 76 array = isolate->factory()->NewJSArray(20); | 74 array = isolate->factory()->NewJSArray(20); |
| 77 uninitialized = isolate->factory()->uninitialized_value(); | 75 uninitialized = isolate->factory()->uninitialized_value(); |
| 78 SmiConstant = Type::Constant(smi, zone); | 76 SmiConstant = AstType::Constant(smi, zone); |
| 79 Signed32Constant = Type::Constant(signed32, zone); | 77 Signed32Constant = AstType::Constant(signed32, zone); |
| 80 | 78 |
| 81 ObjectConstant1 = Type::Constant(object1, zone); | 79 ObjectConstant1 = AstType::Constant(object1, zone); |
| 82 ObjectConstant2 = Type::Constant(object2, zone); | 80 ObjectConstant2 = AstType::Constant(object2, zone); |
| 83 ArrayConstant = Type::Constant(array, zone); | 81 ArrayConstant = AstType::Constant(array, zone); |
| 84 UninitializedConstant = Type::Constant(uninitialized, zone); | 82 UninitializedConstant = AstType::Constant(uninitialized, zone); |
| 85 | 83 |
| 86 values.push_back(smi); | 84 values.push_back(smi); |
| 87 values.push_back(signed32); | 85 values.push_back(signed32); |
| 88 values.push_back(object1); | 86 values.push_back(object1); |
| 89 values.push_back(object2); | 87 values.push_back(object2); |
| 90 values.push_back(array); | 88 values.push_back(array); |
| 91 values.push_back(uninitialized); | 89 values.push_back(uninitialized); |
| 92 for (ValueVector::iterator it = values.begin(); it != values.end(); ++it) { | 90 for (ValueVector::iterator it = values.begin(); it != values.end(); ++it) { |
| 93 types.push_back(Type::Constant(*it, zone)); | 91 types.push_back(AstType::Constant(*it, zone)); |
| 94 } | 92 } |
| 95 | 93 |
| 96 integers.push_back(isolate->factory()->NewNumber(-V8_INFINITY)); | 94 integers.push_back(isolate->factory()->NewNumber(-V8_INFINITY)); |
| 97 integers.push_back(isolate->factory()->NewNumber(+V8_INFINITY)); | 95 integers.push_back(isolate->factory()->NewNumber(+V8_INFINITY)); |
| 98 integers.push_back(isolate->factory()->NewNumber(-rng_->NextInt(10))); | 96 integers.push_back(isolate->factory()->NewNumber(-rng_->NextInt(10))); |
| 99 integers.push_back(isolate->factory()->NewNumber(+rng_->NextInt(10))); | 97 integers.push_back(isolate->factory()->NewNumber(+rng_->NextInt(10))); |
| 100 for (int i = 0; i < 10; ++i) { | 98 for (int i = 0; i < 10; ++i) { |
| 101 double x = rng_->NextInt(); | 99 double x = rng_->NextInt(); |
| 102 integers.push_back(isolate->factory()->NewNumber(x)); | 100 integers.push_back(isolate->factory()->NewNumber(x)); |
| 103 x *= rng_->NextInt(); | 101 x *= rng_->NextInt(); |
| 104 if (!IsMinusZero(x)) integers.push_back(isolate->factory()->NewNumber(x)); | 102 if (!IsMinusZero(x)) integers.push_back(isolate->factory()->NewNumber(x)); |
| 105 } | 103 } |
| 106 | 104 |
| 107 Integer = Type::Range(-V8_INFINITY, +V8_INFINITY, zone); | 105 Integer = AstType::Range(-V8_INFINITY, +V8_INFINITY, zone); |
| 108 | 106 |
| 109 NumberArray = Type::Array(Number, zone); | 107 NumberArray = AstType::Array(Number, zone); |
| 110 StringArray = Type::Array(String, zone); | 108 StringArray = AstType::Array(String, zone); |
| 111 AnyArray = Type::Array(Any, zone); | 109 AnyArray = AstType::Array(Any, zone); |
| 112 | 110 |
| 113 SignedFunction1 = Type::Function(SignedSmall, SignedSmall, zone); | 111 SignedFunction1 = AstType::Function(SignedSmall, SignedSmall, zone); |
| 114 NumberFunction1 = Type::Function(Number, Number, zone); | 112 NumberFunction1 = AstType::Function(Number, Number, zone); |
| 115 NumberFunction2 = Type::Function(Number, Number, Number, zone); | 113 NumberFunction2 = AstType::Function(Number, Number, Number, zone); |
| 116 MethodFunction = Type::Function(String, Object, 0, zone); | 114 MethodFunction = AstType::Function(String, Object, 0, zone); |
| 117 | 115 |
| 118 for (int i = 0; i < 30; ++i) { | 116 for (int i = 0; i < 30; ++i) { |
| 119 types.push_back(Fuzz()); | 117 types.push_back(Fuzz()); |
| 120 } | 118 } |
| 121 } | 119 } |
| 122 | 120 |
| 123 Handle<i::Map> object_map; | 121 Handle<i::Map> object_map; |
| 124 Handle<i::Map> array_map; | 122 Handle<i::Map> array_map; |
| 125 Handle<i::Map> number_map; | 123 Handle<i::Map> number_map; |
| 126 Handle<i::Map> uninitialized_map; | 124 Handle<i::Map> uninitialized_map; |
| 127 | 125 |
| 128 Handle<i::Smi> smi; | 126 Handle<i::Smi> smi; |
| 129 Handle<i::HeapNumber> signed32; | 127 Handle<i::HeapNumber> signed32; |
| 130 Handle<i::JSObject> object1; | 128 Handle<i::JSObject> object1; |
| 131 Handle<i::JSObject> object2; | 129 Handle<i::JSObject> object2; |
| 132 Handle<i::JSArray> array; | 130 Handle<i::JSArray> array; |
| 133 Handle<i::Oddball> uninitialized; | 131 Handle<i::Oddball> uninitialized; |
| 134 | 132 |
| 135 #define DECLARE_TYPE(name, value) Type* name; | 133 #define DECLARE_TYPE(name, value) AstType* name; |
| 136 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) | 134 AST_PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) |
| 137 #undef DECLARE_TYPE | 135 #undef DECLARE_TYPE |
| 138 | 136 |
| 139 #define DECLARE_TYPE(name, value) Type* Mask##name##ForTesting; | 137 #define DECLARE_TYPE(name, value) AstType* Mask##name##ForTesting; |
| 140 MASK_BITSET_TYPE_LIST(DECLARE_TYPE) | 138 AST_MASK_BITSET_TYPE_LIST(DECLARE_TYPE) |
| 141 #undef DECLARE_TYPE | 139 #undef DECLARE_TYPE |
| 142 Type* SignedSmall; | 140 AstType* SignedSmall; |
| 143 Type* UnsignedSmall; | 141 AstType* UnsignedSmall; |
| 144 | 142 |
| 145 Type* ObjectClass; | 143 AstType* ObjectClass; |
| 146 Type* ArrayClass; | 144 AstType* ArrayClass; |
| 147 Type* NumberClass; | 145 AstType* NumberClass; |
| 148 Type* UninitializedClass; | 146 AstType* UninitializedClass; |
| 149 | 147 |
| 150 Type* SmiConstant; | 148 AstType* SmiConstant; |
| 151 Type* Signed32Constant; | 149 AstType* Signed32Constant; |
| 152 Type* ObjectConstant1; | 150 AstType* ObjectConstant1; |
| 153 Type* ObjectConstant2; | 151 AstType* ObjectConstant2; |
| 154 Type* ArrayConstant; | 152 AstType* ArrayConstant; |
| 155 Type* UninitializedConstant; | 153 AstType* UninitializedConstant; |
| 156 | 154 |
| 157 Type* Integer; | 155 AstType* Integer; |
| 158 | 156 |
| 159 Type* NumberArray; | 157 AstType* NumberArray; |
| 160 Type* StringArray; | 158 AstType* StringArray; |
| 161 Type* AnyArray; | 159 AstType* AnyArray; |
| 162 | 160 |
| 163 Type* SignedFunction1; | 161 AstType* SignedFunction1; |
| 164 Type* NumberFunction1; | 162 AstType* NumberFunction1; |
| 165 Type* NumberFunction2; | 163 AstType* NumberFunction2; |
| 166 Type* MethodFunction; | 164 AstType* MethodFunction; |
| 167 | 165 |
| 168 typedef std::vector<Type*> TypeVector; | 166 typedef std::vector<AstType*> TypeVector; |
| 169 typedef std::vector<Handle<i::Map> > MapVector; | 167 typedef std::vector<Handle<i::Map> > MapVector; |
| 170 typedef std::vector<Handle<i::Object> > ValueVector; | 168 typedef std::vector<Handle<i::Object> > ValueVector; |
| 171 | 169 |
| 172 TypeVector types; | 170 TypeVector types; |
| 173 MapVector maps; | 171 MapVector maps; |
| 174 ValueVector values; | 172 ValueVector values; |
| 175 ValueVector integers; // "Integer" values used for range limits. | 173 ValueVector integers; // "Integer" values used for range limits. |
| 176 | 174 |
| 177 Type* Of(Handle<i::Object> value) { return Type::Of(value, zone_); } | 175 AstType* Of(Handle<i::Object> value) { return AstType::Of(value, zone_); } |
| 178 | 176 |
| 179 Type* NowOf(Handle<i::Object> value) { return Type::NowOf(value, zone_); } | 177 AstType* NowOf(Handle<i::Object> value) { |
| 180 | 178 return AstType::NowOf(value, zone_); |
| 181 Type* Class(Handle<i::Map> map) { return Type::Class(map, zone_); } | |
| 182 | |
| 183 Type* Constant(Handle<i::Object> value) { | |
| 184 return Type::Constant(value, zone_); | |
| 185 } | 179 } |
| 186 | 180 |
| 187 Type* Range(double min, double max) { return Type::Range(min, max, zone_); } | 181 AstType* Class(Handle<i::Map> map) { return AstType::Class(map, zone_); } |
| 188 | 182 |
| 189 Type* Context(Type* outer) { return Type::Context(outer, zone_); } | 183 AstType* Constant(Handle<i::Object> value) { |
| 190 | 184 return AstType::Constant(value, zone_); |
| 191 Type* Array1(Type* element) { return Type::Array(element, zone_); } | |
| 192 | |
| 193 Type* Function0(Type* result, Type* receiver) { | |
| 194 return Type::Function(result, receiver, 0, zone_); | |
| 195 } | 185 } |
| 196 | 186 |
| 197 Type* Function1(Type* result, Type* receiver, Type* arg) { | 187 AstType* Range(double min, double max) { |
| 198 Type* type = Type::Function(result, receiver, 1, zone_); | 188 return AstType::Range(min, max, zone_); |
| 189 } |
| 190 |
| 191 AstType* Context(AstType* outer) { return AstType::Context(outer, zone_); } |
| 192 |
| 193 AstType* Array1(AstType* element) { return AstType::Array(element, zone_); } |
| 194 |
| 195 AstType* Function0(AstType* result, AstType* receiver) { |
| 196 return AstType::Function(result, receiver, 0, zone_); |
| 197 } |
| 198 |
| 199 AstType* Function1(AstType* result, AstType* receiver, AstType* arg) { |
| 200 AstType* type = AstType::Function(result, receiver, 1, zone_); |
| 199 type->AsFunction()->InitParameter(0, arg); | 201 type->AsFunction()->InitParameter(0, arg); |
| 200 return type; | 202 return type; |
| 201 } | 203 } |
| 202 | 204 |
| 203 Type* Function2(Type* result, Type* arg1, Type* arg2) { | 205 AstType* Function2(AstType* result, AstType* arg1, AstType* arg2) { |
| 204 return Type::Function(result, arg1, arg2, zone_); | 206 return AstType::Function(result, arg1, arg2, zone_); |
| 205 } | 207 } |
| 206 | 208 |
| 207 Type* Union(Type* t1, Type* t2) { return Type::Union(t1, t2, zone_); } | 209 AstType* Union(AstType* t1, AstType* t2) { |
| 210 return AstType::Union(t1, t2, zone_); |
| 211 } |
| 208 | 212 |
| 209 Type* Intersect(Type* t1, Type* t2) { return Type::Intersect(t1, t2, zone_); } | 213 AstType* Intersect(AstType* t1, AstType* t2) { |
| 214 return AstType::Intersect(t1, t2, zone_); |
| 215 } |
| 210 | 216 |
| 211 Type* Representation(Type* t) { return Type::Representation(t, zone_); } | 217 AstType* Representation(AstType* t) { |
| 218 return AstType::Representation(t, zone_); |
| 219 } |
| 212 | 220 |
| 213 Type* Semantic(Type* t) { return Type::Semantic(t, zone_); } | 221 AstType* Semantic(AstType* t) { return AstType::Semantic(t, zone_); } |
| 214 | 222 |
| 215 Type* Random() { | 223 AstType* Random() { |
| 216 return types[rng_->NextInt(static_cast<int>(types.size()))]; | 224 return types[rng_->NextInt(static_cast<int>(types.size()))]; |
| 217 } | 225 } |
| 218 | 226 |
| 219 Type* Fuzz(int depth = 4) { | 227 AstType* Fuzz(int depth = 4) { |
| 220 switch (rng_->NextInt(depth == 0 ? 3 : 20)) { | 228 switch (rng_->NextInt(depth == 0 ? 3 : 20)) { |
| 221 case 0: { // bitset | 229 case 0: { // bitset |
| 222 #define COUNT_BITSET_TYPES(type, value) + 1 | 230 #define COUNT_BITSET_TYPES(type, value) +1 |
| 223 int n = 0 PROPER_BITSET_TYPE_LIST(COUNT_BITSET_TYPES); | 231 int n = 0 AST_PROPER_BITSET_TYPE_LIST(COUNT_BITSET_TYPES); |
| 224 #undef COUNT_BITSET_TYPES | 232 #undef COUNT_BITSET_TYPES |
| 225 // Pick a bunch of named bitsets and return their intersection. | 233 // Pick a bunch of named bitsets and return their intersection. |
| 226 Type* result = Type::Any(); | 234 AstType* result = AstType::Any(); |
| 227 for (int i = 0, m = 1 + rng_->NextInt(3); i < m; ++i) { | 235 for (int i = 0, m = 1 + rng_->NextInt(3); i < m; ++i) { |
| 228 int j = rng_->NextInt(n); | 236 int j = rng_->NextInt(n); |
| 229 #define PICK_BITSET_TYPE(type, value) \ | 237 #define PICK_BITSET_TYPE(type, value) \ |
| 230 if (j-- == 0) { \ | 238 if (j-- == 0) { \ |
| 231 Type* tmp = Type::Intersect(result, Type::type(), zone_); \ | 239 AstType* tmp = AstType::Intersect(result, AstType::type(), zone_); \ |
| 232 if (tmp->Is(Type::None()) && i != 0) { \ | 240 if (tmp->Is(AstType::None()) && i != 0) { \ |
| 233 break; \ | 241 break; \ |
| 234 } else { \ | 242 } else { \ |
| 235 result = tmp; \ | 243 result = tmp; \ |
| 236 continue; \ | 244 continue; \ |
| 237 } \ | 245 } \ |
| 238 } | 246 } |
| 239 PROPER_BITSET_TYPE_LIST(PICK_BITSET_TYPE) | 247 AST_PROPER_BITSET_TYPE_LIST(PICK_BITSET_TYPE) |
| 240 #undef PICK_BITSET_TYPE | 248 #undef PICK_BITSET_TYPE |
| 241 } | 249 } |
| 242 return result; | 250 return result; |
| 243 } | 251 } |
| 244 case 1: { // class | 252 case 1: { // class |
| 245 int i = rng_->NextInt(static_cast<int>(maps.size())); | 253 int i = rng_->NextInt(static_cast<int>(maps.size())); |
| 246 return Type::Class(maps[i], zone_); | 254 return AstType::Class(maps[i], zone_); |
| 247 } | 255 } |
| 248 case 2: { // constant | 256 case 2: { // constant |
| 249 int i = rng_->NextInt(static_cast<int>(values.size())); | 257 int i = rng_->NextInt(static_cast<int>(values.size())); |
| 250 return Type::Constant(values[i], zone_); | 258 return AstType::Constant(values[i], zone_); |
| 251 } | 259 } |
| 252 case 3: { // range | 260 case 3: { // range |
| 253 int i = rng_->NextInt(static_cast<int>(integers.size())); | 261 int i = rng_->NextInt(static_cast<int>(integers.size())); |
| 254 int j = rng_->NextInt(static_cast<int>(integers.size())); | 262 int j = rng_->NextInt(static_cast<int>(integers.size())); |
| 255 double min = integers[i]->Number(); | 263 double min = integers[i]->Number(); |
| 256 double max = integers[j]->Number(); | 264 double max = integers[j]->Number(); |
| 257 if (min > max) std::swap(min, max); | 265 if (min > max) std::swap(min, max); |
| 258 return Type::Range(min, max, zone_); | 266 return AstType::Range(min, max, zone_); |
| 259 } | 267 } |
| 260 case 4: { // context | 268 case 4: { // context |
| 261 int depth = rng_->NextInt(3); | 269 int depth = rng_->NextInt(3); |
| 262 Type* type = Type::Internal(); | 270 AstType* type = AstType::Internal(); |
| 263 for (int i = 0; i < depth; ++i) type = Type::Context(type, zone_); | 271 for (int i = 0; i < depth; ++i) type = AstType::Context(type, zone_); |
| 264 return type; | 272 return type; |
| 265 } | 273 } |
| 266 case 5: { // array | 274 case 5: { // array |
| 267 Type* element = Fuzz(depth / 2); | 275 AstType* element = Fuzz(depth / 2); |
| 268 return Type::Array(element, zone_); | 276 return AstType::Array(element, zone_); |
| 269 } | 277 } |
| 270 case 6: | 278 case 6: |
| 271 case 7: { // function | 279 case 7: { // function |
| 272 Type* result = Fuzz(depth / 2); | 280 AstType* result = Fuzz(depth / 2); |
| 273 Type* receiver = Fuzz(depth / 2); | 281 AstType* receiver = Fuzz(depth / 2); |
| 274 int arity = rng_->NextInt(3); | 282 int arity = rng_->NextInt(3); |
| 275 Type* type = Type::Function(result, receiver, arity, zone_); | 283 AstType* type = AstType::Function(result, receiver, arity, zone_); |
| 276 for (int i = 0; i < type->AsFunction()->Arity(); ++i) { | 284 for (int i = 0; i < type->AsFunction()->Arity(); ++i) { |
| 277 Type* parameter = Fuzz(depth / 2); | 285 AstType* parameter = Fuzz(depth / 2); |
| 278 type->AsFunction()->InitParameter(i, parameter); | 286 type->AsFunction()->InitParameter(i, parameter); |
| 279 } | 287 } |
| 280 return type; | 288 return type; |
| 281 } | 289 } |
| 282 case 8: { // simd | 290 case 8: { // simd |
| 283 static const int num_simd_types = | 291 static const int num_simd_types = |
| 284 #define COUNT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) +1 | 292 #define COUNT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) +1 |
| 285 SIMD128_TYPES(COUNT_SIMD_TYPE); | 293 SIMD128_TYPES(COUNT_SIMD_TYPE); |
| 286 #undef COUNT_SIMD_TYPE | 294 #undef COUNT_SIMD_TYPE |
| 287 Type* (*simd_constructors[num_simd_types])(Isolate*, Zone*) = { | 295 AstType* (*simd_constructors[num_simd_types])(Isolate*, Zone*) = { |
| 288 #define COUNT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) \ | 296 #define COUNT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) &AstType::Name, |
| 289 &Type::Name, | |
| 290 SIMD128_TYPES(COUNT_SIMD_TYPE) | 297 SIMD128_TYPES(COUNT_SIMD_TYPE) |
| 291 #undef COUNT_SIMD_TYPE | 298 #undef COUNT_SIMD_TYPE |
| 292 }; | 299 }; |
| 293 return simd_constructors[rng_->NextInt(num_simd_types)](isolate_, | 300 return simd_constructors[rng_->NextInt(num_simd_types)](isolate_, |
| 294 zone_); | 301 zone_); |
| 295 } | 302 } |
| 296 default: { // union | 303 default: { // union |
| 297 int n = rng_->NextInt(10); | 304 int n = rng_->NextInt(10); |
| 298 Type* type = None; | 305 AstType* type = None; |
| 299 for (int i = 0; i < n; ++i) { | 306 for (int i = 0; i < n; ++i) { |
| 300 Type* operand = Fuzz(depth - 1); | 307 AstType* operand = Fuzz(depth - 1); |
| 301 type = Type::Union(type, operand, zone_); | 308 type = AstType::Union(type, operand, zone_); |
| 302 } | 309 } |
| 303 return type; | 310 return type; |
| 304 } | 311 } |
| 305 } | 312 } |
| 306 UNREACHABLE(); | 313 UNREACHABLE(); |
| 307 } | 314 } |
| 308 | 315 |
| 309 Zone* zone() { return zone_; } | 316 Zone* zone() { return zone_; } |
| 310 | 317 |
| 311 private: | 318 private: |
| 312 Zone* zone_; | 319 Zone* zone_; |
| 313 Isolate* isolate_; | 320 Isolate* isolate_; |
| 314 v8::base::RandomNumberGenerator* rng_; | 321 v8::base::RandomNumberGenerator* rng_; |
| 315 }; | 322 }; |
| 316 | 323 |
| 317 | |
| 318 } // namespace internal | 324 } // namespace internal |
| 319 } // namespace v8 | 325 } // namespace v8 |
| 320 | 326 |
| 321 #endif | 327 #endif |
| OLD | NEW |