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

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

Issue 235363005: Adds comparisons, labels, branches to arm64 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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/longjump.h" 10 #include "vm/longjump.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", 67 "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31",
68 }; 68 };
69 69
70 70
71 const char* Assembler::FpuRegisterName(FpuRegister reg) { 71 const char* Assembler::FpuRegisterName(FpuRegister reg) {
72 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); 72 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters));
73 return fpu_reg_names[reg]; 73 return fpu_reg_names[reg];
74 } 74 }
75 75
76 76
77 // TODO(zra): Support for far branches. Requires loading large immediates.
78 void Assembler::Bind(Label* label) {
79 ASSERT(!label->IsBound());
80 intptr_t bound_pc = buffer_.Size();
81
82 while (label->IsLinked()) {
83 const int64_t position = label->Position();
84 const int64_t dest = bound_pc - position;
85 const int32_t next = buffer_.Load<int32_t>(position);
86 const int32_t encoded = EncodeImm19BranchOffset(dest, next);
87 buffer_.Store<int32_t>(position, encoded);
88 label->position_ = DecodeImm19BranchOffset(next);
89 }
90 label->BindTo(bound_pc);
91 }
92
93
77 static int CountLeadingZeros(uint64_t value, int width) { 94 static int CountLeadingZeros(uint64_t value, int width) {
78 ASSERT((width == 32) || (width == 64)); 95 ASSERT((width == 32) || (width == 64));
79 if (value == 0) { 96 if (value == 0) {
80 return width; 97 return width;
81 } 98 }
82 int count = 0; 99 int count = 0;
83 do { 100 do {
84 count++; 101 count++;
85 } while (value >>= 1); 102 } while (value >>= 1);
86 return width - count; 103 return width - count;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 216 }
200 217
201 // 6. Otherwise, the value can't be encoded. 218 // 6. Otherwise, the value can't be encoded.
202 return false; 219 return false;
203 } 220 }
204 } 221 }
205 222
206 } // namespace dart 223 } // namespace dart
207 224
208 #endif // defined TARGET_ARCH_ARM64 225 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698