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

Unified 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, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/types-inl.h ('k') | test/cctest/types-fuzz.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-types.cc
diff --git a/test/cctest/test-types.cc b/test/cctest/test-types.cc
index fe07093077bd22cf306755857cc0d7143fd40b6b..7e07bdf43878557c14d1cabda545a22bcb95333c 100644
--- a/test/cctest/test-types.cc
+++ b/test/cctest/test-types.cc
@@ -589,6 +589,42 @@ struct Tests : Rep {
}
}
+ void Object() {
+ // Constructor, InitProperty, and Property.
+ for (int i = 0; i < 20; ++i) {
+ for (int j = 0; j < 20; ++j) {
+ TypeHandle object0 = T.ExplicitObject(20);
+ TypeHandle object1 = T.ExplicitObject(20);
+ TypeHandle types[20];
+ for (int k = 0; k < 20; ++k) {
+ types[k] = T.Random();
+ }
+ for (int k = 0; k < 20; ++k) {
+ ScopedVector<char> name(20);
+ SNPrintF(name, "foo%d", k);
+ Handle<i::String> sname =
+ isolate->factory()->InternalizeUtf8String(name.start());
+ object0->AsObject()->InitProperty(k, sname, types[k]);
+ object1->AsObject()->InitProperty(k, sname, types[19 - k]);
+ }
+ for (int k = 0; k < 20; ++k) {
+ ScopedVector<char> name(20);
+ SNPrintF(name, "foo%d", k);
+ Handle<i::String> sname =
+ isolate->factory()->InternalizeUtf8String(name.start());
+ CheckEqual(types[k], object0->AsObject()->Property(sname));
+ CheckEqual(types[19 - k], object1->AsObject()->Property(sname));
+ }
+ CHECK(object0->IsObject());
+ CHECK(object1->IsObject());
+ Handle<i::String> bar =
+ isolate->factory()->InternalizeUtf8String("bar");
+ CheckEqual(T.ExplicitAny(), object0->AsObject()->Property(bar));
+ CheckEqual(T.ExplicitAny(), object1->AsObject()->Property(bar));
+ }
+ }
+ }
+
void Of() {
// Constant(V)->Is(Of(V))
for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) {
@@ -2013,6 +2049,12 @@ TEST(FunctionType_zone) { ZoneTests().Function(); }
TEST(FunctionType_heap) { HeapTests().Function(); }
+TEST(ObjectType_zone) { ZoneTests().Object(); }
+
+
+TEST(ObjectType_heap) { HeapTests().Object(); }
+
+
TEST(Of_zone) { ZoneTests().Of(); }
« 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