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 27 matching lines...) Expand all Loading... | |
38 class Types { | 38 class Types { |
39 public: | 39 public: |
40 Types(Region* region, Isolate* isolate) | 40 Types(Region* region, Isolate* isolate) |
41 : region_(region), rng_(isolate->random_number_generator()) { | 41 : region_(region), rng_(isolate->random_number_generator()) { |
42 #define DECLARE_TYPE(name, value) \ | 42 #define DECLARE_TYPE(name, value) \ |
43 name = Type::name(region); \ | 43 name = Type::name(region); \ |
44 types.push_back(name); | 44 types.push_back(name); |
45 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) | 45 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) |
46 #undef DECLARE_TYPE | 46 #undef DECLARE_TYPE |
47 | 47 |
48 #define DECLARE_TYPE(name, value) \ | |
49 Mask##name##ForTesting = Type::Mask##name##ForTesting(region); \ | |
50 types.push_back(Mask##name##ForTesting); | |
51 MASK_BITSET_TYPE_LIST(DECLARE_TYPE) | |
52 #undef DECLARE_TYPE | |
53 | |
48 SignedSmall = Type::SignedSmall(region); | 54 SignedSmall = Type::SignedSmall(region); |
49 UnsignedSmall = Type::UnsignedSmall(region); | 55 UnsignedSmall = Type::UnsignedSmall(region); |
50 | 56 |
51 object_map = isolate->factory()->NewMap( | 57 object_map = isolate->factory()->NewMap( |
52 JS_OBJECT_TYPE, JSObject::kHeaderSize); | 58 JS_OBJECT_TYPE, JSObject::kHeaderSize); |
53 array_map = isolate->factory()->NewMap( | 59 array_map = isolate->factory()->NewMap( |
54 JS_ARRAY_TYPE, JSArray::kSize); | 60 JS_ARRAY_TYPE, JSArray::kSize); |
55 number_map = isolate->factory()->NewMap( | 61 number_map = isolate->factory()->NewMap( |
56 HEAP_NUMBER_TYPE, HeapNumber::kSize); | 62 HEAP_NUMBER_TYPE, HeapNumber::kSize); |
57 uninitialized_map = isolate->factory()->uninitialized_map(); | 63 uninitialized_map = isolate->factory()->uninitialized_map(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 Handle<i::Smi> smi; | 131 Handle<i::Smi> smi; |
126 Handle<i::HeapNumber> signed32; | 132 Handle<i::HeapNumber> signed32; |
127 Handle<i::JSObject> object1; | 133 Handle<i::JSObject> object1; |
128 Handle<i::JSObject> object2; | 134 Handle<i::JSObject> object2; |
129 Handle<i::JSArray> array; | 135 Handle<i::JSArray> array; |
130 Handle<i::Oddball> uninitialized; | 136 Handle<i::Oddball> uninitialized; |
131 | 137 |
132 #define DECLARE_TYPE(name, value) TypeHandle name; | 138 #define DECLARE_TYPE(name, value) TypeHandle name; |
133 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) | 139 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) |
134 #undef DECLARE_TYPE | 140 #undef DECLARE_TYPE |
141 | |
142 #define DECLARE_TYPE(name, value) TypeHandle Mask##name##ForTesting; | |
143 MASK_BITSET_TYPE_LIST(DECLARE_TYPE) | |
144 #undef DECLARE_TYPE | |
135 TypeHandle SignedSmall; | 145 TypeHandle SignedSmall; |
136 TypeHandle UnsignedSmall; | 146 TypeHandle UnsignedSmall; |
137 | 147 |
138 TypeHandle ObjectClass; | 148 TypeHandle ObjectClass; |
139 TypeHandle ArrayClass; | 149 TypeHandle ArrayClass; |
140 TypeHandle NumberClass; | 150 TypeHandle NumberClass; |
141 TypeHandle UninitializedClass; | 151 TypeHandle UninitializedClass; |
142 | 152 |
143 TypeHandle SmiConstant; | 153 TypeHandle SmiConstant; |
144 TypeHandle Signed32Constant; | 154 TypeHandle Signed32Constant; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 return type; | 215 return type; |
206 } | 216 } |
207 | 217 |
208 TypeHandle Function2(TypeHandle result, TypeHandle arg1, TypeHandle arg2) { | 218 TypeHandle Function2(TypeHandle result, TypeHandle arg1, TypeHandle arg2) { |
209 return Type::Function(result, arg1, arg2, region_); | 219 return Type::Function(result, arg1, arg2, region_); |
210 } | 220 } |
211 | 221 |
212 TypeHandle Union(TypeHandle t1, TypeHandle t2) { | 222 TypeHandle Union(TypeHandle t1, TypeHandle t2) { |
213 return Type::Union(t1, t2, region_); | 223 return Type::Union(t1, t2, region_); |
214 } | 224 } |
225 | |
215 TypeHandle Intersect(TypeHandle t1, TypeHandle t2) { | 226 TypeHandle Intersect(TypeHandle t1, TypeHandle t2) { |
216 return Type::Intersect(t1, t2, region_); | 227 return Type::Intersect(t1, t2, region_); |
217 } | 228 } |
218 | 229 |
230 TypeHandle ProjectRepresentation(TypeHandle t) { | |
rossberg
2015/02/11 12:34:11
The Type class should probably just have two metho
Jarin
2015/02/11 16:10:49
Done.
| |
231 return Intersect(t, MaskRepresentationForTesting); | |
232 } | |
233 | |
234 TypeHandle ProjectSemantic(TypeHandle t) { | |
235 return Intersect(t, MaskSemanticForTesting); | |
236 } | |
237 | |
219 template<class Type2, class TypeHandle2> | 238 template<class Type2, class TypeHandle2> |
220 TypeHandle Convert(TypeHandle2 t) { | 239 TypeHandle Convert(TypeHandle2 t) { |
221 return Type::template Convert<Type2>(t, region_); | 240 return Type::template Convert<Type2>(t, region_); |
222 } | 241 } |
223 | 242 |
224 TypeHandle Random() { | 243 TypeHandle Random() { |
225 return types[rng_->NextInt(static_cast<int>(types.size()))]; | 244 return types[rng_->NextInt(static_cast<int>(types.size()))]; |
226 } | 245 } |
227 | 246 |
228 TypeHandle Fuzz(int depth = 4) { | 247 TypeHandle Fuzz(int depth = 4) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 | 325 |
307 private: | 326 private: |
308 Region* region_; | 327 Region* region_; |
309 v8::base::RandomNumberGenerator* rng_; | 328 v8::base::RandomNumberGenerator* rng_; |
310 }; | 329 }; |
311 | 330 |
312 | 331 |
313 } } // namespace v8::internal | 332 } } // namespace v8::internal |
314 | 333 |
315 #endif | 334 #endif |
OLD | NEW |