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

Side by Side Diff: courgette/disassembler_elf_32_arm.cc

Issue 1969543002: Unified usage of vector<unique_ptr<T>> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Format Created 4 years, 7 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
« no previous file with comments | « courgette/disassembler_elf_32.cc ('k') | courgette/disassembler_elf_32_x86.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium 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 #include "courgette/disassembler_elf_32_arm.h" 5 #include "courgette/disassembler_elf_32_arm.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "courgette/assembly_program.h" 12 #include "courgette/assembly_program.h"
12 #include "courgette/courgette.h" 13 #include "courgette/courgette.h"
13 14
14 namespace courgette { 15 namespace courgette {
15 16
16 CheckBool DisassemblerElf32ARM::Compress(ARM_RVA type, 17 CheckBool DisassemblerElf32ARM::Compress(ARM_RVA type,
17 uint32_t arm_op, 18 uint32_t arm_op,
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 if (!rel32_rva->ComputeRelativeTarget(p)) 499 if (!rel32_rva->ComputeRelativeTarget(p))
499 return false; 500 return false;
500 501
501 target_rva = rel32_rva->rva() + rel32_rva->relative_target(); 502 target_rva = rel32_rva->rva() + rel32_rva->relative_target();
502 found = true; 503 found = true;
503 } 504 }
504 } 505 }
505 506
506 if (found && IsValidTargetRVA(target_rva)) { 507 if (found && IsValidTargetRVA(target_rva)) {
507 uint16_t op_size = rel32_rva->op_size(); 508 uint16_t op_size = rel32_rva->op_size();
508 rel32_locations_.push_back(rel32_rva.release()); 509 rel32_locations_.push_back(std::move(rel32_rva));
509 #if COURGETTE_HISTOGRAM_TARGETS 510 #if COURGETTE_HISTOGRAM_TARGETS
510 ++rel32_target_rvas_[target_rva]; 511 ++rel32_target_rvas_[target_rva];
511 #endif 512 #endif
512 p += op_size; 513 p += op_size;
513 514
514 // A tricky way to update the on_32bit flag. Here is the truth table: 515 // A tricky way to update the on_32bit flag. Here is the truth table:
515 // on_32bit | on_32bit size is 4 516 // on_32bit | on_32bit size is 4
516 // ---------+--------------------- 517 // ---------+---------------------
517 // 1 | 0 0 518 // 1 | 0 0
518 // 0 | 0 1 519 // 0 | 0 1
519 // 0 | 1 0 520 // 0 | 1 0
520 // 1 | 1 1 521 // 1 | 1 1
521 on_32bit = (~(on_32bit ^ (op_size == 4))) != 0; 522 on_32bit = (~(on_32bit ^ (op_size == 4))) != 0;
522 } else { 523 } else {
523 // Move 2 bytes at a time, but track 32-bit boundaries 524 // Move 2 bytes at a time, but track 32-bit boundaries
524 p += 2; 525 p += 2;
525 on_32bit = ((on_32bit + 1) % 2) != 0; 526 on_32bit = ((on_32bit + 1) % 2) != 0;
526 } 527 }
527 } 528 }
528 529
529 return true; 530 return true;
530 } 531 }
531 532
532 } // namespace courgette 533 } // namespace courgette
OLDNEW
« no previous file with comments | « courgette/disassembler_elf_32.cc ('k') | courgette/disassembler_elf_32_x86.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698