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

Side by Side Diff: src/x64/assembler-x64.h

Issue 6577036: [Isolates] Merge from bleeding_edge to isolates, revisions 6100-6300. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/version.cc ('k') | src/x64/assembler-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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // The non-allocatable registers are: 91 // The non-allocatable registers are:
92 // rsp - stack pointer 92 // rsp - stack pointer
93 // rbp - frame pointer 93 // rbp - frame pointer
94 // rsi - context register 94 // rsi - context register
95 // r10 - fixed scratch register 95 // r10 - fixed scratch register
96 // r13 - root register 96 // r13 - root register
97 // r15 - smi constant register 97 // r15 - smi constant register
98 static const int kNumRegisters = 16; 98 static const int kNumRegisters = 16;
99 static const int kNumAllocatableRegisters = 10; 99 static const int kNumAllocatableRegisters = 10;
100 100
101 static int ToAllocationIndex(Register reg) {
102 return allocationIndexByRegisterCode[reg.code()];
103 }
104
105 static Register FromAllocationIndex(int index) {
106 ASSERT(index >= 0 && index < kNumAllocatableRegisters);
107 Register result = { registerCodeByAllocationIndex[index] };
108 return result;
109 }
110
101 static const char* AllocationIndexToString(int index) { 111 static const char* AllocationIndexToString(int index) {
102 ASSERT(index >= 0 && index < kNumAllocatableRegisters); 112 ASSERT(index >= 0 && index < kNumAllocatableRegisters);
103 const char* const names[] = { 113 const char* const names[] = {
104 "rax", 114 "rax",
105 "rcx", 115 "rcx",
106 "rdx", 116 "rdx",
107 "rbx", 117 "rbx",
108 "rdi", 118 "rdi",
109 "r8", 119 "r8",
110 "r9", 120 "r9",
(...skipping 25 matching lines...) Expand all
136 } 146 }
137 // Return the 3 low bits of the register code. Used when encoding registers 147 // Return the 3 low bits of the register code. Used when encoding registers
138 // in modR/M, SIB, and opcode bytes. 148 // in modR/M, SIB, and opcode bytes.
139 int low_bits() const { 149 int low_bits() const {
140 return code_ & 0x7; 150 return code_ & 0x7;
141 } 151 }
142 152
143 // Unfortunately we can't make this private in a struct when initializing 153 // Unfortunately we can't make this private in a struct when initializing
144 // by assignment. 154 // by assignment.
145 int code_; 155 int code_;
156 private:
157 static const int registerCodeByAllocationIndex[kNumAllocatableRegisters];
158 static const int allocationIndexByRegisterCode[kNumRegisters];
146 }; 159 };
147 160
148 const Register rax = { 0 }; 161 const Register rax = { 0 };
149 const Register rcx = { 1 }; 162 const Register rcx = { 1 };
150 const Register rdx = { 2 }; 163 const Register rdx = { 2 };
151 const Register rbx = { 3 }; 164 const Register rbx = { 3 };
152 const Register rsp = { 4 }; 165 const Register rsp = { 4 };
153 const Register rbp = { 5 }; 166 const Register rbp = { 5 };
154 const Register rsi = { 6 }; 167 const Register rsi = { 6 };
155 const Register rdi = { 7 }; 168 const Register rdi = { 7 };
(...skipping 10 matching lines...) Expand all
166 179
167 struct XMMRegister { 180 struct XMMRegister {
168 static const int kNumRegisters = 16; 181 static const int kNumRegisters = 16;
169 static const int kNumAllocatableRegisters = 15; 182 static const int kNumAllocatableRegisters = 15;
170 183
171 static int ToAllocationIndex(XMMRegister reg) { 184 static int ToAllocationIndex(XMMRegister reg) {
172 ASSERT(reg.code() != 0); 185 ASSERT(reg.code() != 0);
173 return reg.code() - 1; 186 return reg.code() - 1;
174 } 187 }
175 188
189 static XMMRegister FromAllocationIndex(int index) {
190 ASSERT(0 <= index && index < kNumAllocatableRegisters);
191 XMMRegister result = { index + 1 };
192 return result;
193 }
194
176 static const char* AllocationIndexToString(int index) { 195 static const char* AllocationIndexToString(int index) {
177 ASSERT(index >= 0 && index < kNumAllocatableRegisters); 196 ASSERT(index >= 0 && index < kNumAllocatableRegisters);
178 const char* const names[] = { 197 const char* const names[] = {
179 "xmm1", 198 "xmm1",
180 "xmm2", 199 "xmm2",
181 "xmm3", 200 "xmm3",
182 "xmm4", 201 "xmm4",
183 "xmm5", 202 "xmm5",
184 "xmm6", 203 "xmm6",
185 "xmm7", 204 "xmm7",
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 static const int kRealPatchReturnSequenceAddressOffset = 2; 566 static const int kRealPatchReturnSequenceAddressOffset = 2;
548 567
549 // The x64 JS return sequence is padded with int3 to make it large 568 // The x64 JS return sequence is padded with int3 to make it large
550 // enough to hold a call instruction when the debugger patches it. 569 // enough to hold a call instruction when the debugger patches it.
551 static const int kCallInstructionLength = 13; 570 static const int kCallInstructionLength = 13;
552 static const int kJSReturnSequenceLength = 13; 571 static const int kJSReturnSequenceLength = 13;
553 572
554 // The debug break slot must be able to contain a call instruction. 573 // The debug break slot must be able to contain a call instruction.
555 static const int kDebugBreakSlotLength = kCallInstructionLength; 574 static const int kDebugBreakSlotLength = kCallInstructionLength;
556 575
576 // One byte opcode for test eax,0xXXXXXXXX.
577 static const byte kTestEaxByte = 0xA9;
557 578
558 // --------------------------------------------------------------------------- 579 // ---------------------------------------------------------------------------
559 // Code generation 580 // Code generation
560 // 581 //
561 // Function names correspond one-to-one to x64 instruction mnemonics. 582 // Function names correspond one-to-one to x64 instruction mnemonics.
562 // Unless specified otherwise, instructions operate on 64-bit operands. 583 // Unless specified otherwise, instructions operate on 64-bit operands.
563 // 584 //
564 // If we need versions of an assembly instruction that operate on different 585 // If we need versions of an assembly instruction that operate on different
565 // width arguments, we add a single-letter suffix specifying the width. 586 // width arguments, we add a single-letter suffix specifying the width.
566 // This is done for the following instructions: mov, cmp, inc, dec, 587 // This is done for the following instructions: mov, cmp, inc, dec,
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 private: 1533 private:
1513 Assembler* assembler_; 1534 Assembler* assembler_;
1514 #ifdef DEBUG 1535 #ifdef DEBUG
1515 int space_before_; 1536 int space_before_;
1516 #endif 1537 #endif
1517 }; 1538 };
1518 1539
1519 } } // namespace v8::internal 1540 } } // namespace v8::internal
1520 1541
1521 #endif // V8_X64_ASSEMBLER_X64_H_ 1542 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/version.cc ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698