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

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

Issue 2381523002: [Turbofan] Introduce OtherNumberConstant. (Closed)
Patch Set: REBASE. Created 4 years, 2 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 object_map = isolate->factory()->NewMap( 53 object_map = isolate->factory()->NewMap(
54 JS_OBJECT_TYPE, JSObject::kHeaderSize); 54 JS_OBJECT_TYPE, JSObject::kHeaderSize);
55 55
56 smi = handle(Smi::FromInt(666), isolate); 56 smi = handle(Smi::FromInt(666), isolate);
57 signed32 = isolate->factory()->NewHeapNumber(0x40000000); 57 signed32 = isolate->factory()->NewHeapNumber(0x40000000);
58 object1 = isolate->factory()->NewJSObjectFromMap(object_map); 58 object1 = isolate->factory()->NewJSObjectFromMap(object_map);
59 object2 = isolate->factory()->NewJSObjectFromMap(object_map); 59 object2 = isolate->factory()->NewJSObjectFromMap(object_map);
60 array = isolate->factory()->NewJSArray(20); 60 array = isolate->factory()->NewJSArray(20);
61 uninitialized = isolate->factory()->uninitialized_value(); 61 uninitialized = isolate->factory()->uninitialized_value();
62 SmiConstant = Type::Constant(smi, zone); 62 SmiConstant = Type::NewConstant(smi, zone);
63 Signed32Constant = Type::Constant(signed32, zone); 63 Signed32Constant = Type::NewConstant(signed32, zone);
64 64
65 ObjectConstant1 = Type::Constant(object1, zone); 65 ObjectConstant1 = Type::Constant(object1, zone);
66 ObjectConstant2 = Type::Constant(object2, zone); 66 ObjectConstant2 = Type::Constant(object2, zone);
67 ArrayConstant = Type::Constant(array, zone); 67 ArrayConstant = Type::Constant(array, zone);
68 UninitializedConstant = Type::Constant(uninitialized, zone); 68 UninitializedConstant = Type::Constant(uninitialized, zone);
69 69
70 values.push_back(smi); 70 values.push_back(smi);
71 values.push_back(signed32); 71 values.push_back(signed32);
72 values.push_back(object1); 72 values.push_back(object1);
73 values.push_back(object2); 73 values.push_back(object2);
74 values.push_back(array); 74 values.push_back(array);
75 values.push_back(uninitialized); 75 values.push_back(uninitialized);
76 for (ValueVector::iterator it = values.begin(); it != values.end(); ++it) { 76 for (ValueVector::iterator it = values.begin(); it != values.end(); ++it) {
77 types.push_back(Type::Constant(*it, zone)); 77 types.push_back(Type::NewConstant(*it, zone));
78 } 78 }
79 79
80 integers.push_back(isolate->factory()->NewNumber(-V8_INFINITY)); 80 integers.push_back(isolate->factory()->NewNumber(-V8_INFINITY));
81 integers.push_back(isolate->factory()->NewNumber(+V8_INFINITY)); 81 integers.push_back(isolate->factory()->NewNumber(+V8_INFINITY));
82 integers.push_back(isolate->factory()->NewNumber(-rng_->NextInt(10))); 82 integers.push_back(isolate->factory()->NewNumber(-rng_->NextInt(10)));
83 integers.push_back(isolate->factory()->NewNumber(+rng_->NextInt(10))); 83 integers.push_back(isolate->factory()->NewNumber(+rng_->NextInt(10)));
84 for (int i = 0; i < 10; ++i) { 84 for (int i = 0; i < 10; ++i) {
85 double x = rng_->NextInt(); 85 double x = rng_->NextInt();
86 integers.push_back(isolate->factory()->NewNumber(x)); 86 integers.push_back(isolate->factory()->NewNumber(x));
87 x *= rng_->NextInt(); 87 x *= rng_->NextInt();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 typedef std::vector<Type*> TypeVector; 123 typedef std::vector<Type*> TypeVector;
124 typedef std::vector<Handle<i::Object> > ValueVector; 124 typedef std::vector<Handle<i::Object> > ValueVector;
125 125
126 TypeVector types; 126 TypeVector types;
127 ValueVector values; 127 ValueVector values;
128 ValueVector integers; // "Integer" values used for range limits. 128 ValueVector integers; // "Integer" values used for range limits.
129 129
130 Type* Of(Handle<i::Object> value) { return Type::Of(value, zone_); } 130 Type* Of(Handle<i::Object> value) { return Type::Of(value, zone_); }
131 131
132 Type* NewConstant(Handle<i::Object> value) {
133 return Type::NewConstant(value, zone_);
134 }
135
132 Type* Constant(Handle<i::Object> value) { 136 Type* Constant(Handle<i::Object> value) {
133 return Type::Constant(value, zone_); 137 return Type::Constant(value, zone_);
134 } 138 }
135 139
136 Type* Range(double min, double max) { return Type::Range(min, max, zone_); } 140 Type* Range(double min, double max) { return Type::Range(min, max, zone_); }
137 141
138 Type* Union(Type* t1, Type* t2) { return Type::Union(t1, t2, zone_); } 142 Type* Union(Type* t1, Type* t2) { return Type::Union(t1, t2, zone_); }
139 143
140 Type* Intersect(Type* t1, Type* t2) { return Type::Intersect(t1, t2, zone_); } 144 Type* Intersect(Type* t1, Type* t2) { return Type::Intersect(t1, t2, zone_); }
141 145
(...skipping 21 matching lines...) Expand all
163 continue; \ 167 continue; \
164 } \ 168 } \
165 } 169 }
166 PROPER_BITSET_TYPE_LIST(PICK_BITSET_TYPE) 170 PROPER_BITSET_TYPE_LIST(PICK_BITSET_TYPE)
167 #undef PICK_BITSET_TYPE 171 #undef PICK_BITSET_TYPE
168 } 172 }
169 return result; 173 return result;
170 } 174 }
171 case 1: { // constant 175 case 1: { // constant
172 int i = rng_->NextInt(static_cast<int>(values.size())); 176 int i = rng_->NextInt(static_cast<int>(values.size()));
173 return Type::Constant(values[i], zone_); 177 return Type::NewConstant(values[i], zone_);
174 } 178 }
175 case 2: { // range 179 case 2: { // range
176 int i = rng_->NextInt(static_cast<int>(integers.size())); 180 int i = rng_->NextInt(static_cast<int>(integers.size()));
177 int j = rng_->NextInt(static_cast<int>(integers.size())); 181 int j = rng_->NextInt(static_cast<int>(integers.size()));
178 double min = integers[i]->Number(); 182 double min = integers[i]->Number();
179 double max = integers[j]->Number(); 183 double max = integers[j]->Number();
180 if (min > max) std::swap(min, max); 184 if (min > max) std::swap(min, max);
181 return Type::Range(min, max, zone_); 185 return Type::Range(min, max, zone_);
182 } 186 }
183 default: { // union 187 default: { // union
(...skipping 14 matching lines...) Expand all
198 private: 202 private:
199 Zone* zone_; 203 Zone* zone_;
200 v8::base::RandomNumberGenerator* rng_; 204 v8::base::RandomNumberGenerator* rng_;
201 }; 205 };
202 206
203 } // namespace compiler 207 } // namespace compiler
204 } // namespace internal 208 } // namespace internal
205 } // namespace v8 209 } // namespace v8
206 210
207 #endif 211 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698