| 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
|
|
|