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/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 | 22 |
23 Assembler::Assembler(bool use_far_branches) | 23 Assembler::Assembler(bool use_far_branches) |
24 : buffer_(), | 24 : buffer_(), |
25 object_pool_(GrowableObjectArray::Handle()), | 25 object_pool_(GrowableObjectArray::Handle()), |
26 patchable_pool_entries_(), | 26 patchable_pool_entries_(), |
27 prologue_offset_(-1), | 27 prologue_offset_(-1), |
28 comments_() { | 28 comments_() { |
29 // Far branching mode is only needed and implemented for MIPS and ARM. | 29 // Far branching mode is only needed and implemented for MIPS and ARM. |
30 ASSERT(!use_far_branches); | 30 ASSERT(!use_far_branches); |
31 if (Isolate::Current() != Dart::vm_isolate()) { | 31 Isolate* isolate = Isolate::Current(); |
| 32 if (isolate != Dart::vm_isolate()) { |
32 object_pool_ = GrowableObjectArray::New(Heap::kOld); | 33 object_pool_ = GrowableObjectArray::New(Heap::kOld); |
33 | 34 |
34 // These objects and labels need to be accessible through every pool-pointer | 35 // These objects and labels need to be accessible through every pool-pointer |
35 // at the same index. | 36 // at the same index. |
36 object_pool_.Add(Object::null_object(), Heap::kOld); | 37 object_pool_.Add(Object::null_object(), Heap::kOld); |
37 patchable_pool_entries_.Add(kNotPatchable); | 38 patchable_pool_entries_.Add(kNotPatchable); |
38 // Not adding Object::null() to the index table. It is at index 0 in the | 39 // Not adding Object::null() to the index table. It is at index 0 in the |
39 // object pool, but the HashMap uses 0 to indicate not found. | 40 // object pool, but the HashMap uses 0 to indicate not found. |
40 | 41 |
41 object_pool_.Add(Bool::True(), Heap::kOld); | 42 object_pool_.Add(Bool::True(), Heap::kOld); |
42 patchable_pool_entries_.Add(kNotPatchable); | 43 patchable_pool_entries_.Add(kNotPatchable); |
43 object_pool_index_table_.Insert(ObjIndexPair(Bool::True().raw(), 1)); | 44 object_pool_index_table_.Insert(ObjIndexPair(Bool::True().raw(), 1)); |
44 | 45 |
45 object_pool_.Add(Bool::False(), Heap::kOld); | 46 object_pool_.Add(Bool::False(), Heap::kOld); |
46 patchable_pool_entries_.Add(kNotPatchable); | 47 patchable_pool_entries_.Add(kNotPatchable); |
47 object_pool_index_table_.Insert(ObjIndexPair(Bool::False().raw(), 2)); | 48 object_pool_index_table_.Insert(ObjIndexPair(Bool::False().raw(), 2)); |
48 | 49 |
49 const Smi& vacant = Smi::Handle(Smi::New(0xfa >> kSmiTagShift)); | 50 const Smi& vacant = Smi::Handle(Smi::New(0xfa >> kSmiTagShift)); |
50 | 51 |
51 if (StubCode::UpdateStoreBuffer_entry() != NULL) { | 52 StubCode* stub_code = isolate->stub_code(); |
52 FindExternalLabel(&StubCode::UpdateStoreBufferLabel(), kNotPatchable); | 53 if (stub_code->UpdateStoreBuffer_entry() != NULL) { |
| 54 FindExternalLabel(&stub_code->UpdateStoreBufferLabel(), kNotPatchable); |
53 } else { | 55 } else { |
54 object_pool_.Add(vacant, Heap::kOld); | 56 object_pool_.Add(vacant, Heap::kOld); |
55 patchable_pool_entries_.Add(kNotPatchable); | 57 patchable_pool_entries_.Add(kNotPatchable); |
56 } | 58 } |
57 | 59 |
58 if (StubCode::CallToRuntime_entry() != NULL) { | 60 if (StubCode::CallToRuntime_entry() != NULL) { |
59 FindExternalLabel(&StubCode::CallToRuntimeLabel(), kNotPatchable); | 61 FindExternalLabel(&StubCode::CallToRuntimeLabel(), kNotPatchable); |
60 } else { | 62 } else { |
61 object_pool_.Add(vacant, Heap::kOld); | 63 object_pool_.Add(vacant, Heap::kOld); |
62 patchable_pool_entries_.Add(kNotPatchable); | 64 patchable_pool_entries_.Add(kNotPatchable); |
(...skipping 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2700 if (can_value_be_smi) { | 2702 if (can_value_be_smi) { |
2701 StoreIntoObjectFilter(object, value, &done); | 2703 StoreIntoObjectFilter(object, value, &done); |
2702 } else { | 2704 } else { |
2703 StoreIntoObjectFilterNoSmi(object, value, &done); | 2705 StoreIntoObjectFilterNoSmi(object, value, &done); |
2704 } | 2706 } |
2705 // A store buffer update is required. | 2707 // A store buffer update is required. |
2706 if (value != RAX) pushq(RAX); | 2708 if (value != RAX) pushq(RAX); |
2707 if (object != RAX) { | 2709 if (object != RAX) { |
2708 movq(RAX, object); | 2710 movq(RAX, object); |
2709 } | 2711 } |
2710 Call(&StubCode::UpdateStoreBufferLabel(), PP); | 2712 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 2713 Call(&stub_code->UpdateStoreBufferLabel(), PP); |
2711 if (value != RAX) popq(RAX); | 2714 if (value != RAX) popq(RAX); |
2712 Bind(&done); | 2715 Bind(&done); |
2713 } | 2716 } |
2714 | 2717 |
2715 | 2718 |
2716 void Assembler::StoreIntoObjectNoBarrier(Register object, | 2719 void Assembler::StoreIntoObjectNoBarrier(Register object, |
2717 const Address& dest, | 2720 const Address& dest, |
2718 Register value) { | 2721 Register value) { |
2719 movq(dest, value); | 2722 movq(dest, value); |
2720 #if defined(DEBUG) | 2723 #if defined(DEBUG) |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3360 | 3363 |
3361 | 3364 |
3362 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3365 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3363 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3366 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
3364 return xmm_reg_names[reg]; | 3367 return xmm_reg_names[reg]; |
3365 } | 3368 } |
3366 | 3369 |
3367 } // namespace dart | 3370 } // namespace dart |
3368 | 3371 |
3369 #endif // defined TARGET_ARCH_X64 | 3372 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |