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