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

Side by Side Diff: src/x87/disasm-x87.cc

Issue 328343003: Remove dependency on Vector from platform files (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 6 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 | « src/x64/disasm-x64.cc ('k') | test/cctest/test-api.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <assert.h> 5 #include <assert.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdarg.h> 7 #include <stdarg.h>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 AppendToBuffer("'Unimplemented Instruction'"); 350 AppendToBuffer("'Unimplemented Instruction'");
351 } 351 }
352 } 352 }
353 }; 353 };
354 354
355 355
356 void DisassemblerX87::AppendToBuffer(const char* format, ...) { 356 void DisassemblerX87::AppendToBuffer(const char* format, ...) {
357 v8::internal::Vector<char> buf = tmp_buffer_ + tmp_buffer_pos_; 357 v8::internal::Vector<char> buf = tmp_buffer_ + tmp_buffer_pos_;
358 va_list args; 358 va_list args;
359 va_start(args, format); 359 va_start(args, format);
360 int result = v8::internal::OS::VSNPrintF(buf, format, args); 360 int result = v8::internal::VSNPrintF(buf, format, args);
361 va_end(args); 361 va_end(args);
362 tmp_buffer_pos_ += result; 362 tmp_buffer_pos_ += result;
363 } 363 }
364 364
365 int DisassemblerX87::PrintRightOperandHelper( 365 int DisassemblerX87::PrintRightOperandHelper(
366 byte* modrmp, 366 byte* modrmp,
367 RegisterNameMapping direct_register_name) { 367 RegisterNameMapping direct_register_name) {
368 int mod, regop, rm; 368 int mod, regop, rm;
369 get_modrm(*modrmp, &mod, &regop, &rm); 369 get_modrm(*modrmp, &mod, &regop, &rm);
370 RegisterNameMapping register_name = (mod == 3) ? direct_register_name : 370 RegisterNameMapping register_name = (mod == 3) ? direct_register_name :
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 1638
1639 int instr_len = data - instr; 1639 int instr_len = data - instr;
1640 if (instr_len == 0) { 1640 if (instr_len == 0) {
1641 printf("%02x", *data); 1641 printf("%02x", *data);
1642 } 1642 }
1643 ASSERT(instr_len > 0); // Ensure progress. 1643 ASSERT(instr_len > 0); // Ensure progress.
1644 1644
1645 int outp = 0; 1645 int outp = 0;
1646 // Instruction bytes. 1646 // Instruction bytes.
1647 for (byte* bp = instr; bp < data; bp++) { 1647 for (byte* bp = instr; bp < data; bp++) {
1648 outp += v8::internal::OS::SNPrintF(out_buffer + outp, 1648 outp += v8::internal:::SNPrintF(out_buffer + outp, "%02x", *bp);
1649 "%02x",
1650 *bp);
1651 } 1649 }
1652 for (int i = 6 - instr_len; i >= 0; i--) { 1650 for (int i = 6 - instr_len; i >= 0; i--) {
1653 outp += v8::internal::OS::SNPrintF(out_buffer + outp, 1651 outp += v8::internal::SNPrintF(out_buffer + outp, " ");
1654 " ");
1655 } 1652 }
1656 1653
1657 outp += v8::internal::OS::SNPrintF(out_buffer + outp, 1654 outp += v8::internal::SNPrintF(out_buffer + outp, " %s", tmp_buffer_.start());
1658 " %s",
1659 tmp_buffer_.start());
1660 return instr_len; 1655 return instr_len;
1661 } // NOLINT (function is too long) 1656 } // NOLINT (function is too long)
1662 1657
1663 1658
1664 //------------------------------------------------------------------------------ 1659 //------------------------------------------------------------------------------
1665 1660
1666 1661
1667 static const char* cpu_regs[8] = { 1662 static const char* cpu_regs[8] = {
1668 "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" 1663 "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"
1669 }; 1664 };
1670 1665
1671 1666
1672 static const char* byte_cpu_regs[8] = { 1667 static const char* byte_cpu_regs[8] = {
1673 "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" 1668 "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh"
1674 }; 1669 };
1675 1670
1676 1671
1677 static const char* xmm_regs[8] = { 1672 static const char* xmm_regs[8] = {
1678 "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" 1673 "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"
1679 }; 1674 };
1680 1675
1681 1676
1682 const char* NameConverter::NameOfAddress(byte* addr) const { 1677 const char* NameConverter::NameOfAddress(byte* addr) const {
1683 v8::internal::OS::SNPrintF(tmp_buffer_, "%p", addr); 1678 v8::internal::SNPrintF(tmp_buffer_, "%p", addr);
1684 return tmp_buffer_.start(); 1679 return tmp_buffer_.start();
1685 } 1680 }
1686 1681
1687 1682
1688 const char* NameConverter::NameOfConstant(byte* addr) const { 1683 const char* NameConverter::NameOfConstant(byte* addr) const {
1689 return NameOfAddress(addr); 1684 return NameOfAddress(addr);
1690 } 1685 }
1691 1686
1692 1687
1693 const char* NameConverter::NameOfCPURegister(int reg) const { 1688 const char* NameConverter::NameOfCPURegister(int reg) const {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 fprintf(f, " "); 1748 fprintf(f, " ");
1754 } 1749 }
1755 fprintf(f, " %s\n", buffer.start()); 1750 fprintf(f, " %s\n", buffer.start());
1756 } 1751 }
1757 } 1752 }
1758 1753
1759 1754
1760 } // namespace disasm 1755 } // namespace disasm
1761 1756
1762 #endif // V8_TARGET_ARCH_X87 1757 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/disasm-x64.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698