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

Side by Side Diff: runtime/vm/constants_ia32.h

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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 | « runtime/vm/constants_dbc.h ('k') | runtime/vm/constants_x64.h » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef RUNTIME_VM_CONSTANTS_IA32_H_ 5 #ifndef RUNTIME_VM_CONSTANTS_IA32_H_
6 #define RUNTIME_VM_CONSTANTS_IA32_H_ 6 #define RUNTIME_VM_CONSTANTS_IA32_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 enum Register { 12 enum Register {
13 EAX = 0, 13 EAX = 0,
14 ECX = 1, 14 ECX = 1,
15 EDX = 2, 15 EDX = 2,
16 EBX = 3, 16 EBX = 3,
17 ESP = 4, 17 ESP = 4,
18 EBP = 5, 18 EBP = 5,
19 ESI = 6, 19 ESI = 6,
20 EDI = 7, 20 EDI = 7,
21 kNumberOfCpuRegisters = 8, 21 kNumberOfCpuRegisters = 8,
22 kNoRegister = -1, // Signals an illegal register. 22 kNoRegister = -1, // Signals an illegal register.
23 }; 23 };
24 24
25
26 enum ByteRegister { 25 enum ByteRegister {
27 AL = 0, 26 AL = 0,
28 CL = 1, 27 CL = 1,
29 DL = 2, 28 DL = 2,
30 BL = 3, 29 BL = 3,
31 AH = 4, 30 AH = 4,
32 CH = 5, 31 CH = 5,
33 DH = 6, 32 DH = 6,
34 BH = 7, 33 BH = 7,
35 kNoByteRegister = -1 // Signals an illegal register. 34 kNoByteRegister = -1 // Signals an illegal register.
36 }; 35 };
37 36
38
39 enum XmmRegister { 37 enum XmmRegister {
40 XMM0 = 0, 38 XMM0 = 0,
41 XMM1 = 1, 39 XMM1 = 1,
42 XMM2 = 2, 40 XMM2 = 2,
43 XMM3 = 3, 41 XMM3 = 3,
44 XMM4 = 4, 42 XMM4 = 4,
45 XMM5 = 5, 43 XMM5 = 5,
46 XMM6 = 6, 44 XMM6 = 6,
47 XMM7 = 7, 45 XMM7 = 7,
48 kNumberOfXmmRegisters = 8, 46 kNumberOfXmmRegisters = 8,
49 kNoXmmRegister = -1 // Signals an illegal register. 47 kNoXmmRegister = -1 // Signals an illegal register.
50 }; 48 };
51 49
52
53 // Architecture independent aliases. 50 // Architecture independent aliases.
54 typedef XmmRegister FpuRegister; 51 typedef XmmRegister FpuRegister;
55 const FpuRegister FpuTMP = XMM0; 52 const FpuRegister FpuTMP = XMM0;
56 const int kNumberOfFpuRegisters = kNumberOfXmmRegisters; 53 const int kNumberOfFpuRegisters = kNumberOfXmmRegisters;
57 const FpuRegister kNoFpuRegister = kNoXmmRegister; 54 const FpuRegister kNoFpuRegister = kNoXmmRegister;
58 55
59
60 // Register aliases. 56 // Register aliases.
61 const Register TMP = kNoRegister; // No scratch register used by assembler. 57 const Register TMP = kNoRegister; // No scratch register used by assembler.
62 const Register TMP2 = kNoRegister; // No second assembler scratch register. 58 const Register TMP2 = kNoRegister; // No second assembler scratch register.
63 const Register CTX = EDI; // Location of current context at method entry. 59 const Register CTX = EDI; // Location of current context at method entry.
64 const Register CODE_REG = EDI; 60 const Register CODE_REG = EDI;
65 const Register PP = kNoRegister; // No object pool pointer. 61 const Register PP = kNoRegister; // No object pool pointer.
66 const Register SPREG = ESP; // Stack pointer register. 62 const Register SPREG = ESP; // Stack pointer register.
67 const Register FPREG = EBP; // Frame pointer register. 63 const Register FPREG = EBP; // Frame pointer register.
68 const Register ICREG = ECX; // IC data register. 64 const Register ICREG = ECX; // IC data register.
69 const Register ARGS_DESC_REG = EDX; // Arguments descriptor register. 65 const Register ARGS_DESC_REG = EDX; // Arguments descriptor register.
70 const Register THR = ESI; // Caches current thread in generated code. 66 const Register THR = ESI; // Caches current thread in generated code.
71 const Register CALLEE_SAVED_TEMP = EBX; 67 const Register CALLEE_SAVED_TEMP = EBX;
72 const Register CALLEE_SAVED_TEMP2 = EDI; 68 const Register CALLEE_SAVED_TEMP2 = EDI;
73 69
74 // Exception object is passed in this register to the catch handlers when an 70 // Exception object is passed in this register to the catch handlers when an
75 // exception is thrown. 71 // exception is thrown.
76 const Register kExceptionObjectReg = EAX; 72 const Register kExceptionObjectReg = EAX;
77 73
78 // Stack trace object is passed in this register to the catch handlers when 74 // Stack trace object is passed in this register to the catch handlers when
79 // an exception is thrown. 75 // an exception is thrown.
80 const Register kStackTraceObjectReg = EDX; 76 const Register kStackTraceObjectReg = EDX;
81 77
82
83 typedef uint32_t RegList; 78 typedef uint32_t RegList;
84 const RegList kAllCpuRegistersList = 0xFF; 79 const RegList kAllCpuRegistersList = 0xFF;
85 80
86 const intptr_t kReservedCpuRegisters = (1 << SPREG) | (1 << FPREG) | (1 << THR); 81 const intptr_t kReservedCpuRegisters = (1 << SPREG) | (1 << FPREG) | (1 << THR);
87 // CPU registers available to Dart allocator. 82 // CPU registers available to Dart allocator.
88 const RegList kDartAvailableCpuRegs = 83 const RegList kDartAvailableCpuRegs =
89 kAllCpuRegistersList & ~kReservedCpuRegisters; 84 kAllCpuRegistersList & ~kReservedCpuRegisters;
90 85
91
92 enum ScaleFactor { 86 enum ScaleFactor {
93 TIMES_1 = 0, 87 TIMES_1 = 0,
94 TIMES_2 = 1, 88 TIMES_2 = 1,
95 TIMES_4 = 2, 89 TIMES_4 = 2,
96 TIMES_8 = 3, 90 TIMES_8 = 3,
97 TIMES_16 = 4, 91 TIMES_16 = 4,
98 TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 92 TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1
99 }; 93 };
100 94
101
102 enum Condition { 95 enum Condition {
103 OVERFLOW = 0, 96 OVERFLOW = 0,
104 NO_OVERFLOW = 1, 97 NO_OVERFLOW = 1,
105 BELOW = 2, 98 BELOW = 2,
106 ABOVE_EQUAL = 3, 99 ABOVE_EQUAL = 3,
107 EQUAL = 4, 100 EQUAL = 4,
108 NOT_EQUAL = 5, 101 NOT_EQUAL = 5,
109 BELOW_EQUAL = 6, 102 BELOW_EQUAL = 6,
110 ABOVE = 7, 103 ABOVE = 7,
111 SIGN = 8, 104 SIGN = 8,
112 NOT_SIGN = 9, 105 NOT_SIGN = 9,
113 PARITY_EVEN = 10, 106 PARITY_EVEN = 10,
114 PARITY_ODD = 11, 107 PARITY_ODD = 11,
115 LESS = 12, 108 LESS = 12,
116 GREATER_EQUAL = 13, 109 GREATER_EQUAL = 13,
117 LESS_EQUAL = 14, 110 LESS_EQUAL = 14,
118 GREATER = 15, 111 GREATER = 15,
119 112
120 ZERO = EQUAL, 113 ZERO = EQUAL,
121 NOT_ZERO = NOT_EQUAL, 114 NOT_ZERO = NOT_EQUAL,
122 NEGATIVE = SIGN, 115 NEGATIVE = SIGN,
123 POSITIVE = NOT_SIGN, 116 POSITIVE = NOT_SIGN,
124 CARRY = BELOW, 117 CARRY = BELOW,
125 NOT_CARRY = ABOVE_EQUAL, 118 NOT_CARRY = ABOVE_EQUAL,
126 119
127 INVALID_CONDITION = 16 120 INVALID_CONDITION = 16
128 }; 121 };
129 122
130
131 class Instr { 123 class Instr {
132 public: 124 public:
133 static const uint8_t kHltInstruction = 0xF4; 125 static const uint8_t kHltInstruction = 0xF4;
134 // We prefer not to use the int3 instruction since it conflicts with gdb. 126 // We prefer not to use the int3 instruction since it conflicts with gdb.
135 static const uint8_t kBreakPointInstruction = kHltInstruction; 127 static const uint8_t kBreakPointInstruction = kHltInstruction;
136 static const int kBreakPointInstructionSize = 1; 128 static const int kBreakPointInstructionSize = 1;
137 129
138 bool IsBreakPoint() { 130 bool IsBreakPoint() {
139 ASSERT(kBreakPointInstructionSize == 1); 131 ASSERT(kBreakPointInstructionSize == 1);
140 return (*reinterpret_cast<const uint8_t*>(this)) == kBreakPointInstruction; 132 return (*reinterpret_cast<const uint8_t*>(this)) == kBreakPointInstruction;
141 } 133 }
142 134
143 // Instructions are read out of a code stream. The only way to get a 135 // Instructions are read out of a code stream. The only way to get a
144 // reference to an instruction is to convert a pointer. There is no way 136 // reference to an instruction is to convert a pointer. There is no way
145 // to allocate or create instances of class Instr. 137 // to allocate or create instances of class Instr.
146 // Use the At(pc) function to create references to Instr. 138 // Use the At(pc) function to create references to Instr.
147 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } 139 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); }
148 140
149 private: 141 private:
150 DISALLOW_ALLOCATION(); 142 DISALLOW_ALLOCATION();
151 // We need to prevent the creation of instances of class Instr. 143 // We need to prevent the creation of instances of class Instr.
152 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); 144 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr);
153 }; 145 };
154 146
155
156 // The largest multibyte nop we will emit. This could go up to 15 if it 147 // The largest multibyte nop we will emit. This could go up to 15 if it
157 // becomes important to us. 148 // becomes important to us.
158 const int MAX_NOP_SIZE = 8; 149 const int MAX_NOP_SIZE = 8;
159 150
160 } // namespace dart 151 } // namespace dart
161 152
162 #endif // RUNTIME_VM_CONSTANTS_IA32_H_ 153 #endif // RUNTIME_VM_CONSTANTS_IA32_H_
OLDNEW
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/constants_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698