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

Unified Diff: test/unittests/interpreter/constant-array-builder-unittest.cc

Issue 2167763003: [Interpreter] Avoid allocating pairs array in VisitDeclarations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_merge_binary
Patch Set: Rebase Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/constant-array-builder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/interpreter/constant-array-builder-unittest.cc
diff --git a/test/unittests/interpreter/constant-array-builder-unittest.cc b/test/unittests/interpreter/constant-array-builder-unittest.cc
index c48ac58738c18d8a1f4eb4bbdc1e1a82678c50fb..8bee2452da2466d60b1b838f3eaf1782353f0f33 100644
--- a/test/unittests/interpreter/constant-array-builder-unittest.cc
+++ b/test/unittests/interpreter/constant-array-builder-unittest.cc
@@ -283,6 +283,40 @@ TEST_F(ConstantArrayBuilderTest, ReservationsAtAllScales) {
}
}
+TEST_F(ConstantArrayBuilderTest, AllocateEntriesWithFixedReservations) {
+ ConstantArrayBuilder builder(isolate(), zone());
+ for (size_t i = 0; i < k16BitCapacity; i++) {
+ if ((i % 2) == 0) {
+ CHECK_EQ(i, builder.AllocateEntry());
+ } else {
+ builder.Insert(handle(Smi::FromInt(static_cast<int>(i)), isolate()));
+ }
+ }
+ CHECK_EQ(builder.size(), k16BitCapacity);
+
+ // Check values before reserved entries are inserted.
+ for (size_t i = 0; i < k16BitCapacity; i++) {
+ if ((i % 2) == 0) {
+ // Check reserved values are the hole.
+ Handle<Object> empty = builder.At(i);
+ CHECK(empty->SameValue(isolate()->heap()->the_hole_value()));
+ } else {
+ CHECK_EQ(Handle<Smi>::cast(builder.At(i))->value(), i);
+ }
+ }
+
+ // Insert reserved entries.
+ for (size_t i = 0; i < k16BitCapacity; i += 2) {
+ builder.InsertAllocatedEntry(
+ i, handle(Smi::FromInt(static_cast<int>(i)), isolate()));
+ }
+
+ // Check values after reserved entries are inserted.
+ for (size_t i = 0; i < k16BitCapacity; i++) {
+ CHECK_EQ(Handle<Smi>::cast(builder.At(i))->value(), i);
+ }
+}
+
} // namespace interpreter
} // namespace internal
} // namespace v8
« no previous file with comments | « src/interpreter/constant-array-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698