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

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

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/x64/assembler-x64.h ('k') | src/x64/disasm-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/assembler-x64.cc
diff --git a/src/x64/assembler-x64.cc b/src/x64/assembler-x64.cc
index 5f8fb6818eb89cf8dd8e79be4beaf051e1f57bbb..4b9115d43bc4abef4fdcbb74236fa968f4e89f4b 100644
--- a/src/x64/assembler-x64.cc
+++ b/src/x64/assembler-x64.cc
@@ -1016,6 +1016,40 @@ void Assembler::cmpb_al(Immediate imm8) {
emit(imm8.value_);
}
+void Assembler::lock() {
+ EnsureSpace ensure_space(this);
+ emit(0xf0);
+}
+
+void Assembler::cmpxchgb(const Operand& dst, Register src) {
+ EnsureSpace ensure_space(this);
+ if (!src.is_byte_register()) {
+ // Register is not one of al, bl, cl, dl. Its encoding needs REX.
+ emit_rex_32(src, dst);
+ } else {
+ emit_optional_rex_32(src, dst);
+ }
+ emit(0x0f);
+ emit(0xb0);
+ emit_operand(src, dst);
+}
+
+void Assembler::cmpxchgw(const Operand& dst, Register src) {
+ EnsureSpace ensure_space(this);
+ emit(0x66);
+ emit_optional_rex_32(src, dst);
+ emit(0x0f);
+ emit(0xb1);
+ emit_operand(src, dst);
+}
+
+void Assembler::emit_cmpxchg(const Operand& dst, Register src, int size) {
+ EnsureSpace ensure_space(this);
+ emit_rex(src, dst, size);
+ emit(0x0f);
+ emit(0xb1);
+ emit_operand(src, dst);
+}
void Assembler::cpuid() {
EnsureSpace ensure_space(this);
« no previous file with comments | « src/x64/assembler-x64.h ('k') | src/x64/disasm-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698