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

Unified Diff: courgette/assembly_program.h

Issue 2583373002: [Courgette] Simple AssemblyProgram and Disassembler cleanups. (Closed)
Patch Set: Tune up header inclusion. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « courgette/adjustment_method_unittest.cc ('k') | courgette/assembly_program.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/assembly_program.h
diff --git a/courgette/assembly_program.h b/courgette/assembly_program.h
index 86bd0449e670acb95e0a8316f026a316ea2677dc..a3bab07bbd65639694efe288d584e9bc8ca469e0 100644
--- a/courgette/assembly_program.h
+++ b/courgette/assembly_program.h
@@ -10,10 +10,8 @@
#include <map>
#include <memory>
-#include <set>
-#include <vector>
-#include "base/bind.h"
+#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/free_deleter.h"
#include "courgette/courgette.h"
@@ -132,13 +130,11 @@ class AssemblyProgram {
using InstructionGenerator =
base::Callback<CheckBool(AssemblyProgram*, InstructionReceptor*)>;
- explicit AssemblyProgram(ExecutableType kind);
+ AssemblyProgram(ExecutableType kind, uint64_t image_base);
~AssemblyProgram();
ExecutableType kind() const { return kind_; }
- void set_image_base(uint64_t image_base) { image_base_ = image_base; }
-
// Traverses RVAs in |abs32_visitor| and |rel32_visitor| to precompute Labels.
void PrecomputeLabels(RvaVisitor* abs32_visitor, RvaVisitor* rel32_visitor);
@@ -212,8 +208,6 @@ class AssemblyProgram {
using ScopedInstruction =
std::unique_ptr<Instruction, UncheckedDeleter<Instruction>>;
- ExecutableType kind_;
-
CheckBool Emit(ScopedInstruction instruction) WARN_UNUSED_RESULT;
CheckBool EmitShared(Instruction* instruction) WARN_UNUSED_RESULT;
@@ -222,16 +216,13 @@ class AssemblyProgram {
// Looks up a label or creates a new one. Might return NULL.
Label* FindLabel(RVA rva, RVAToLabel* labels);
- // Helper methods for the public versions.
- static void UnassignIndexes(RVAToLabel* labels);
- static void DefaultAssignIndexes(RVAToLabel* labels);
- static void AssignRemainingIndexes(RVAToLabel* labels);
-
// Sharing instructions that emit a single byte saves a lot of space.
Instruction* GetByteInstruction(uint8_t byte);
- std::unique_ptr<Instruction* [], base::FreeDeleter> byte_instruction_cache_;
- uint64_t image_base_; // Desired or mandated base address of image.
+ const ExecutableType kind_;
+ const uint64_t image_base_; // Desired or mandated base address of image.
+
+ std::unique_ptr<Instruction* [], base::FreeDeleter> byte_instruction_cache_;
InstructionVector instructions_; // All the instructions in program.
« no previous file with comments | « courgette/adjustment_method_unittest.cc ('k') | courgette/assembly_program.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698