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

Unified Diff: src/assembler.cpp

Issue 693393002: Subzero: Support multiple fixups in one instruction. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 1 month 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
Index: src/assembler.cpp
diff --git a/src/assembler.cpp b/src/assembler.cpp
index 6f2ec8118c92545f98bdbdefc21853828eb820d6..6fb02a93cbd5f201da1272251145d9626ca7d1fa 100644
--- a/src/assembler.cpp
+++ b/src/assembler.cpp
@@ -74,10 +74,16 @@ AssemblerBuffer::AssemblerBuffer(Assembler &assembler) : assembler_(assembler) {
AssemblerBuffer::~AssemblerBuffer() {}
-AssemblerFixup *AssemblerBuffer::GetLatestFixup() const {
- if (fixups_.empty())
- return NULL;
- return fixups_.back();
+// Returns the latest fixup at or after the given position, or NULL if
+// there is none. Assumes were added in increasing order.
jvoung (off chromium) 2014/11/03 17:18:55 "Assumes fixups were added in..."
Jim Stichnoth 2014/11/03 19:35:49 Done.
+AssemblerFixup *AssemblerBuffer::GetLatestFixup(intptr_t position) const {
+ AssemblerFixup *latest_fixup = NULL;
+ for (auto I = fixups_.rbegin(), E = fixups_.rend(); I != E; ++I) {
+ if ((*I)->position() < position)
+ return latest_fixup;
+ latest_fixup = *I;
+ }
+ return latest_fixup;
}
void AssemblerBuffer::ProcessFixups(const MemoryRegion &region) {

Powered by Google App Engine
This is Rietveld 408576698