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

Unified Diff: tools/traceline/traceline/assembler_unittest.cc

Issue 20494: Import Traceline, a Windows performance trace event logger. (Closed)
Patch Set: Feedback. Created 11 years, 10 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 | « tools/traceline/traceline/assembler.h ('k') | tools/traceline/traceline/assembler_unittest.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/traceline/traceline/assembler_unittest.cc
diff --git a/tools/traceline/traceline/assembler_unittest.cc b/tools/traceline/traceline/assembler_unittest.cc
new file mode 100755
index 0000000000000000000000000000000000000000..e2c17b66012062aa9824c0ee97aea7250fc91417
--- /dev/null
+++ b/tools/traceline/traceline/assembler_unittest.cc
@@ -0,0 +1,83 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stdio.h>
+
+#include "assembler.h"
+
+int main(int argc, char** argv) {
+ char buf[1024];
+
+ CodeBuffer cb(buf);
+
+ // Branching tests first so the offsets are not always adjusting in the
+ // output diassembler when we add new tests.
+
+ cb.spin();
+
+ cb.call(EAX);
+ cb.call(Operand(EAX));
+ cb.call(Operand(EDX, 15));
+
+ cb.fs(); cb.mov(EAX, Operand(3));
+ cb.fs(); cb.mov(EDX, Operand(0x04));
+
+ cb.lea(EAX, Operand(EAX));
+ cb.lea(EAX, Operand(0x12345678));
+ cb.lea(EAX, Operand(EBX, 0x12345678));
+ cb.lea(EAX, Operand(EBX, ECX, SCALE_TIMES_2, 0x12345678));
+ cb.lea(EAX, Operand(ECX, SCALE_TIMES_2, 0x12345678));
+ cb.lea(EAX, Operand(EAX, SCALE_TIMES_2, 0));
+ cb.lea(EAX, Operand(EBX, SCALE_TIMES_2, 0));
+ cb.lea(EBP, Operand(EBP, SCALE_TIMES_2, 1));
+
+ cb.lodsb();
+ cb.lodsd();
+
+ cb.mov(EAX, ECX);
+ cb.mov(ESI, ESP);
+ cb.mov(EAX, Operand(ESP, 0x20));
+ cb.mov(EAX, Operand(EBP, 8));
+ cb.mov_imm(ESP, 1);
+ cb.mov_imm(EAX, 0x12345678);
+
+ cb.pop(EBX);
+ cb.pop(Operand(EBX));
+ cb.pop(Operand(EBX, 0));
+ cb.pop(Operand(EBX, 12));
+
+ cb.push(EBX);
+ cb.push(Operand(EBX));
+ cb.push(Operand(EBX, 0));
+ cb.push(Operand(EDI, -4));
+ cb.push(Operand(EDI, -8));
+ cb.push_imm(0x12);
+ cb.push_imm(0x1234);
+ cb.push(Operand(EBX, 12));
+ cb.push(Operand(ESP, 0x1234));
+
+ cb.ret();
+ cb.ret(0);
+ cb.ret(12);
+
+ cb.stosb();
+ cb.stosd();
+
+ cb.sysenter();
+
+ cb.which_cpu();
+ cb.which_thread();
+
+ cb.xchg(EAX, EAX);
+ cb.xchg(EBX, EAX);
+ cb.xchg(EAX, EBX);
+ cb.xchg(ECX, ESP);
+ cb.xchg(ECX, Operand(ESP));
+ cb.xchg(ECX, Operand(ESP, 5));
+ cb.xchg(ECX, Operand(EDX, 4));
+
+ fwrite(buf, 1, cb.size(), stdout);
+
+ return 0;
+}
« no previous file with comments | « tools/traceline/traceline/assembler.h ('k') | tools/traceline/traceline/assembler_unittest.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698