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

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

Issue 904863002: [turbofan] Separate representation type operations from the semantic types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes Created 5 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/test-types.cc ('k') | test/unittests/compiler/typer-unittest.cc » ('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 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_TEST_CCTEST_TYPES_H_ 28 #ifndef V8_TEST_CCTEST_TYPES_H_
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/v8.h" 32 #include "src/v8.h"
32 33
33 namespace v8 { 34 namespace v8 {
34 namespace internal { 35 namespace internal {
35 36
36 37
37 template<class Type, class TypeHandle, class Region> 38 template<class Type, class TypeHandle, class Region>
38 class Types { 39 class Types {
39 public: 40 public:
40 Types(Region* region, Isolate* isolate) 41 Types(Region* region, Isolate* isolate, v8::base::RandomNumberGenerator* rng)
41 : region_(region), rng_(isolate->random_number_generator()) { 42 : region_(region), rng_(rng) {
42 #define DECLARE_TYPE(name, value) \ 43 #define DECLARE_TYPE(name, value) \
43 name = Type::name(region); \ 44 name = Type::name(region); \
44 types.push_back(name); 45 types.push_back(name);
45 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) 46 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE)
46 #undef DECLARE_TYPE 47 #undef DECLARE_TYPE
47 48
48 SignedSmall = Type::SignedSmall(region); 49 SignedSmall = Type::SignedSmall(region);
49 UnsignedSmall = Type::UnsignedSmall(region); 50 UnsignedSmall = Type::UnsignedSmall(region);
50 51
51 object_map = isolate->factory()->NewMap( 52 object_map = isolate->factory()->NewMap(
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 Handle<i::Smi> smi; 126 Handle<i::Smi> smi;
126 Handle<i::HeapNumber> signed32; 127 Handle<i::HeapNumber> signed32;
127 Handle<i::JSObject> object1; 128 Handle<i::JSObject> object1;
128 Handle<i::JSObject> object2; 129 Handle<i::JSObject> object2;
129 Handle<i::JSArray> array; 130 Handle<i::JSArray> array;
130 Handle<i::Oddball> uninitialized; 131 Handle<i::Oddball> uninitialized;
131 132
132 #define DECLARE_TYPE(name, value) TypeHandle name; 133 #define DECLARE_TYPE(name, value) TypeHandle name;
133 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) 134 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE)
134 #undef DECLARE_TYPE 135 #undef DECLARE_TYPE
136
137 #define DECLARE_TYPE(name, value) TypeHandle Mask##name##ForTesting;
138 MASK_BITSET_TYPE_LIST(DECLARE_TYPE)
139 #undef DECLARE_TYPE
135 TypeHandle SignedSmall; 140 TypeHandle SignedSmall;
136 TypeHandle UnsignedSmall; 141 TypeHandle UnsignedSmall;
137 142
138 TypeHandle ObjectClass; 143 TypeHandle ObjectClass;
139 TypeHandle ArrayClass; 144 TypeHandle ArrayClass;
140 TypeHandle NumberClass; 145 TypeHandle NumberClass;
141 TypeHandle UninitializedClass; 146 TypeHandle UninitializedClass;
142 147
143 TypeHandle SmiConstant; 148 TypeHandle SmiConstant;
144 TypeHandle Signed32Constant; 149 TypeHandle Signed32Constant;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 return type; 210 return type;
206 } 211 }
207 212
208 TypeHandle Function2(TypeHandle result, TypeHandle arg1, TypeHandle arg2) { 213 TypeHandle Function2(TypeHandle result, TypeHandle arg1, TypeHandle arg2) {
209 return Type::Function(result, arg1, arg2, region_); 214 return Type::Function(result, arg1, arg2, region_);
210 } 215 }
211 216
212 TypeHandle Union(TypeHandle t1, TypeHandle t2) { 217 TypeHandle Union(TypeHandle t1, TypeHandle t2) {
213 return Type::Union(t1, t2, region_); 218 return Type::Union(t1, t2, region_);
214 } 219 }
220
215 TypeHandle Intersect(TypeHandle t1, TypeHandle t2) { 221 TypeHandle Intersect(TypeHandle t1, TypeHandle t2) {
216 return Type::Intersect(t1, t2, region_); 222 return Type::Intersect(t1, t2, region_);
217 } 223 }
218 224
225 TypeHandle Representation(TypeHandle t) {
226 return Type::Representation(t, region_);
227 }
228
229 // TypeHandle Semantic(TypeHandle t) { return Intersect(t,
230 // MaskSemanticForTesting); }
231 TypeHandle Semantic(TypeHandle t) { return Type::Semantic(t, region_); }
232
219 template<class Type2, class TypeHandle2> 233 template<class Type2, class TypeHandle2>
220 TypeHandle Convert(TypeHandle2 t) { 234 TypeHandle Convert(TypeHandle2 t) {
221 return Type::template Convert<Type2>(t, region_); 235 return Type::template Convert<Type2>(t, region_);
222 } 236 }
223 237
224 TypeHandle Random() { 238 TypeHandle Random() {
225 return types[rng_->NextInt(static_cast<int>(types.size()))]; 239 return types[rng_->NextInt(static_cast<int>(types.size()))];
226 } 240 }
227 241
228 TypeHandle Fuzz(int depth = 4) { 242 TypeHandle Fuzz(int depth = 4) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 320
307 private: 321 private:
308 Region* region_; 322 Region* region_;
309 v8::base::RandomNumberGenerator* rng_; 323 v8::base::RandomNumberGenerator* rng_;
310 }; 324 };
311 325
312 326
313 } } // namespace v8::internal 327 } } // namespace v8::internal
314 328
315 #endif 329 #endif
OLDNEW
« no previous file with comments | « test/cctest/test-types.cc ('k') | test/unittests/compiler/typer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698