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

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

Issue 794663002: Revert of Avoid number range holes in bitset types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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/js-builtin-reducer-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 22 matching lines...) Expand all
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 36
37 template<class Type, class TypeHandle, class Region> 37 template<class Type, class TypeHandle, class Region>
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 if (SmiValuesAre31Bits() || \
45 (!Type::name(region)->Equals(Type::OtherSigned32()) && \
46 !Type::name(region)->Equals(Type::OtherUnsigned31()))) { \
47 /* Hack: Avoid generating those empty bitset types. */ \
48 types.push_back(name); \
49 }
45 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) 50 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE)
46 #undef DECLARE_TYPE 51 #undef DECLARE_TYPE
47 52
48 object_map = isolate->factory()->NewMap( 53 object_map = isolate->factory()->NewMap(
49 JS_OBJECT_TYPE, JSObject::kHeaderSize); 54 JS_OBJECT_TYPE, JSObject::kHeaderSize);
50 array_map = isolate->factory()->NewMap( 55 array_map = isolate->factory()->NewMap(
51 JS_ARRAY_TYPE, JSArray::kSize); 56 JS_ARRAY_TYPE, JSArray::kSize);
52 number_map = isolate->factory()->NewMap( 57 number_map = isolate->factory()->NewMap(
53 HEAP_NUMBER_TYPE, HeapNumber::kSize); 58 HEAP_NUMBER_TYPE, HeapNumber::kSize);
54 uninitialized_map = isolate->factory()->uninitialized_map(); 59 uninitialized_map = isolate->factory()->uninitialized_map();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 Handle<i::Map> uninitialized_map; 126 Handle<i::Map> uninitialized_map;
122 127
123 Handle<i::Smi> smi; 128 Handle<i::Smi> smi;
124 Handle<i::HeapNumber> signed32; 129 Handle<i::HeapNumber> signed32;
125 Handle<i::JSObject> object1; 130 Handle<i::JSObject> object1;
126 Handle<i::JSObject> object2; 131 Handle<i::JSObject> object2;
127 Handle<i::JSArray> array; 132 Handle<i::JSArray> array;
128 Handle<i::Oddball> uninitialized; 133 Handle<i::Oddball> uninitialized;
129 134
130 #define DECLARE_TYPE(name, value) TypeHandle name; 135 #define DECLARE_TYPE(name, value) TypeHandle name;
131 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) 136 BITSET_TYPE_LIST(DECLARE_TYPE)
132 #undef DECLARE_TYPE 137 #undef DECLARE_TYPE
133 138
134 TypeHandle ObjectClass; 139 TypeHandle ObjectClass;
135 TypeHandle ArrayClass; 140 TypeHandle ArrayClass;
136 TypeHandle NumberClass; 141 TypeHandle NumberClass;
137 TypeHandle UninitializedClass; 142 TypeHandle UninitializedClass;
138 143
139 TypeHandle SmiConstant; 144 TypeHandle SmiConstant;
140 TypeHandle Signed32Constant; 145 TypeHandle Signed32Constant;
141 TypeHandle ObjectConstant1; 146 TypeHandle ObjectConstant1;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 case 0: { // bitset 231 case 0: { // bitset
227 #define COUNT_BITSET_TYPES(type, value) + 1 232 #define COUNT_BITSET_TYPES(type, value) + 1
228 int n = 0 PROPER_BITSET_TYPE_LIST(COUNT_BITSET_TYPES); 233 int n = 0 PROPER_BITSET_TYPE_LIST(COUNT_BITSET_TYPES);
229 #undef COUNT_BITSET_TYPES 234 #undef COUNT_BITSET_TYPES
230 // Pick a bunch of named bitsets and return their intersection. 235 // Pick a bunch of named bitsets and return their intersection.
231 TypeHandle result = Type::Any(region_); 236 TypeHandle result = Type::Any(region_);
232 for (int i = 0, m = 1 + rng_->NextInt(3); i < m; ++i) { 237 for (int i = 0, m = 1 + rng_->NextInt(3); i < m; ++i) {
233 int j = rng_->NextInt(n); 238 int j = rng_->NextInt(n);
234 #define PICK_BITSET_TYPE(type, value) \ 239 #define PICK_BITSET_TYPE(type, value) \
235 if (j-- == 0) { \ 240 if (j-- == 0) { \
241 if (!SmiValuesAre31Bits() && \
242 (Type::type(region_)->Equals(Type::OtherSigned32()) || \
243 Type::type(region_)->Equals(Type::OtherUnsigned31()))) { \
244 /* Hack: Avoid generating those empty bitset types. */ \
245 continue; \
246 } \
236 TypeHandle tmp = Type::Intersect( \ 247 TypeHandle tmp = Type::Intersect( \
237 result, Type::type(region_), region_); \ 248 result, Type::type(region_), region_); \
238 if (tmp->Is(Type::None()) && i != 0) { \ 249 if (tmp->Is(Type::None()) && i != 0) { \
239 break; \ 250 break; \
240 } else { \ 251 } else { \
241 result = tmp; \ 252 result = tmp; \
242 continue; \ 253 continue; \
243 } \ 254 } \
244 } 255 }
245 PROPER_BITSET_TYPE_LIST(PICK_BITSET_TYPE) 256 PROPER_BITSET_TYPE_LIST(PICK_BITSET_TYPE)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 313
303 private: 314 private:
304 Region* region_; 315 Region* region_;
305 v8::base::RandomNumberGenerator* rng_; 316 v8::base::RandomNumberGenerator* rng_;
306 }; 317 };
307 318
308 319
309 } } // namespace v8::internal 320 } } // namespace v8::internal
310 321
311 #endif 322 #endif
OLDNEW
« no previous file with comments | « test/cctest/test-types.cc ('k') | test/unittests/compiler/js-builtin-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698