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/test-types.cc

Issue 1217803004: Add a type for objects with typed properties. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 years, 5 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 | « src/types-inl.h ('k') | test/cctest/types-fuzz.h » ('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 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/types.h" 8 #include "src/types.h"
9 #include "test/cctest/cctest.h" 9 #include "test/cctest/cctest.h"
10 #include "test/cctest/types-fuzz.h" 10 #include "test/cctest/types-fuzz.h"
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 CHECK(Equal(function01, function02) == Equal(type2, type3)); 582 CHECK(Equal(function01, function02) == Equal(type2, type3));
583 CHECK(Equal(function01, function03) == Equal(type1, type3)); 583 CHECK(Equal(function01, function03) == Equal(type1, type3));
584 CHECK(Equal(function11, function12) == Equal(type2, type3)); 584 CHECK(Equal(function11, function12) == Equal(type2, type3));
585 CHECK(Equal(function21, function22) == Equal(type2, type3)); 585 CHECK(Equal(function21, function22) == Equal(type2, type3));
586 CHECK(Equal(function21, function23) == Equal(type2, type3)); 586 CHECK(Equal(function21, function23) == Equal(type2, type3));
587 } 587 }
588 } 588 }
589 } 589 }
590 } 590 }
591 591
592 void Object() {
593 // Constructor, InitProperty, and Property.
594 for (int i = 0; i < 20; ++i) {
595 for (int j = 0; j < 20; ++j) {
596 TypeHandle object0 = T.ExplicitObject(20);
597 TypeHandle object1 = T.ExplicitObject(20);
598 TypeHandle types[20];
599 for (int k = 0; k < 20; ++k) {
600 types[k] = T.Random();
601 }
602 for (int k = 0; k < 20; ++k) {
603 ScopedVector<char> name(20);
604 SNPrintF(name, "foo%d", k);
605 Handle<i::String> sname =
606 isolate->factory()->InternalizeUtf8String(name.start());
607 object0->AsObject()->InitProperty(k, sname, types[k]);
608 object1->AsObject()->InitProperty(k, sname, types[19 - k]);
609 }
610 for (int k = 0; k < 20; ++k) {
611 ScopedVector<char> name(20);
612 SNPrintF(name, "foo%d", k);
613 Handle<i::String> sname =
614 isolate->factory()->InternalizeUtf8String(name.start());
615 CheckEqual(types[k], object0->AsObject()->Property(sname));
616 CheckEqual(types[19 - k], object1->AsObject()->Property(sname));
617 }
618 CHECK(object0->IsObject());
619 CHECK(object1->IsObject());
620 Handle<i::String> bar =
621 isolate->factory()->InternalizeUtf8String("bar");
622 CheckEqual(T.ExplicitAny(), object0->AsObject()->Property(bar));
623 CheckEqual(T.ExplicitAny(), object1->AsObject()->Property(bar));
624 }
625 }
626 }
627
592 void Of() { 628 void Of() {
593 // Constant(V)->Is(Of(V)) 629 // Constant(V)->Is(Of(V))
594 for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { 630 for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) {
595 Handle<i::Object> value = *vt; 631 Handle<i::Object> value = *vt;
596 TypeHandle const_type = T.Constant(value); 632 TypeHandle const_type = T.Constant(value);
597 TypeHandle of_type = T.Of(value); 633 TypeHandle of_type = T.Of(value);
598 CHECK(const_type->Is(of_type)); 634 CHECK(const_type->Is(of_type));
599 } 635 }
600 636
601 // If Of(V)->Is(T), then Constant(V)->Is(T) 637 // If Of(V)->Is(T), then Constant(V)->Is(T)
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 2042
2007 TEST(ArrayType_heap) { HeapTests().Array(); } 2043 TEST(ArrayType_heap) { HeapTests().Array(); }
2008 2044
2009 2045
2010 TEST(FunctionType_zone) { ZoneTests().Function(); } 2046 TEST(FunctionType_zone) { ZoneTests().Function(); }
2011 2047
2012 2048
2013 TEST(FunctionType_heap) { HeapTests().Function(); } 2049 TEST(FunctionType_heap) { HeapTests().Function(); }
2014 2050
2015 2051
2052 TEST(ObjectType_zone) { ZoneTests().Object(); }
2053
2054
2055 TEST(ObjectType_heap) { HeapTests().Object(); }
2056
2057
2016 TEST(Of_zone) { ZoneTests().Of(); } 2058 TEST(Of_zone) { ZoneTests().Of(); }
2017 2059
2018 2060
2019 TEST(Of_heap) { HeapTests().Of(); } 2061 TEST(Of_heap) { HeapTests().Of(); }
2020 2062
2021 2063
2022 TEST(NowOf_zone) { ZoneTests().NowOf(); } 2064 TEST(NowOf_zone) { ZoneTests().NowOf(); }
2023 2065
2024 2066
2025 TEST(NowOf_heap) { HeapTests().NowOf(); } 2067 TEST(NowOf_heap) { HeapTests().NowOf(); }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 } 2168 }
2127 2169
2128 2170
2129 TEST(Convert_heap) { HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); } 2171 TEST(Convert_heap) { HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); }
2130 2172
2131 2173
2132 TEST(HTypeFromType_zone) { ZoneTests().HTypeFromType(); } 2174 TEST(HTypeFromType_zone) { ZoneTests().HTypeFromType(); }
2133 2175
2134 2176
2135 TEST(HTypeFromType_heap) { HeapTests().HTypeFromType(); } 2177 TEST(HTypeFromType_heap) { HeapTests().HTypeFromType(); }
OLDNEW
« no previous file with comments | « src/types-inl.h ('k') | test/cctest/types-fuzz.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698