| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 integers.push_back(isolate->factory()->NewNumber(+V8_INFINITY)); | 94 integers.push_back(isolate->factory()->NewNumber(+V8_INFINITY)); |
| 95 integers.push_back(isolate->factory()->NewNumber(-rng_->NextInt(10))); | 95 integers.push_back(isolate->factory()->NewNumber(-rng_->NextInt(10))); |
| 96 integers.push_back(isolate->factory()->NewNumber(+rng_->NextInt(10))); | 96 integers.push_back(isolate->factory()->NewNumber(+rng_->NextInt(10))); |
| 97 for (int i = 0; i < 10; ++i) { | 97 for (int i = 0; i < 10; ++i) { |
| 98 double x = rng_->NextInt(); | 98 double x = rng_->NextInt(); |
| 99 integers.push_back(isolate->factory()->NewNumber(x)); | 99 integers.push_back(isolate->factory()->NewNumber(x)); |
| 100 x *= rng_->NextInt(); | 100 x *= rng_->NextInt(); |
| 101 if (!IsMinusZero(x)) integers.push_back(isolate->factory()->NewNumber(x)); | 101 if (!IsMinusZero(x)) integers.push_back(isolate->factory()->NewNumber(x)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 Integer = Type::Range(isolate->factory()->NewNumber(-V8_INFINITY), | 104 Integer = Type::Range(-V8_INFINITY, +V8_INFINITY, region); |
| 105 isolate->factory()->NewNumber(+V8_INFINITY), region); | |
| 106 | 105 |
| 107 NumberArray = Type::Array(Number, region); | 106 NumberArray = Type::Array(Number, region); |
| 108 StringArray = Type::Array(String, region); | 107 StringArray = Type::Array(String, region); |
| 109 AnyArray = Type::Array(Any, region); | 108 AnyArray = Type::Array(Any, region); |
| 110 | 109 |
| 111 SignedFunction1 = Type::Function(SignedSmall, SignedSmall, region); | 110 SignedFunction1 = Type::Function(SignedSmall, SignedSmall, region); |
| 112 NumberFunction1 = Type::Function(Number, Number, region); | 111 NumberFunction1 = Type::Function(Number, Number, region); |
| 113 NumberFunction2 = Type::Function(Number, Number, Number, region); | 112 NumberFunction2 = Type::Function(Number, Number, Number, region); |
| 114 MethodFunction = Type::Function(String, Object, 0, region); | 113 MethodFunction = Type::Function(String, Object, 0, region); |
| 115 | 114 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 176 } |
| 178 | 177 |
| 179 TypeHandle Class(Handle<i::Map> map) { | 178 TypeHandle Class(Handle<i::Map> map) { |
| 180 return Type::Class(map, region_); | 179 return Type::Class(map, region_); |
| 181 } | 180 } |
| 182 | 181 |
| 183 TypeHandle Constant(Handle<i::Object> value) { | 182 TypeHandle Constant(Handle<i::Object> value) { |
| 184 return Type::Constant(value, region_); | 183 return Type::Constant(value, region_); |
| 185 } | 184 } |
| 186 | 185 |
| 187 TypeHandle Range(Handle<i::Object> min, Handle<i::Object> max) { | 186 TypeHandle Range(double min, double max) { |
| 188 return Type::Range(min, max, region_); | 187 return Type::Range(min, max, region_); |
| 189 } | 188 } |
| 190 | 189 |
| 191 TypeHandle Context(TypeHandle outer) { | 190 TypeHandle Context(TypeHandle outer) { |
| 192 return Type::Context(outer, region_); | 191 return Type::Context(outer, region_); |
| 193 } | 192 } |
| 194 | 193 |
| 195 TypeHandle Array1(TypeHandle element) { | 194 TypeHandle Array1(TypeHandle element) { |
| 196 return Type::Array(element, region_); | 195 return Type::Array(element, region_); |
| 197 } | 196 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 int i = rng_->NextInt(static_cast<int>(maps.size())); | 255 int i = rng_->NextInt(static_cast<int>(maps.size())); |
| 257 return Type::Class(maps[i], region_); | 256 return Type::Class(maps[i], region_); |
| 258 } | 257 } |
| 259 case 2: { // constant | 258 case 2: { // constant |
| 260 int i = rng_->NextInt(static_cast<int>(values.size())); | 259 int i = rng_->NextInt(static_cast<int>(values.size())); |
| 261 return Type::Constant(values[i], region_); | 260 return Type::Constant(values[i], region_); |
| 262 } | 261 } |
| 263 case 3: { // range | 262 case 3: { // range |
| 264 int i = rng_->NextInt(static_cast<int>(integers.size())); | 263 int i = rng_->NextInt(static_cast<int>(integers.size())); |
| 265 int j = rng_->NextInt(static_cast<int>(integers.size())); | 264 int j = rng_->NextInt(static_cast<int>(integers.size())); |
| 266 i::Handle<i::Object> min = integers[i]; | 265 double min = integers[i]->Number(); |
| 267 i::Handle<i::Object> max = integers[j]; | 266 double max = integers[j]->Number(); |
| 268 if (min->Number() > max->Number()) std::swap(min, max); | 267 if (min > max) std::swap(min, max); |
| 269 return Type::Range(min, max, region_); | 268 return Type::Range(min, max, region_); |
| 270 } | 269 } |
| 271 case 4: { // context | 270 case 4: { // context |
| 272 int depth = rng_->NextInt(3); | 271 int depth = rng_->NextInt(3); |
| 273 TypeHandle type = Type::Internal(region_); | 272 TypeHandle type = Type::Internal(region_); |
| 274 for (int i = 0; i < depth; ++i) type = Type::Context(type, region_); | 273 for (int i = 0; i < depth; ++i) type = Type::Context(type, region_); |
| 275 return type; | 274 return type; |
| 276 } | 275 } |
| 277 case 5: { // array | 276 case 5: { // array |
| 278 TypeHandle element = Fuzz(depth / 2); | 277 TypeHandle element = Fuzz(depth / 2); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 307 | 306 |
| 308 private: | 307 private: |
| 309 Region* region_; | 308 Region* region_; |
| 310 v8::base::RandomNumberGenerator* rng_; | 309 v8::base::RandomNumberGenerator* rng_; |
| 311 }; | 310 }; |
| 312 | 311 |
| 313 | 312 |
| 314 } } // namespace v8::internal | 313 } } // namespace v8::internal |
| 315 | 314 |
| 316 #endif | 315 #endif |
| OLD | NEW |