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

Side by Side Diff: src/arm/disasm-arm.cc

Issue 975283002: Use Rotate*() functions instead of doing this manually. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: . Created 5 years, 9 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A Disassembler object is used to disassemble a block of code instruction by 5 // A Disassembler object is used to disassemble a block of code instruction by
6 // instruction. The default implementation of the NameConverter object can be 6 // instruction. The default implementation of the NameConverter object can be
7 // overriden to modify register names or to do symbol lookup on addresses. 7 // overriden to modify register names or to do symbol lookup on addresses.
8 // 8 //
9 // The example below will disassemble a block of code and print it to stdout. 9 // The example below will disassemble a block of code and print it to stdout.
10 // 10 //
(...skipping 15 matching lines...) Expand all
26 #include <assert.h> 26 #include <assert.h>
27 #include <stdarg.h> 27 #include <stdarg.h>
28 #include <stdio.h> 28 #include <stdio.h>
29 #include <string.h> 29 #include <string.h>
30 30
31 #include "src/v8.h" 31 #include "src/v8.h"
32 32
33 #if V8_TARGET_ARCH_ARM 33 #if V8_TARGET_ARCH_ARM
34 34
35 #include "src/arm/constants-arm.h" 35 #include "src/arm/constants-arm.h"
36 #include "src/base/bits.h"
36 #include "src/base/platform/platform.h" 37 #include "src/base/platform/platform.h"
37 #include "src/disasm.h" 38 #include "src/disasm.h"
38 #include "src/macro-assembler.h" 39 #include "src/macro-assembler.h"
39 40
40 41
41 namespace v8 { 42 namespace v8 {
42 namespace internal { 43 namespace internal {
43 44
44 45
45 //------------------------------------------------------------------------------ 46 //------------------------------------------------------------------------------
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 PrintRegister(rs); 220 PrintRegister(rs);
220 } 221 }
221 } 222 }
222 223
223 224
224 // Print the immediate operand for the instruction. Generally used for data 225 // Print the immediate operand for the instruction. Generally used for data
225 // processing instructions. 226 // processing instructions.
226 void Decoder::PrintShiftImm(Instruction* instr) { 227 void Decoder::PrintShiftImm(Instruction* instr) {
227 int rotate = instr->RotateValue() * 2; 228 int rotate = instr->RotateValue() * 2;
228 int immed8 = instr->Immed8Value(); 229 int immed8 = instr->Immed8Value();
229 int imm = (immed8 >> rotate) | (immed8 << (32 - rotate)); 230 int imm = base::bits::RotateRight32(immed8, rotate);
230 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "#%d", imm); 231 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "#%d", imm);
231 } 232 }
232 233
233 234
234 // Print the optional shift and immediate used by saturating instructions. 235 // Print the optional shift and immediate used by saturating instructions.
235 void Decoder::PrintShiftSat(Instruction* instr) { 236 void Decoder::PrintShiftSat(Instruction* instr) {
236 int shift = instr->Bits(11, 7); 237 int shift = instr->Bits(11, 7);
237 if (shift > 0) { 238 if (shift > 0) {
238 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, 239 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
239 ", %s #%d", 240 ", %s #%d",
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 v8::internal::PrintF( 1947 v8::internal::PrintF(
1947 f, "%p %08x %s\n", 1948 f, "%p %08x %s\n",
1948 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); 1949 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start());
1949 } 1950 }
1950 } 1951 }
1951 1952
1952 1953
1953 } // namespace disasm 1954 } // namespace disasm
1954 1955
1955 #endif // V8_TARGET_ARCH_ARM 1956 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/simulator-arm.cc » ('j') | src/base/bits.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698