| Index: runtime/vm/assembler_ia32_test.cc
|
| ===================================================================
|
| --- runtime/vm/assembler_ia32_test.cc (revision 8921)
|
| +++ runtime/vm/assembler_ia32_test.cc (working copy)
|
| @@ -1837,6 +1837,80 @@
|
| }
|
|
|
|
|
| +ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
|
| + __ pushl(CTX);
|
| + __ movl(CTX, Address(ESP, 2 * kWordSize));
|
| + __ movl(EAX, Address(ESP, 3 * kWordSize));
|
| + __ movl(ECX, Address(ESP, 4 * kWordSize));
|
| + __ StoreIntoObject(ECX,
|
| + FieldAddress(ECX, GrowableObjectArray::data_offset()),
|
| + EAX);
|
| + __ popl(CTX);
|
| + __ ret();
|
| +}
|
| +
|
| +
|
| +ASSEMBLER_TEST_RUN(StoreIntoObject, entry) {
|
| + typedef void (*StoreData)(RawContext* ctx,
|
| + RawObject* value,
|
| + RawObject* growable_array);
|
| + StoreData test_code = reinterpret_cast<StoreData>(entry);
|
| +
|
| + const Array& old_array = Array::Handle(Array::New(3, Heap::kOld));
|
| + const Array& new_array = Array::Handle(Array::New(3, Heap::kNew));
|
| + const GrowableObjectArray& grow_old_array = GrowableObjectArray::Handle(
|
| + GrowableObjectArray::New(old_array, Heap::kOld));
|
| + const GrowableObjectArray& grow_new_array = GrowableObjectArray::Handle(
|
| + GrowableObjectArray::New(old_array, Heap::kNew));
|
| + const Smi& smi = Smi::Handle(Smi::New(7));
|
| + const Context& ctx = Context::Handle(Context::New(0));
|
| +
|
| + EXPECT(old_array.raw() == grow_old_array.data());
|
| + EXPECT(!Isolate::Current()->store_buffer()->Contains(
|
| + reinterpret_cast<uword>(grow_old_array.raw()) +
|
| + GrowableObjectArray::data_offset() - kHeapObjectTag));
|
| + EXPECT(old_array.raw() == grow_new_array.data());
|
| + EXPECT(!Isolate::Current()->store_buffer()->Contains(
|
| + reinterpret_cast<uword>(grow_new_array.raw()) +
|
| + GrowableObjectArray::data_offset() - kHeapObjectTag));
|
| +
|
| + // Store Smi into the old object.
|
| + test_code(ctx.raw(), smi.raw(), grow_old_array.raw());
|
| + EXPECT(reinterpret_cast<RawArray*>(smi.raw()) == grow_old_array.data());
|
| + EXPECT(!Isolate::Current()->store_buffer()->Contains(
|
| + reinterpret_cast<uword>(grow_old_array.raw()) +
|
| + GrowableObjectArray::data_offset() - kHeapObjectTag));
|
| +
|
| + // Store an old object into the old object.
|
| + test_code(ctx.raw(), old_array.raw(), grow_old_array.raw());
|
| + EXPECT(old_array.raw() == grow_old_array.data());
|
| + EXPECT(!Isolate::Current()->store_buffer()->Contains(
|
| + reinterpret_cast<uword>(grow_old_array.raw()) +
|
| + GrowableObjectArray::data_offset() - kHeapObjectTag));
|
| +
|
| + // Store a new object into the old object.
|
| + test_code(ctx.raw(), new_array.raw(), grow_old_array.raw());
|
| + EXPECT(new_array.raw() == grow_old_array.data());
|
| + EXPECT(Isolate::Current()->store_buffer()->Contains(
|
| + reinterpret_cast<uword>(grow_old_array.raw()) +
|
| + GrowableObjectArray::data_offset() - kHeapObjectTag));
|
| +
|
| + // Store a new object into the new object.
|
| + test_code(ctx.raw(), new_array.raw(), grow_new_array.raw());
|
| + EXPECT(new_array.raw() == grow_new_array.data());
|
| + EXPECT(!Isolate::Current()->store_buffer()->Contains(
|
| + reinterpret_cast<uword>(grow_new_array.raw()) +
|
| + GrowableObjectArray::data_offset() - kHeapObjectTag));
|
| +
|
| + // Store an old object into the new object.
|
| + test_code(ctx.raw(), old_array.raw(), grow_new_array.raw());
|
| + EXPECT(old_array.raw() == grow_new_array.data());
|
| + EXPECT(!Isolate::Current()->store_buffer()->Contains(
|
| + reinterpret_cast<uword>(grow_new_array.raw()) +
|
| + GrowableObjectArray::data_offset() - kHeapObjectTag));
|
| +}
|
| +
|
| +
|
| } // namespace dart
|
|
|
| #endif // defined TARGET_ARCH_IA32
|
|
|