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

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_array = GrowableObjectArray::Handle(
1862 GrowableObjectArray::New(old_array, Heap::kOld));
1863 const Smi& smi = Smi::Handle(Smi::New(7));
1864 const Context& ctx = Context::Handle(Context::New(0));
1865
1866 EXPECT(old_array.raw() == grow_array.data());
1867 EXPECT(!Isolate::Current()->store_buffer()->Contains(
1868 reinterpret_cast<uword>(grow_array.raw()) +
1869 GrowableObjectArray::data_offset() - kHeapObjectTag));
1870
1871 // Store Smi into the old object.
1872 test_code(ctx.raw(), smi.raw(), grow_array.raw());
1873 EXPECT(reinterpret_cast<RawArray*>(smi.raw()) == grow_array.data());
1874 EXPECT(!Isolate::Current()->store_buffer()->Contains(
1875 reinterpret_cast<uword>(grow_array.raw()) +
1876 GrowableObjectArray::data_offset() - kHeapObjectTag));
1877
1878 // Store an old object into the old object.
1879 test_code(ctx.raw(), old_array.raw(), grow_array.raw());
1880 EXPECT(old_array.raw() == grow_array.data());
1881 EXPECT(!Isolate::Current()->store_buffer()->Contains(
1882 reinterpret_cast<uword>(grow_array.raw()) +
1883 GrowableObjectArray::data_offset() - kHeapObjectTag));
1884
1885 // Store a new object into the old object.
1886 test_code(ctx.raw(), new_array.raw(), grow_array.raw());
1887 EXPECT(new_array.raw() == grow_array.data());
1888 EXPECT(Isolate::Current()->store_buffer()->Contains(
1889 reinterpret_cast<uword>(grow_array.raw()) +
1890 GrowableObjectArray::data_offset() - kHeapObjectTag));
siva 2012/06/20 17:57:28 Should we also have a test for: // Store a new obj
Ivan Posva 2012/06/20 18:05:37 Done.
1891 }
1892
1893
1840 } // namespace dart 1894 } // namespace dart
1841 1895
1842 #endif // defined TARGET_ARCH_IA32 1896 #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