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

Unified Diff: src/x64/assembler-x64.h

Issue 1986113004: Add cmpxchg and lock instructions to x64 and ia32 {dis,}assemblers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merge master 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/disasm-ia32.cc ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/assembler-x64.h
diff --git a/src/x64/assembler-x64.h b/src/x64/assembler-x64.h
index 77a1a57889985c52941c46cac7fb4e0ea4951f28..4df1801801458acd7359650f7368a9cb9f128875 100644
--- a/src/x64/assembler-x64.h
+++ b/src/x64/assembler-x64.h
@@ -421,11 +421,11 @@ class Operand BASE_EMBEDDED {
friend class Assembler;
};
-
#define ASSEMBLER_INSTRUCTION_LIST(V) \
V(add) \
V(and) \
V(cmp) \
+ V(cmpxchg) \
V(dec) \
V(idiv) \
V(div) \
@@ -445,7 +445,6 @@ class Operand BASE_EMBEDDED {
V(xchg) \
V(xor)
-
// Shift instructions on operands/registers with kPointerSize, kInt32Size and
// kInt64Size.
#define SHIFT_INSTRUCTION_LIST(V) \
@@ -788,9 +787,15 @@ class Assembler : public AssemblerBase {
void decb(Register dst);
void decb(const Operand& dst);
+ // Lock prefix.
+ void lock();
+
void xchgb(Register reg, const Operand& op);
void xchgw(Register reg, const Operand& op);
+ void cmpxchgb(const Operand& dst, Register src);
+ void cmpxchgw(const Operand& dst, Register src);
+
// Sign-extends rax into rdx:rax.
void cqo();
// Sign-extends eax into edx:eax.
@@ -2054,6 +2059,11 @@ class Assembler : public AssemblerBase {
immediate_arithmetic_op(0x7, dst, src, size);
}
+ // Compare {al,ax,eax,rax} with src. If equal, set ZF and write dst into
+ // src. Otherwise clear ZF and write src into {al,ax,eax,rax}. This
+ // operation is only atomic if prefixed by the lock instruction.
+ void emit_cmpxchg(const Operand& dst, Register src, int size);
+
void emit_dec(Register dst, int size);
void emit_dec(const Operand& dst, int size);
« no previous file with comments | « src/ia32/disasm-ia32.cc ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698