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