Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: runtime/vm/assembler_x64.cc

Issue 829133006: VM: Small generated code size improvements on x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/code_patcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" // NOLINT 5 #include "vm/globals.h" // NOLINT
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 EmitUint8(0xB8 | (TMP & 7)); 144 EmitUint8(0xB8 | (TMP & 7));
145 EmitInt64(label->address()); 145 EmitInt64(label->address());
146 } 146 }
147 call(TMP); 147 call(TMP);
148 } 148 }
149 149
150 150
151 void Assembler::CallPatchable(const ExternalLabel* label) { 151 void Assembler::CallPatchable(const ExternalLabel* label) {
152 ASSERT(allow_constant_pool()); 152 ASSERT(allow_constant_pool());
153 intptr_t call_start = buffer_.GetPosition(); 153 intptr_t call_start = buffer_.GetPosition();
154 LoadExternalLabel(TMP, label, kPatchable, PP); 154 const int32_t offset =
155 call(TMP); 155 Array::element_offset(FindExternalLabel(label, kPatchable));
156 call(Address::AddressBaseImm32(PP, offset - kHeapObjectTag));
156 ASSERT((buffer_.GetPosition() - call_start) == kCallExternalLabelSize); 157 ASSERT((buffer_.GetPosition() - call_start) == kCallExternalLabelSize);
157 } 158 }
158 159
159 160
160 void Assembler::Call(const ExternalLabel* label, Register pp) { 161 void Assembler::Call(const ExternalLabel* label, Register pp) {
161 if (Isolate::Current() == Dart::vm_isolate()) { 162 if (Isolate::Current() == Dart::vm_isolate()) {
162 call(label); 163 call(label);
163 } else { 164 } else {
164 LoadExternalLabel(TMP, label, kNotPatchable, pp); 165 const int32_t offset =
165 call(TMP); 166 Array::element_offset(FindExternalLabel(label, kNotPatchable));
167 call(Address::AddressBaseImm32(pp, offset - kHeapObjectTag));
166 } 168 }
167 } 169 }
168 170
169 171
170 void Assembler::pushq(Register reg) { 172 void Assembler::pushq(Register reg) {
171 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 173 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
172 EmitRegisterREX(reg, REX_NONE); 174 EmitRegisterREX(reg, REX_NONE);
173 EmitUint8(0x50 | (reg & 7)); 175 EmitUint8(0x50 | (reg & 7));
174 } 176 }
175 177
(...skipping 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 } 2585 }
2584 jmp(TMP); 2586 jmp(TMP);
2585 } 2587 }
2586 2588
2587 2589
2588 void Assembler::JmpPatchable(const ExternalLabel* label, Register pp) { 2590 void Assembler::JmpPatchable(const ExternalLabel* label, Register pp) {
2589 ASSERT(allow_constant_pool()); 2591 ASSERT(allow_constant_pool());
2590 intptr_t call_start = buffer_.GetPosition(); 2592 intptr_t call_start = buffer_.GetPosition();
2591 LoadExternalLabel(TMP, label, kPatchable, pp); 2593 LoadExternalLabel(TMP, label, kPatchable, pp);
2592 jmp(TMP); 2594 jmp(TMP);
2593 ASSERT((buffer_.GetPosition() - call_start) == kCallExternalLabelSize); 2595 ASSERT((buffer_.GetPosition() - call_start) == kJmpExternalLabelSize);
2594 } 2596 }
2595 2597
2596 2598
2597 void Assembler::Jmp(const ExternalLabel* label, Register pp) { 2599 void Assembler::Jmp(const ExternalLabel* label, Register pp) {
2598 LoadExternalLabel(TMP, label, kNotPatchable, pp); 2600 LoadExternalLabel(TMP, label, kNotPatchable, pp);
2599 jmp(TMP); 2601 jmp(TMP);
2600 } 2602 }
2601 2603
2602 2604
2603 void Assembler::lock() { 2605 void Assembler::lock() {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 } else { 2735 } else {
2734 subq(address, imm); 2736 subq(address, imm);
2735 } 2737 }
2736 } 2738 }
2737 } else { 2739 } else {
2738 AddImmediate(address, Immediate(-value), pp); 2740 AddImmediate(address, Immediate(-value), pp);
2739 } 2741 }
2740 } 2742 }
2741 2743
2742 2744
2743 void Assembler::Drop(intptr_t stack_elements) { 2745 void Assembler::Drop(intptr_t stack_elements, Register tmp) {
2744 ASSERT(stack_elements >= 0); 2746 ASSERT(stack_elements >= 0);
2745 if (stack_elements <= 4) { 2747 if (stack_elements <= 4) {
2746 for (intptr_t i = 0; i < stack_elements; i++) { 2748 for (intptr_t i = 0; i < stack_elements; i++) {
2747 popq(TMP); 2749 popq(tmp);
2748 } 2750 }
2749 return; 2751 return;
2750 } 2752 }
2751 addq(RSP, Immediate(stack_elements * kWordSize)); 2753 addq(RSP, Immediate(stack_elements * kWordSize));
2752 } 2754 }
2753 2755
2754 2756
2755 intptr_t Assembler::FindObject(const Object& obj, Patchability patchable) { 2757 intptr_t Assembler::FindObject(const Object& obj, Patchability patchable) {
2756 // The object pool cannot be used in the vm isolate. 2758 // The object pool cannot be used in the vm isolate.
2757 ASSERT(Isolate::Current() != Dart::vm_isolate()); 2759 ASSERT(Isolate::Current() != Dart::vm_isolate());
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 3929
3928 3930
3929 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3931 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3930 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 3932 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
3931 return xmm_reg_names[reg]; 3933 return xmm_reg_names[reg];
3932 } 3934 }
3933 3935
3934 } // namespace dart 3936 } // namespace dart
3935 3937
3936 #endif // defined TARGET_ARCH_X64 3938 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/code_patcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698