| 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/unit_test.h" | 8 #include "vm/unit_test.h" |
| 9 #include "vm/virtual_memory.h" | 9 #include "vm/virtual_memory.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 const Array& new_array = Array::Handle(Array::New(3, Heap::kNew)); | 24 const Array& new_array = Array::Handle(Array::New(3, Heap::kNew)); |
| 25 const GrowableObjectArray& grow_old_array = GrowableObjectArray::Handle( | 25 const GrowableObjectArray& grow_old_array = GrowableObjectArray::Handle( |
| 26 GrowableObjectArray::New(old_array, Heap::kOld)); | 26 GrowableObjectArray::New(old_array, Heap::kOld)); |
| 27 const GrowableObjectArray& grow_new_array = GrowableObjectArray::Handle( | 27 const GrowableObjectArray& grow_new_array = GrowableObjectArray::Handle( |
| 28 GrowableObjectArray::New(old_array, Heap::kNew)); | 28 GrowableObjectArray::New(old_array, Heap::kNew)); |
| 29 Smi& smi = Smi::Handle(); | 29 Smi& smi = Smi::Handle(); |
| 30 const Context& ctx = Context::Handle(Context::New(0)); | 30 const Context& ctx = Context::Handle(Context::New(0)); |
| 31 | 31 |
| 32 EXPECT(old_array.raw() == grow_old_array.data()); | 32 EXPECT(old_array.raw() == grow_old_array.data()); |
| 33 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( | 33 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( |
| 34 reinterpret_cast<uword>(grow_old_array.raw()) + | 34 reinterpret_cast<uword>(grow_old_array.raw()))); |
| 35 GrowableObjectArray::data_offset() - kHeapObjectTag)); | |
| 36 EXPECT(old_array.raw() == grow_new_array.data()); | 35 EXPECT(old_array.raw() == grow_new_array.data()); |
| 37 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( | 36 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( |
| 38 reinterpret_cast<uword>(grow_new_array.raw()) + | 37 reinterpret_cast<uword>(grow_new_array.raw()))); |
| 39 GrowableObjectArray::data_offset() - kHeapObjectTag)); | |
| 40 | 38 |
| 41 // Store Smis into the old object. | 39 // Store Smis into the old object. |
| 42 for (int i = -128; i < 128; i++) { | 40 for (int i = -128; i < 128; i++) { |
| 43 smi = Smi::New(i); | 41 smi = Smi::New(i); |
| 44 test_code(ctx.raw(), smi.raw(), grow_old_array.raw()); | 42 test_code(ctx.raw(), smi.raw(), grow_old_array.raw()); |
| 45 EXPECT(reinterpret_cast<RawArray*>(smi.raw()) == grow_old_array.data()); | 43 EXPECT(reinterpret_cast<RawArray*>(smi.raw()) == grow_old_array.data()); |
| 46 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( | 44 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( |
| 47 reinterpret_cast<uword>(grow_old_array.raw()) + | 45 reinterpret_cast<uword>(grow_old_array.raw()))); |
| 48 GrowableObjectArray::data_offset() - kHeapObjectTag)); | |
| 49 } | 46 } |
| 50 | 47 |
| 51 // Store an old object into the old object. | 48 // Store an old object into the old object. |
| 52 test_code(ctx.raw(), old_array.raw(), grow_old_array.raw()); | 49 test_code(ctx.raw(), old_array.raw(), grow_old_array.raw()); |
| 53 EXPECT(old_array.raw() == grow_old_array.data()); | 50 EXPECT(old_array.raw() == grow_old_array.data()); |
| 54 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( | 51 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( |
| 55 reinterpret_cast<uword>(grow_old_array.raw()) + | 52 reinterpret_cast<uword>(grow_old_array.raw()))); |
| 56 GrowableObjectArray::data_offset() - kHeapObjectTag)); | |
| 57 | 53 |
| 58 // Store a new object into the old object. | 54 // Store a new object into the old object. |
| 59 test_code(ctx.raw(), new_array.raw(), grow_old_array.raw()); | 55 test_code(ctx.raw(), new_array.raw(), grow_old_array.raw()); |
| 60 EXPECT(new_array.raw() == grow_old_array.data()); | 56 EXPECT(new_array.raw() == grow_old_array.data()); |
| 61 EXPECT(Isolate::Current()->store_buffer_block()->Contains( | 57 EXPECT(Isolate::Current()->store_buffer_block()->Contains( |
| 62 reinterpret_cast<uword>(grow_old_array.raw()) + | 58 reinterpret_cast<uword>(grow_old_array.raw()))); |
| 63 GrowableObjectArray::data_offset() - kHeapObjectTag)); | |
| 64 | 59 |
| 65 // Store a new object into the new object. | 60 // Store a new object into the new object. |
| 66 test_code(ctx.raw(), new_array.raw(), grow_new_array.raw()); | 61 test_code(ctx.raw(), new_array.raw(), grow_new_array.raw()); |
| 67 EXPECT(new_array.raw() == grow_new_array.data()); | 62 EXPECT(new_array.raw() == grow_new_array.data()); |
| 68 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( | 63 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( |
| 69 reinterpret_cast<uword>(grow_new_array.raw()) + | 64 reinterpret_cast<uword>(grow_new_array.raw()))); |
| 70 GrowableObjectArray::data_offset() - kHeapObjectTag)); | |
| 71 | 65 |
| 72 // Store an old object into the new object. | 66 // Store an old object into the new object. |
| 73 test_code(ctx.raw(), old_array.raw(), grow_new_array.raw()); | 67 test_code(ctx.raw(), old_array.raw(), grow_new_array.raw()); |
| 74 EXPECT(old_array.raw() == grow_new_array.data()); | 68 EXPECT(old_array.raw() == grow_new_array.data()); |
| 75 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( | 69 EXPECT(!Isolate::Current()->store_buffer_block()->Contains( |
| 76 reinterpret_cast<uword>(grow_new_array.raw()) + | 70 reinterpret_cast<uword>(grow_new_array.raw()))); |
| 77 GrowableObjectArray::data_offset() - kHeapObjectTag)); | |
| 78 } | 71 } |
| 79 | 72 |
| 80 #endif | 73 #endif |
| 81 | 74 |
| 82 } // namespace dart | 75 } // namespace dart |
| OLD | NEW |