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

Side by Side Diff: test/cctest/test-disasm-x64.cc

Issue 178193028: Print properly signed displacement in disassembler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Port to x64. Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-disasm-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 16 matching lines...) Expand all
27 27
28 #include <stdlib.h> 28 #include <stdlib.h>
29 29
30 #include "v8.h" 30 #include "v8.h"
31 31
32 #include "debug.h" 32 #include "debug.h"
33 #include "disasm.h" 33 #include "disasm.h"
34 #include "disassembler.h" 34 #include "disassembler.h"
35 #include "macro-assembler.h" 35 #include "macro-assembler.h"
36 #include "serialize.h" 36 #include "serialize.h"
37 #include "stub-cache.h"
37 #include "cctest.h" 38 #include "cctest.h"
38 39
39 using namespace v8::internal; 40 using namespace v8::internal;
40 41
41 42
42 #define __ assm. 43 #define __ assm.
43 44
44 45
45 static void DummyStaticFunction(Object* result) { 46 static void DummyStaticFunction(Object* result) {
46 } 47 }
47 48
48 49
49 TEST(DisasmX64) { 50 TEST(DisasmX64) {
50 CcTest::InitializeVM(); 51 CcTest::InitializeVM();
51 v8::HandleScope scope; 52 Isolate* isolate = CcTest::i_isolate();
53 HandleScope scope(isolate);
52 v8::internal::byte buffer[2048]; 54 v8::internal::byte buffer[2048];
53 Assembler assm(CcTest::i_isolate(), buffer, sizeof buffer); 55 Assembler assm(isolate, buffer, sizeof buffer);
54 DummyStaticFunction(NULL); // just bloody use it (DELETE; debugging) 56 DummyStaticFunction(NULL); // just bloody use it (DELETE; debugging)
55 57
56 // Short immediate instructions 58 // Short immediate instructions
57 __ addq(rax, Immediate(12345678)); 59 __ addq(rax, Immediate(12345678));
58 __ or_(rax, Immediate(12345678)); 60 __ or_(rax, Immediate(12345678));
59 __ subq(rax, Immediate(12345678)); 61 __ subq(rax, Immediate(12345678));
60 __ xor_(rax, Immediate(12345678)); 62 __ xor_(rax, Immediate(12345678));
61 __ and_(rax, Immediate(12345678)); 63 __ and_(rax, Immediate(12345678));
62 64
63 // ---- This one caused crash 65 // ---- This one caused crash
64 __ movq(rbx, Operand(rsp, rcx, times_2, 0)); // [rsp+rcx*4] 66 __ movq(rbx, Operand(rsp, rcx, times_2, 0)); // [rsp+rcx*4]
65 67
66 // ---- All instructions that I can think of 68 // ---- All instructions that I can think of
67 __ addq(rdx, rbx); 69 __ addq(rdx, rbx);
68 __ addq(rdx, Operand(rbx, 0)); 70 __ addq(rdx, Operand(rbx, 0));
69 __ addq(rdx, Operand(rbx, 16)); 71 __ addq(rdx, Operand(rbx, 16));
70 __ addq(rdx, Operand(rbx, 1999)); 72 __ addq(rdx, Operand(rbx, 1999));
73 __ addq(rdx, Operand(rbx, -4));
74 __ addq(rdx, Operand(rbx, -1999));
71 __ addq(rdx, Operand(rsp, 0)); 75 __ addq(rdx, Operand(rsp, 0));
72 __ addq(rdx, Operand(rsp, 16)); 76 __ addq(rdx, Operand(rsp, 16));
73 __ addq(rdx, Operand(rsp, 1999)); 77 __ addq(rdx, Operand(rsp, 1999));
78 __ addq(rdx, Operand(rsp, -4));
79 __ addq(rdx, Operand(rsp, -1999));
80 __ nop();
81 __ addq(rsi, Operand(rcx, times_4, 0));
82 __ addq(rsi, Operand(rcx, times_4, 24));
83 __ addq(rsi, Operand(rcx, times_4, -4));
84 __ addq(rsi, Operand(rcx, times_4, -1999));
74 __ nop(); 85 __ nop();
75 __ addq(rdi, Operand(rbp, rcx, times_4, 0)); 86 __ addq(rdi, Operand(rbp, rcx, times_4, 0));
76 __ addq(rdi, Operand(rbp, rcx, times_4, 12)); 87 __ addq(rdi, Operand(rbp, rcx, times_4, 12));
88 __ addq(rdi, Operand(rbp, rcx, times_4, -8));
89 __ addq(rdi, Operand(rbp, rcx, times_4, -3999));
77 __ addq(Operand(rbp, rcx, times_4, 12), Immediate(12)); 90 __ addq(Operand(rbp, rcx, times_4, 12), Immediate(12));
78 91
79 __ nop(); 92 __ nop();
80 __ addq(rbx, Immediate(12)); 93 __ addq(rbx, Immediate(12));
81 __ nop(); 94 __ nop();
82 __ nop(); 95 __ nop();
83 __ and_(rdx, Immediate(3)); 96 __ and_(rdx, Immediate(3));
84 __ and_(rdx, Operand(rsp, 4)); 97 __ and_(rdx, Operand(rsp, 4));
85 __ cmpq(rdx, Immediate(3)); 98 __ cmpq(rdx, Immediate(3));
86 __ cmpq(rdx, Operand(rsp, 4)); 99 __ cmpq(rdx, Operand(rsp, 4));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 __ testq(Operand(rbx, rcx, times_4, 10000), rdx); 163 __ testq(Operand(rbx, rcx, times_4, 10000), rdx);
151 164
152 __ imul(rdx, Operand(rbx, rcx, times_4, 10000)); 165 __ imul(rdx, Operand(rbx, rcx, times_4, 10000));
153 __ imul(rdx, rcx, Immediate(12)); 166 __ imul(rdx, rcx, Immediate(12));
154 __ imul(rdx, rcx, Immediate(1000)); 167 __ imul(rdx, rcx, Immediate(1000));
155 168
156 __ incq(rdx); 169 __ incq(rdx);
157 __ incq(Operand(rbx, rcx, times_4, 10000)); 170 __ incq(Operand(rbx, rcx, times_4, 10000));
158 __ push(Operand(rbx, rcx, times_4, 10000)); 171 __ push(Operand(rbx, rcx, times_4, 10000));
159 __ pop(Operand(rbx, rcx, times_4, 10000)); 172 __ pop(Operand(rbx, rcx, times_4, 10000));
160 __ jmp(Operand(rbx, rcx, times_4, 10000)); 173 // TODO(mstarzinger): The following is protected.
174 // __ jmp(Operand(rbx, rcx, times_4, 10000));
161 175
162 __ lea(rdx, Operand(rbx, rcx, times_4, 10000)); 176 __ lea(rdx, Operand(rbx, rcx, times_4, 10000));
163 __ or_(rdx, Immediate(12345)); 177 __ or_(rdx, Immediate(12345));
164 __ or_(rdx, Operand(rbx, rcx, times_4, 10000)); 178 __ or_(rdx, Operand(rbx, rcx, times_4, 10000));
165 179
166 __ nop(); 180 __ nop();
167 181
168 __ rcl(rdx, Immediate(1)); 182 __ rcl(rdx, Immediate(1));
169 __ rcl(rdx, Immediate(7)); 183 __ rcl(rdx, Immediate(7));
170 __ rcr(rdx, Immediate(1)); 184 __ rcr(rdx, Immediate(1));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 240
227 // Calls 241 // Calls
228 242
229 Label L1, L2; 243 Label L1, L2;
230 __ bind(&L1); 244 __ bind(&L1);
231 __ nop(); 245 __ nop();
232 __ call(&L1); 246 __ call(&L1);
233 __ call(&L2); 247 __ call(&L2);
234 __ nop(); 248 __ nop();
235 __ bind(&L2); 249 __ bind(&L2);
236 __ call(Operand(rbx, rcx, times_4, 10000)); 250 // TODO(mstarzinger): The following is protected.
251 // __ call(Operand(rbx, rcx, times_4, 10000));
237 __ nop(); 252 __ nop();
238 Handle<Code> ic(CcTest::i_isolate()->builtins()->builtin( 253 Handle<Code> ic(LoadIC::initialize_stub(isolate, NOT_CONTEXTUAL));
239 Builtins::kLoadIC_Initialize));
240 __ call(ic, RelocInfo::CODE_TARGET); 254 __ call(ic, RelocInfo::CODE_TARGET);
241 __ nop(); 255 __ nop();
242 __ nop(); 256 __ nop();
243 257
244 __ jmp(&L1); 258 __ jmp(&L1);
245 __ jmp(Operand(rbx, rcx, times_4, 10000)); 259 // TODO(mstarzinger): The following is protected.
260 // __ jmp(Operand(rbx, rcx, times_4, 10000));
246 #ifdef ENABLE_DEBUGGER_SUPPORT 261 #ifdef ENABLE_DEBUGGER_SUPPORT
247 ExternalReference after_break_target = 262 ExternalReference after_break_target =
248 ExternalReference(Debug_Address::AfterBreakTarget(), 263 ExternalReference(Debug_Address::AfterBreakTarget(), isolate);
249 assm.isolate());
250 USE(after_break_target); 264 USE(after_break_target);
251 #endif // ENABLE_DEBUGGER_SUPPORT 265 #endif // ENABLE_DEBUGGER_SUPPORT
252 __ jmp(ic, RelocInfo::CODE_TARGET); 266 __ jmp(ic, RelocInfo::CODE_TARGET);
253 __ nop(); 267 __ nop();
254 268
255 269
256 Label Ljcc; 270 Label Ljcc;
257 __ nop(); 271 __ nop();
258 // long jumps 272 // long jumps
259 __ j(overflow, &Ljcc); 273 __ j(overflow, &Ljcc);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 { 352 {
339 // Move operation 353 // Move operation
340 __ cvttss2si(rdx, Operand(rbx, rcx, times_4, 10000)); 354 __ cvttss2si(rdx, Operand(rbx, rcx, times_4, 10000));
341 __ cvttss2si(rdx, xmm1); 355 __ cvttss2si(rdx, xmm1);
342 __ movaps(xmm0, xmm1); 356 __ movaps(xmm0, xmm1);
343 357
344 // logic operation 358 // logic operation
345 __ andps(xmm0, xmm1); 359 __ andps(xmm0, xmm1);
346 __ andps(xmm0, Operand(rbx, rcx, times_4, 10000)); 360 __ andps(xmm0, Operand(rbx, rcx, times_4, 10000));
347 __ orps(xmm0, xmm1); 361 __ orps(xmm0, xmm1);
348 __ ordps(xmm0, Operand(rbx, rcx, times_4, 10000)); 362 __ orps(xmm0, Operand(rbx, rcx, times_4, 10000));
349 __ xorps(xmm0, xmm1); 363 __ xorps(xmm0, xmm1);
350 __ xordps(xmm0, Operand(rbx, rcx, times_4, 10000)); 364 __ xorps(xmm0, Operand(rbx, rcx, times_4, 10000));
351 365
352 // Arithmetic operation 366 // Arithmetic operation
353 __ addps(xmm1, xmm0); 367 __ addps(xmm1, xmm0);
354 __ addps(xmm1, Operand(rbx, rcx, times_4, 10000)); 368 __ addps(xmm1, Operand(rbx, rcx, times_4, 10000));
355 __ subps(xmm1, xmm0); 369 __ subps(xmm1, xmm0);
356 __ subps(xmm1, Operand(rbx, rcx, times_4, 10000)); 370 __ subps(xmm1, Operand(rbx, rcx, times_4, 10000));
357 __ mulps(xmm1, xmm0); 371 __ mulps(xmm1, xmm0);
358 __ mulps(xmm1, Operand(rbx, ecx, times_4, 10000)); 372 __ mulps(xmm1, Operand(rbx, rcx, times_4, 10000));
359 __ divps(xmm1, xmm0); 373 __ divps(xmm1, xmm0);
360 __ divps(xmm1, Operand(rbx, rcx, times_4, 10000)); 374 __ divps(xmm1, Operand(rbx, rcx, times_4, 10000));
361 } 375 }
362 // SSE 2 instructions 376 // SSE 2 instructions
363 { 377 {
364 __ cvttsd2si(rdx, Operand(rbx, rcx, times_4, 10000)); 378 __ cvttsd2si(rdx, Operand(rbx, rcx, times_4, 10000));
365 __ cvttsd2si(rdx, xmm1); 379 __ cvttsd2si(rdx, xmm1);
366 __ cvttsd2siq(rdx, xmm1); 380 __ cvttsd2siq(rdx, xmm1);
367 __ movsd(xmm1, Operand(rbx, rcx, times_4, 10000)); 381 __ movsd(xmm1, Operand(rbx, rcx, times_4, 10000));
368 __ movsd(Operand(rbx, rcx, times_4, 10000), xmm1); 382 __ movsd(Operand(rbx, rcx, times_4, 10000), xmm1);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 CHECK(code->IsCode()); 436 CHECK(code->IsCode());
423 #ifdef OBJECT_PRINT 437 #ifdef OBJECT_PRINT
424 Code::cast(code)->Print(); 438 Code::cast(code)->Print();
425 byte* begin = Code::cast(code)->instruction_start(); 439 byte* begin = Code::cast(code)->instruction_start();
426 byte* end = begin + Code::cast(code)->instruction_size(); 440 byte* end = begin + Code::cast(code)->instruction_size();
427 disasm::Disassembler::Disassemble(stdout, begin, end); 441 disasm::Disassembler::Disassemble(stdout, begin, end);
428 #endif 442 #endif
429 } 443 }
430 444
431 #undef __ 445 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-disasm-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698