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

Side by Side Diff: runtime/vm/assembler_ia32_test.cc

Issue 10578046: - Inline the store buffer update into a stub instead of (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_ia32.cc ('k') | runtime/vm/isolate.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 (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 } 1830 }
1831 1831
1832 1832
1833 ASSEMBLER_TEST_RUN(TestAlignLarge, entry) { 1833 ASSEMBLER_TEST_RUN(TestAlignLarge, entry) {
1834 typedef int (*TestAlignLarge)(); 1834 typedef int (*TestAlignLarge)();
1835 int res = reinterpret_cast<TestAlignLarge>(entry)(); 1835 int res = reinterpret_cast<TestAlignLarge>(entry)();
1836 EXPECT_EQ(16, res); // 16 bytes emitted. 1836 EXPECT_EQ(16, res); // 16 bytes emitted.
1837 } 1837 }
1838 1838
1839 1839
1840 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
1841 __ pushl(CTX);
1842 __ movl(CTX, Address(ESP, 2 * kWordSize));
1843 __ movl(EAX, Address(ESP, 3 * kWordSize));
1844 __ movl(ECX, Address(ESP, 4 * kWordSize));
1845 __ StoreIntoObject(ECX,
1846 FieldAddress(ECX, GrowableObjectArray::data_offset()),
1847 EAX);
1848 __ popl(CTX);
1849 __ ret();
1850 }
1851
1852
1853 ASSEMBLER_TEST_RUN(StoreIntoObject, entry) {
1854 typedef void (*StoreData)(RawContext* ctx,
1855 RawObject* value,
1856 RawObject* growable_array);
1857 StoreData test_code = reinterpret_cast<StoreData>(entry);
1858
1859 const Array& old_array = Array::Handle(Array::New(3, Heap::kOld));
1860 const Array& new_array = Array::Handle(Array::New(3, Heap::kNew));
1861 const GrowableObjectArray& grow_old_array = GrowableObjectArray::Handle(
1862 GrowableObjectArray::New(old_array, Heap::kOld));
1863 const GrowableObjectArray& grow_new_array = GrowableObjectArray::Handle(
1864 GrowableObjectArray::New(old_array, Heap::kNew));
1865 const Smi& smi = Smi::Handle(Smi::New(7));
1866 const Context& ctx = Context::Handle(Context::New(0));
1867
1868 EXPECT(old_array.raw() == grow_old_array.data());
1869 EXPECT(!Isolate::Current()->store_buffer()->Contains(
1870 reinterpret_cast<uword>(grow_old_array.raw()) +
1871 GrowableObjectArray::data_offset() - kHeapObjectTag));
1872 EXPECT(old_array.raw() == grow_new_array.data());
1873 EXPECT(!Isolate::Current()->store_buffer()->Contains(
1874 reinterpret_cast<uword>(grow_new_array.raw()) +
1875 GrowableObjectArray::data_offset() - kHeapObjectTag));
1876
1877 // Store Smi into the old object.
1878 test_code(ctx.raw(), smi.raw(), grow_old_array.raw());
1879 EXPECT(reinterpret_cast<RawArray*>(smi.raw()) == grow_old_array.data());
1880 EXPECT(!Isolate::Current()->store_buffer()->Contains(
1881 reinterpret_cast<uword>(grow_old_array.raw()) +
1882 GrowableObjectArray::data_offset() - kHeapObjectTag));
1883
1884 // Store an old object into the old object.
1885 test_code(ctx.raw(), old_array.raw(), grow_old_array.raw());
1886 EXPECT(old_array.raw() == grow_old_array.data());
1887 EXPECT(!Isolate::Current()->store_buffer()->Contains(
1888 reinterpret_cast<uword>(grow_old_array.raw()) +
1889 GrowableObjectArray::data_offset() - kHeapObjectTag));
1890
1891 // Store a new object into the old object.
1892 test_code(ctx.raw(), new_array.raw(), grow_old_array.raw());
1893 EXPECT(new_array.raw() == grow_old_array.data());
1894 EXPECT(Isolate::Current()->store_buffer()->Contains(
1895 reinterpret_cast<uword>(grow_old_array.raw()) +
1896 GrowableObjectArray::data_offset() - kHeapObjectTag));
1897
1898 // Store a new object into the new object.
1899 test_code(ctx.raw(), new_array.raw(), grow_new_array.raw());
1900 EXPECT(new_array.raw() == grow_new_array.data());
1901 EXPECT(!Isolate::Current()->store_buffer()->Contains(
1902 reinterpret_cast<uword>(grow_new_array.raw()) +
1903 GrowableObjectArray::data_offset() - kHeapObjectTag));
1904
1905 // Store an old object into the new object.
1906 test_code(ctx.raw(), old_array.raw(), grow_new_array.raw());
1907 EXPECT(old_array.raw() == grow_new_array.data());
1908 EXPECT(!Isolate::Current()->store_buffer()->Contains(
1909 reinterpret_cast<uword>(grow_new_array.raw()) +
1910 GrowableObjectArray::data_offset() - kHeapObjectTag));
1911 }
1912
1913
1840 } // namespace dart 1914 } // namespace dart
1841 1915
1842 #endif // defined TARGET_ARCH_IA32 1916 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_ia32.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698