Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "src/hydrogen-types.h" | 7 #include "src/hydrogen-types.h" |
| 8 #include "src/isolate-inl.h" | 8 #include "src/isolate-inl.h" |
| 9 #include "src/types.h" | 9 #include "src/types.h" |
| 10 #include "test/cctest/cctest.h" | 10 #include "test/cctest/cctest.h" |
| 11 | 11 |
| 12 using namespace v8::internal; | 12 using namespace v8::internal; |
| 13 | 13 |
| 14 // Testing auxiliaries (breaking the Type abstraction). | 14 // Testing auxiliaries (breaking the Type abstraction). |
| 15 struct ZoneRep { | 15 struct ZoneRep { |
| 16 typedef void* Struct; | 16 typedef void* Struct; |
| 17 | 17 |
| 18 static bool IsStruct(Type* t, int tag) { | 18 static bool IsStruct(Type* t, int tag) { |
| 19 return !IsBitset(t) && reinterpret_cast<intptr_t>(AsStruct(t)[0]) == tag; | 19 return !IsBitset(t) && reinterpret_cast<intptr_t>(AsStruct(t)[0]) == tag; |
| 20 } | 20 } |
| 21 static bool IsBitset(Type* t) { return reinterpret_cast<intptr_t>(t) & 1; } | 21 static bool IsBitset(Type* t) { return reinterpret_cast<intptr_t>(t) & 1; } |
| 22 static bool IsClass(Type* t) { return IsStruct(t, 0); } | 22 static bool IsClass(Type* t) { return IsStruct(t, 0); } |
| 23 static bool IsConstant(Type* t) { return IsStruct(t, 1); } | 23 static bool IsConstant(Type* t) { return IsStruct(t, 1); } |
| 24 static bool IsContext(Type* t) { return IsStruct(t, 2); } | 24 static bool IsRange(Type* t) { return IsStruct(t, 2); } |
| 25 static bool IsArray(Type* t) { return IsStruct(t, 3); } | 25 static bool IsContext(Type* t) { return IsStruct(t, 3); } |
| 26 static bool IsFunction(Type* t) { return IsStruct(t, 4); } | 26 static bool IsArray(Type* t) { return IsStruct(t, 4); } |
| 27 static bool IsUnion(Type* t) { return IsStruct(t, 5); } | 27 static bool IsFunction(Type* t) { return IsStruct(t, 5); } |
| 28 static bool IsUnion(Type* t) { return IsStruct(t, 6); } | |
| 28 | 29 |
| 29 static Struct* AsStruct(Type* t) { | 30 static Struct* AsStruct(Type* t) { |
| 30 return reinterpret_cast<Struct*>(t); | 31 return reinterpret_cast<Struct*>(t); |
| 31 } | 32 } |
| 32 static int AsBitset(Type* t) { | 33 static int AsBitset(Type* t) { |
| 33 return static_cast<int>(reinterpret_cast<intptr_t>(t) >> 1); | 34 return static_cast<int>(reinterpret_cast<intptr_t>(t) >> 1); |
| 34 } | 35 } |
| 35 static Map* AsClass(Type* t) { | 36 static Map* AsClass(Type* t) { |
| 36 return *static_cast<Map**>(AsStruct(t)[3]); | 37 return *static_cast<Map**>(AsStruct(t)[3]); |
| 37 } | 38 } |
| 38 static Object* AsConstant(Type* t) { | 39 static Object* AsConstant(Type* t) { |
| 39 return *static_cast<Object**>(AsStruct(t)[3]); | 40 return *static_cast<Object**>(AsStruct(t)[3]); |
| 40 } | 41 } |
| 42 static Type* AsRange(Type* t) { | |
| 43 return *static_cast<Type**>(AsStruct(t)[2]); | |
| 44 } | |
|
neis
2014/07/21 17:47:15
This was bogus and I got rid of it.
| |
| 41 static Type* AsContext(Type* t) { | 45 static Type* AsContext(Type* t) { |
| 42 return *static_cast<Type**>(AsStruct(t)[2]); | 46 return *static_cast<Type**>(AsStruct(t)[2]); |
| 43 } | 47 } |
| 44 static Struct* AsUnion(Type* t) { | 48 static Struct* AsUnion(Type* t) { |
| 45 return AsStruct(t); | 49 return AsStruct(t); |
| 46 } | 50 } |
| 47 static int Length(Struct* structured) { | 51 static int Length(Struct* structured) { |
| 48 return static_cast<int>(reinterpret_cast<intptr_t>(structured[1])); | 52 return static_cast<int>(reinterpret_cast<intptr_t>(structured[1])); |
| 49 } | 53 } |
| 50 | 54 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 63 typedef FixedArray Struct; | 67 typedef FixedArray Struct; |
| 64 | 68 |
| 65 static bool IsStruct(Handle<HeapType> t, int tag) { | 69 static bool IsStruct(Handle<HeapType> t, int tag) { |
| 66 return t->IsFixedArray() && Smi::cast(AsStruct(t)->get(0))->value() == tag; | 70 return t->IsFixedArray() && Smi::cast(AsStruct(t)->get(0))->value() == tag; |
| 67 } | 71 } |
| 68 static bool IsBitset(Handle<HeapType> t) { return t->IsSmi(); } | 72 static bool IsBitset(Handle<HeapType> t) { return t->IsSmi(); } |
| 69 static bool IsClass(Handle<HeapType> t) { | 73 static bool IsClass(Handle<HeapType> t) { |
| 70 return t->IsMap() || IsStruct(t, 0); | 74 return t->IsMap() || IsStruct(t, 0); |
| 71 } | 75 } |
| 72 static bool IsConstant(Handle<HeapType> t) { return IsStruct(t, 1); } | 76 static bool IsConstant(Handle<HeapType> t) { return IsStruct(t, 1); } |
| 73 static bool IsContext(Handle<HeapType> t) { return IsStruct(t, 2); } | 77 static bool IsRange(Handle<HeapType> t) { return IsStruct(t, 2); } |
| 74 static bool IsArray(Handle<HeapType> t) { return IsStruct(t, 3); } | 78 static bool IsContext(Handle<HeapType> t) { return IsStruct(t, 3); } |
| 75 static bool IsFunction(Handle<HeapType> t) { return IsStruct(t, 4); } | 79 static bool IsArray(Handle<HeapType> t) { return IsStruct(t, 4); } |
| 76 static bool IsUnion(Handle<HeapType> t) { return IsStruct(t, 5); } | 80 static bool IsFunction(Handle<HeapType> t) { return IsStruct(t, 5); } |
| 81 static bool IsUnion(Handle<HeapType> t) { return IsStruct(t, 6); } | |
| 77 | 82 |
| 78 static Struct* AsStruct(Handle<HeapType> t) { return FixedArray::cast(*t); } | 83 static Struct* AsStruct(Handle<HeapType> t) { return FixedArray::cast(*t); } |
| 79 static int AsBitset(Handle<HeapType> t) { return Smi::cast(*t)->value(); } | 84 static int AsBitset(Handle<HeapType> t) { return Smi::cast(*t)->value(); } |
| 80 static Map* AsClass(Handle<HeapType> t) { | 85 static Map* AsClass(Handle<HeapType> t) { |
| 81 return t->IsMap() ? Map::cast(*t) : Map::cast(AsStruct(t)->get(2)); | 86 return t->IsMap() ? Map::cast(*t) : Map::cast(AsStruct(t)->get(2)); |
| 82 } | 87 } |
| 83 static Object* AsConstant(Handle<HeapType> t) { return AsStruct(t)->get(2); } | 88 static Object* AsConstant(Handle<HeapType> t) { return AsStruct(t)->get(2); } |
| 89 static HeapType* AsRange(Handle<HeapType> t) { | |
| 90 return HeapType::cast(AsStruct(t)->get(1)); | |
| 91 } | |
| 84 static HeapType* AsContext(Handle<HeapType> t) { | 92 static HeapType* AsContext(Handle<HeapType> t) { |
| 85 return HeapType::cast(AsStruct(t)->get(1)); | 93 return HeapType::cast(AsStruct(t)->get(1)); |
| 86 } | 94 } |
| 87 static Struct* AsUnion(Handle<HeapType> t) { return AsStruct(t); } | 95 static Struct* AsUnion(Handle<HeapType> t) { return AsStruct(t); } |
| 88 static int Length(Struct* structured) { return structured->length() - 1; } | 96 static int Length(Struct* structured) { return structured->length() - 1; } |
| 89 | 97 |
| 90 static Isolate* ToRegion(Zone* zone, Isolate* isolate) { return isolate; } | 98 static Isolate* ToRegion(Zone* zone, Isolate* isolate) { return isolate; } |
| 91 | 99 |
| 92 struct BitsetType : HeapType::BitsetType { | 100 struct BitsetType : HeapType::BitsetType { |
| 93 using HeapType::BitsetType::New; | 101 using HeapType::BitsetType::New; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 values.push_back(smi); | 150 values.push_back(smi); |
| 143 values.push_back(signed32); | 151 values.push_back(signed32); |
| 144 values.push_back(object1); | 152 values.push_back(object1); |
| 145 values.push_back(object2); | 153 values.push_back(object2); |
| 146 values.push_back(array); | 154 values.push_back(array); |
| 147 values.push_back(uninitialized); | 155 values.push_back(uninitialized); |
| 148 for (ValueVector::iterator it = values.begin(); it != values.end(); ++it) { | 156 for (ValueVector::iterator it = values.begin(); it != values.end(); ++it) { |
| 149 types.push_back(Type::Constant(*it, region)); | 157 types.push_back(Type::Constant(*it, region)); |
| 150 } | 158 } |
| 151 | 159 |
| 160 doubles.push_back(-0.0); | |
| 161 doubles.push_back(+0.0); | |
| 162 doubles.push_back(-std::numeric_limits<double>::infinity()); | |
| 163 doubles.push_back(+std::numeric_limits<double>::infinity()); | |
| 164 for (int i = 0; i < 40; ++i) { | |
|
rossberg
2014/07/21 15:58:32
I suppose 10 to 20 is enough here, esp given that
neis
2014/07/21 17:47:15
Done.
| |
| 165 doubles.push_back(rng_->NextDouble() * rng_->NextInt()); | |
| 166 } | |
| 167 | |
| 152 NumberArray = Type::Array(Number, region); | 168 NumberArray = Type::Array(Number, region); |
| 153 StringArray = Type::Array(String, region); | 169 StringArray = Type::Array(String, region); |
| 154 AnyArray = Type::Array(Any, region); | 170 AnyArray = Type::Array(Any, region); |
| 155 | 171 |
| 156 SignedFunction1 = Type::Function(SignedSmall, SignedSmall, region); | 172 SignedFunction1 = Type::Function(SignedSmall, SignedSmall, region); |
| 157 NumberFunction1 = Type::Function(Number, Number, region); | 173 NumberFunction1 = Type::Function(Number, Number, region); |
| 158 NumberFunction2 = Type::Function(Number, Number, Number, region); | 174 NumberFunction2 = Type::Function(Number, Number, Number, region); |
| 159 MethodFunction = Type::Function(String, Object, 0, region); | 175 MethodFunction = Type::Function(String, Object, 0, region); |
| 160 | 176 |
| 161 for (int i = 0; i < 40; ++i) { | 177 for (int i = 0; i < 40; ++i) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 TypeHandle AnyArray; | 210 TypeHandle AnyArray; |
| 195 | 211 |
| 196 TypeHandle SignedFunction1; | 212 TypeHandle SignedFunction1; |
| 197 TypeHandle NumberFunction1; | 213 TypeHandle NumberFunction1; |
| 198 TypeHandle NumberFunction2; | 214 TypeHandle NumberFunction2; |
| 199 TypeHandle MethodFunction; | 215 TypeHandle MethodFunction; |
| 200 | 216 |
| 201 typedef std::vector<TypeHandle> TypeVector; | 217 typedef std::vector<TypeHandle> TypeVector; |
| 202 typedef std::vector<Handle<i::Map> > MapVector; | 218 typedef std::vector<Handle<i::Map> > MapVector; |
| 203 typedef std::vector<Handle<i::Object> > ValueVector; | 219 typedef std::vector<Handle<i::Object> > ValueVector; |
| 220 typedef std::vector<double> DoubleVector; | |
| 221 | |
| 204 TypeVector types; | 222 TypeVector types; |
| 205 MapVector maps; | 223 MapVector maps; |
| 206 ValueVector values; | 224 ValueVector values; |
| 225 DoubleVector doubles; | |
| 207 | 226 |
| 208 TypeHandle Of(Handle<i::Object> value) { | 227 TypeHandle Of(Handle<i::Object> value) { |
| 209 return Type::Of(value, region_); | 228 return Type::Of(value, region_); |
| 210 } | 229 } |
| 211 | 230 |
| 212 TypeHandle NowOf(Handle<i::Object> value) { | 231 TypeHandle NowOf(Handle<i::Object> value) { |
| 213 return Type::NowOf(value, region_); | 232 return Type::NowOf(value, region_); |
| 214 } | 233 } |
| 215 | 234 |
| 216 TypeHandle Constant(Handle<i::Object> value) { | 235 TypeHandle Constant(Handle<i::Object> value) { |
| 217 return Type::Constant(value, region_); | 236 return Type::Constant(value, region_); |
| 218 } | 237 } |
| 219 | 238 |
| 239 TypeHandle Range(double min, double max) { | |
| 240 return Type::Range(min, max, region_); | |
| 241 } | |
| 242 | |
| 220 TypeHandle Class(Handle<i::Map> map) { | 243 TypeHandle Class(Handle<i::Map> map) { |
| 221 return Type::Class(map, region_); | 244 return Type::Class(map, region_); |
| 222 } | 245 } |
| 223 | 246 |
| 224 TypeHandle Array1(TypeHandle element) { | 247 TypeHandle Array1(TypeHandle element) { |
| 225 return Type::Array(element, region_); | 248 return Type::Array(element, region_); |
| 226 } | 249 } |
| 227 | 250 |
| 228 TypeHandle Function0(TypeHandle result, TypeHandle receiver) { | 251 TypeHandle Function0(TypeHandle result, TypeHandle receiver) { |
| 229 return Type::Function(result, receiver, 0, region_); | 252 return Type::Function(result, receiver, 0, region_); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 v8::base::RandomNumberGenerator* rng_; | 343 v8::base::RandomNumberGenerator* rng_; |
| 321 }; | 344 }; |
| 322 | 345 |
| 323 | 346 |
| 324 template<class Type, class TypeHandle, class Region, class Rep> | 347 template<class Type, class TypeHandle, class Region, class Rep> |
| 325 struct Tests : Rep { | 348 struct Tests : Rep { |
| 326 typedef Types<Type, TypeHandle, Region> TypesInstance; | 349 typedef Types<Type, TypeHandle, Region> TypesInstance; |
| 327 typedef typename TypesInstance::TypeVector::iterator TypeIterator; | 350 typedef typename TypesInstance::TypeVector::iterator TypeIterator; |
| 328 typedef typename TypesInstance::MapVector::iterator MapIterator; | 351 typedef typename TypesInstance::MapVector::iterator MapIterator; |
| 329 typedef typename TypesInstance::ValueVector::iterator ValueIterator; | 352 typedef typename TypesInstance::ValueVector::iterator ValueIterator; |
| 353 typedef typename TypesInstance::DoubleVector::iterator DoubleIterator; | |
| 330 | 354 |
| 331 Isolate* isolate; | 355 Isolate* isolate; |
| 332 HandleScope scope; | 356 HandleScope scope; |
| 333 Zone zone; | 357 Zone zone; |
| 334 TypesInstance T; | 358 TypesInstance T; |
| 335 | 359 |
| 336 Tests() : | 360 Tests() : |
| 337 isolate(CcTest::i_isolate()), | 361 isolate(CcTest::i_isolate()), |
| 338 scope(isolate), | 362 scope(isolate), |
| 339 zone(isolate), | 363 zone(isolate), |
| 340 T(Rep::ToRegion(&zone, isolate), isolate) { | 364 T(Rep::ToRegion(&zone, isolate), isolate) { |
| 341 } | 365 } |
| 342 | 366 |
| 343 bool Equal(TypeHandle type1, TypeHandle type2) { | 367 bool Equal(TypeHandle type1, TypeHandle type2) { |
| 344 return | 368 return |
| 345 type1->Is(type2) && type2->Is(type1) && | 369 type1->Is(type2) && type2->Is(type1) && |
| 346 Rep::IsBitset(type1) == Rep::IsBitset(type2) && | 370 Rep::IsBitset(type1) == Rep::IsBitset(type2) && |
| 347 Rep::IsClass(type1) == Rep::IsClass(type2) && | 371 Rep::IsClass(type1) == Rep::IsClass(type2) && |
| 348 Rep::IsConstant(type1) == Rep::IsConstant(type2) && | 372 Rep::IsConstant(type1) == Rep::IsConstant(type2) && |
| 373 Rep::IsRange(type1) == Rep::IsRange(type2) && | |
| 349 Rep::IsContext(type1) == Rep::IsContext(type2) && | 374 Rep::IsContext(type1) == Rep::IsContext(type2) && |
| 350 Rep::IsArray(type1) == Rep::IsArray(type2) && | 375 Rep::IsArray(type1) == Rep::IsArray(type2) && |
| 351 Rep::IsFunction(type1) == Rep::IsFunction(type2) && | 376 Rep::IsFunction(type1) == Rep::IsFunction(type2) && |
| 352 Rep::IsUnion(type1) == Rep::IsUnion(type2) && | 377 Rep::IsUnion(type1) == Rep::IsUnion(type2) && |
| 353 type1->NumClasses() == type2->NumClasses() && | 378 type1->NumClasses() == type2->NumClasses() && |
| 354 type1->NumConstants() == type2->NumConstants() && | 379 type1->NumConstants() == type2->NumConstants() && |
| 355 (!Rep::IsBitset(type1) || | 380 (!Rep::IsBitset(type1) || |
| 356 Rep::AsBitset(type1) == Rep::AsBitset(type2)) && | 381 Rep::AsBitset(type1) == Rep::AsBitset(type2)) && |
| 357 (!Rep::IsClass(type1) || | 382 (!Rep::IsClass(type1) || |
| 358 Rep::AsClass(type1) == Rep::AsClass(type2)) && | 383 Rep::AsClass(type1) == Rep::AsClass(type2)) && |
| 359 (!Rep::IsConstant(type1) || | 384 (!Rep::IsConstant(type1) || |
| 360 Rep::AsConstant(type1) == Rep::AsConstant(type2)) && | 385 Rep::AsConstant(type1) == Rep::AsConstant(type2)) && |
| 361 // TODO(rossberg): Check details of arrays, functions, bounds. | 386 // TODO(rossberg): Check details of arrays, functions, bounds. |
| 362 (!Rep::IsUnion(type1) || | 387 (!Rep::IsUnion(type1) || |
| 363 Rep::Length(Rep::AsUnion(type1)) == Rep::Length(Rep::AsUnion(type2))); | 388 Rep::Length(Rep::AsUnion(type1)) == Rep::Length(Rep::AsUnion(type2))); |
| 364 } | 389 } |
| 365 | 390 |
| 366 void CheckEqual(TypeHandle type1, TypeHandle type2) { | 391 void CheckEqual(TypeHandle type1, TypeHandle type2) { |
| 367 CHECK(Equal(type1, type2)); | 392 CHECK(Equal(type1, type2)); |
| 368 } | 393 } |
| 369 | 394 |
| 370 void CheckSub(TypeHandle type1, TypeHandle type2) { | 395 void CheckSub(TypeHandle type1, TypeHandle type2) { |
| 371 CHECK(type1->Is(type2)); | 396 CHECK(type1->Is(type2)); |
| 372 CHECK(!type2->Is(type1)); | 397 CHECK(!type2->Is(type1)); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 CHECK(T.Constant(fac->NewNumber(-0x7fffffff-2.0))->Is(T.OtherNumber)); | 584 CHECK(T.Constant(fac->NewNumber(-0x7fffffff-2.0))->Is(T.OtherNumber)); |
| 560 CHECK(T.Constant(fac->NewNumber(0.1))->Is(T.OtherNumber)); | 585 CHECK(T.Constant(fac->NewNumber(0.1))->Is(T.OtherNumber)); |
| 561 CHECK(T.Constant(fac->NewNumber(-10.1))->Is(T.OtherNumber)); | 586 CHECK(T.Constant(fac->NewNumber(-10.1))->Is(T.OtherNumber)); |
| 562 CHECK(T.Constant(fac->NewNumber(10e60))->Is(T.OtherNumber)); | 587 CHECK(T.Constant(fac->NewNumber(10e60))->Is(T.OtherNumber)); |
| 563 CHECK(T.Constant(fac->NewNumber(-1.0*0.0))->Is(T.MinusZero)); | 588 CHECK(T.Constant(fac->NewNumber(-1.0*0.0))->Is(T.MinusZero)); |
| 564 CHECK(T.Constant(fac->NewNumber(v8::base::OS::nan_value()))->Is(T.NaN)); | 589 CHECK(T.Constant(fac->NewNumber(v8::base::OS::nan_value()))->Is(T.NaN)); |
| 565 CHECK(T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.OtherNumber)); | 590 CHECK(T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.OtherNumber)); |
| 566 CHECK(T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.OtherNumber)); | 591 CHECK(T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.OtherNumber)); |
| 567 } | 592 } |
| 568 | 593 |
| 594 void Range() { | |
| 595 // Constructor | |
| 596 for (DoubleIterator i = T.doubles.begin(); i != T.doubles.end(); ++i) { | |
| 597 for (DoubleIterator j = T.doubles.begin(); j != T.doubles.end(); ++j) { | |
| 598 double min = *i <= *j ? *i : *j; | |
|
rossberg
2014/07/21 15:58:32
You can use the C++ min & max functions for these.
neis
2014/07/21 17:47:15
Done.
| |
| 599 double max = *i <= *j ? *j : *i; | |
| 600 TypeHandle type = T.Range(min, max); | |
| 601 CHECK(this->IsRange(type)); | |
| 602 } | |
| 603 } | |
| 604 | |
| 605 // Range attributes | |
| 606 for (DoubleIterator i = T.doubles.begin(); i != T.doubles.end(); ++i) { | |
| 607 for (DoubleIterator j = T.doubles.begin(); j != T.doubles.end(); ++j) { | |
| 608 double min = *i <= *j ? *i : *j; | |
| 609 double max = *i <= *j ? *j : *i; | |
| 610 TypeHandle type = T.Range(min, max); | |
| 611 CHECK(min == type->AsRange()->Min()); | |
| 612 CHECK(max == type->AsRange()->Max()); | |
| 613 } | |
| 614 } | |
| 615 | |
| 616 // Injectivity: Range(min1, max1) = Range(min2, max2) => | |
|
rossberg
2014/07/21 15:58:32
I think that Functionality should hold as well.
neis
2014/07/21 17:47:15
Right. Actually, the changes to Equal were incomp
rossberg
2014/07/22 07:58:35
Might be worth including the test anyway for clari
neis
2014/07/22 08:34:46
Done.
| |
| 617 // min1 = min2 /\ max1 = max2 | |
| 618 typedef DoubleIterator DI; | |
| 619 for (DI i1 = T.doubles.begin(); i1 != T.doubles.end(); ++i1) { | |
| 620 for (DI j1 = T.doubles.begin(); j1 != T.doubles.end(); ++j1) { | |
| 621 for (DI i2 = T.doubles.begin(); i2 != T.doubles.end(); ++i2) { | |
| 622 for (DI j2 = T.doubles.begin(); j2 != T.doubles.end(); ++j2) { | |
| 623 double min1 = *i1 <= *j1 ? *i1 : *j1; | |
| 624 double max1 = *i1 <= *j1 ? *j1 : *i1; | |
| 625 double min2 = *i2 <= *j2 ? *i2 : *j2; | |
| 626 double max2 = *i2 <= *j2 ? *j2 : *i2; | |
| 627 TypeHandle type1 = T.Range(min1, max1); | |
| 628 TypeHandle type2 = T.Range(min2, max2); | |
| 629 CHECK(!Equal(type1, type2) || (min1 == min2 && max1 == max2)); | |
| 630 } | |
| 631 } | |
| 632 } | |
| 633 } | |
| 634 } | |
| 635 | |
| 569 void Array() { | 636 void Array() { |
| 570 // Constructor | 637 // Constructor |
| 571 for (int i = 0; i < 20; ++i) { | 638 for (int i = 0; i < 20; ++i) { |
| 572 TypeHandle type = T.Random(); | 639 TypeHandle type = T.Random(); |
| 573 TypeHandle array = T.Array1(type); | 640 TypeHandle array = T.Array1(type); |
| 574 CHECK(this->IsArray(array)); | 641 CHECK(this->IsArray(array)); |
| 575 } | 642 } |
| 576 | 643 |
| 577 // Attributes | 644 // Attributes |
| 578 for (int i = 0; i < 20; ++i) { | 645 for (int i = 0; i < 20; ++i) { |
| (...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1787 } | 1854 } |
| 1788 | 1855 |
| 1789 | 1856 |
| 1790 TEST(ConstantType) { | 1857 TEST(ConstantType) { |
| 1791 CcTest::InitializeVM(); | 1858 CcTest::InitializeVM(); |
| 1792 ZoneTests().Constant(); | 1859 ZoneTests().Constant(); |
| 1793 HeapTests().Constant(); | 1860 HeapTests().Constant(); |
| 1794 } | 1861 } |
| 1795 | 1862 |
| 1796 | 1863 |
| 1864 TEST(RangeType) { | |
| 1865 CcTest::InitializeVM(); | |
| 1866 ZoneTests().Range(); | |
| 1867 HeapTests().Range(); | |
| 1868 } | |
| 1869 | |
| 1870 | |
| 1797 TEST(ArrayType) { | 1871 TEST(ArrayType) { |
| 1798 CcTest::InitializeVM(); | 1872 CcTest::InitializeVM(); |
| 1799 ZoneTests().Array(); | 1873 ZoneTests().Array(); |
| 1800 HeapTests().Array(); | 1874 HeapTests().Array(); |
| 1801 } | 1875 } |
| 1802 | 1876 |
| 1803 | 1877 |
| 1804 TEST(FunctionType) { | 1878 TEST(FunctionType) { |
| 1805 CcTest::InitializeVM(); | 1879 CcTest::InitializeVM(); |
| 1806 ZoneTests().Function(); | 1880 ZoneTests().Function(); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1911 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); | 1985 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); |
| 1912 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); | 1986 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); |
| 1913 } | 1987 } |
| 1914 | 1988 |
| 1915 | 1989 |
| 1916 TEST(HTypeFromType) { | 1990 TEST(HTypeFromType) { |
| 1917 CcTest::InitializeVM(); | 1991 CcTest::InitializeVM(); |
| 1918 ZoneTests().HTypeFromType(); | 1992 ZoneTests().HTypeFromType(); |
| 1919 HeapTests().HTypeFromType(); | 1993 HeapTests().HTypeFromType(); |
| 1920 } | 1994 } |
| OLD | NEW |