OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/assembler.h" | 5 #include "vm/assembler.h" |
6 #include "vm/globals.h" | 6 #include "vm/globals.h" |
7 #include "vm/os.h" | 7 #include "vm/os.h" |
| 8 #include "vm/simulator.h" |
8 #include "vm/unit_test.h" | 9 #include "vm/unit_test.h" |
9 #include "vm/virtual_memory.h" | 10 #include "vm/virtual_memory.h" |
10 | 11 |
11 namespace dart { | 12 namespace dart { |
12 | 13 |
13 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 14 #if defined(TARGET_ARCH_IA32) || \ |
| 15 defined(TARGET_ARCH_X64) || \ |
| 16 defined(TARGET_ARCH_ARM) |
14 | 17 |
15 ASSEMBLER_TEST_EXTERN(StoreIntoObject); | 18 ASSEMBLER_TEST_EXTERN(StoreIntoObject); |
16 | 19 |
17 ASSEMBLER_TEST_RUN(StoreIntoObject, test) { | 20 ASSEMBLER_TEST_RUN(StoreIntoObject, test) { |
| 21 #if defined(USING_SIMULATOR) |
| 22 #define test_code(ctx, value, growable_array) \ |
| 23 Simulator::Current()->Call( \ |
| 24 bit_cast<int32_t, uword>(test->entry()), \ |
| 25 reinterpret_cast<int32_t>(ctx), \ |
| 26 reinterpret_cast<int32_t>(value), \ |
| 27 reinterpret_cast<int32_t>(growable_array), \ |
| 28 0) |
| 29 #else |
18 typedef void (*StoreData)(RawContext* ctx, | 30 typedef void (*StoreData)(RawContext* ctx, |
19 RawObject* value, | 31 RawObject* value, |
20 RawObject* growable_array); | 32 RawObject* growable_array); |
21 StoreData test_code = reinterpret_cast<StoreData>(test->entry()); | 33 StoreData test_code = reinterpret_cast<StoreData>(test->entry()); |
| 34 #endif |
22 | 35 |
23 const Array& old_array = Array::Handle(Array::New(3, Heap::kOld)); | 36 const Array& old_array = Array::Handle(Array::New(3, Heap::kOld)); |
24 const Array& new_array = Array::Handle(Array::New(3, Heap::kNew)); | 37 const Array& new_array = Array::Handle(Array::New(3, Heap::kNew)); |
25 const GrowableObjectArray& grow_old_array = GrowableObjectArray::Handle( | 38 const GrowableObjectArray& grow_old_array = GrowableObjectArray::Handle( |
26 GrowableObjectArray::New(old_array, Heap::kOld)); | 39 GrowableObjectArray::New(old_array, Heap::kOld)); |
27 const GrowableObjectArray& grow_new_array = GrowableObjectArray::Handle( | 40 const GrowableObjectArray& grow_new_array = GrowableObjectArray::Handle( |
28 GrowableObjectArray::New(old_array, Heap::kNew)); | 41 GrowableObjectArray::New(old_array, Heap::kNew)); |
29 Smi& smi = Smi::Handle(); | 42 Smi& smi = Smi::Handle(); |
30 const Context& ctx = Context::Handle(Context::New(0)); | 43 const Context& ctx = Context::Handle(Context::New(0)); |
31 | 44 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( | 76 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( |
64 reinterpret_cast<uword>(grow_new_array.raw()))); | 77 reinterpret_cast<uword>(grow_new_array.raw()))); |
65 | 78 |
66 // Store an old object into the new object. | 79 // Store an old object into the new object. |
67 test_code(ctx.raw(), old_array.raw(), grow_new_array.raw()); | 80 test_code(ctx.raw(), old_array.raw(), grow_new_array.raw()); |
68 EXPECT(old_array.raw() == grow_new_array.data()); | 81 EXPECT(old_array.raw() == grow_new_array.data()); |
69 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( | 82 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( |
70 reinterpret_cast<uword>(grow_new_array.raw()))); | 83 reinterpret_cast<uword>(grow_new_array.raw()))); |
71 } | 84 } |
72 | 85 |
73 #endif | 86 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 || TARGET_ARCH_ARM |
74 | 87 |
75 } // namespace dart | 88 } // namespace dart |
OLD | NEW |