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

Side by Side Diff: test/cctest/test-disasm-ia32.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 unified diff | Download patch
« no previous file with comments | « src/x64/disasm-x64.cc ('k') | test/cctest/test-disasm-x64.cc » ('j') | 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 __ shlx(eax, Operand(ebx, ecx, times_4, 10000), ebx); 658 __ shlx(eax, Operand(ebx, ecx, times_4, 10000), ebx);
659 __ shrx(eax, ebx, ecx); 659 __ shrx(eax, ebx, ecx);
660 __ shrx(eax, Operand(ebx, ecx, times_4, 10000), ebx); 660 __ shrx(eax, Operand(ebx, ecx, times_4, 10000), ebx);
661 __ rorx(eax, ebx, 31); 661 __ rorx(eax, ebx, 31);
662 __ rorx(eax, Operand(ebx, ecx, times_4, 10000), 31); 662 __ rorx(eax, Operand(ebx, ecx, times_4, 10000), 31);
663 } 663 }
664 } 664 }
665 665
666 // xchg. 666 // xchg.
667 { 667 {
668 __ xchg_b(eax, Operand(eax, 8));
669 __ xchg_w(eax, Operand(ebx, 8));
668 __ xchg(eax, eax); 670 __ xchg(eax, eax);
669 __ xchg(eax, ebx); 671 __ xchg(eax, ebx);
670 __ xchg(ebx, ebx); 672 __ xchg(ebx, ebx);
671 __ xchg(ebx, Operand(esp, 12)); 673 __ xchg(ebx, Operand(esp, 12));
672 } 674 }
673 675
676 // cmpxchg.
677 {
678 __ cmpxchg_b(Operand(esp, 12), eax);
679 __ cmpxchg_w(Operand(ebx, ecx, times_4, 10000), eax);
680 __ cmpxchg(Operand(ebx, ecx, times_4, 10000), eax);
681 }
682
683 // lock prefix.
684 {
685 __ lock();
686 __ cmpxchg(Operand(esp, 12), ebx);
687
688 __ lock();
689 __ xchg_w(eax, Operand(ecx, 8));
690 }
691
674 // Nop instructions 692 // Nop instructions
675 for (int i = 0; i < 16; i++) { 693 for (int i = 0; i < 16; i++) {
676 __ Nop(i); 694 __ Nop(i);
677 } 695 }
678 696
679 __ ret(0); 697 __ ret(0);
680 698
681 CodeDesc desc; 699 CodeDesc desc;
682 assm.GetCode(&desc); 700 assm.GetCode(&desc);
683 Handle<Code> code = isolate->factory()->NewCode( 701 Handle<Code> code = isolate->factory()->NewCode(
684 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 702 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
685 USE(code); 703 USE(code);
686 #ifdef OBJECT_PRINT 704 #ifdef OBJECT_PRINT
687 OFStream os(stdout); 705 OFStream os(stdout);
688 code->Print(os); 706 code->Print(os);
689 byte* begin = code->instruction_start(); 707 byte* begin = code->instruction_start();
690 byte* end = begin + code->instruction_size(); 708 byte* end = begin + code->instruction_size();
691 disasm::Disassembler::Disassemble(stdout, begin, end); 709 disasm::Disassembler::Disassemble(stdout, begin, end);
692 #endif 710 #endif
693 } 711 }
694 712
695 #undef __ 713 #undef __
OLDNEW
« no previous file with comments | « src/x64/disasm-x64.cc ('k') | test/cctest/test-disasm-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698