OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 }; | 59 }; |
60 | 60 |
61 | 61 |
62 class UnaryOpStub: public CodeStub { | 62 class UnaryOpStub: public CodeStub { |
63 public: | 63 public: |
64 UnaryOpStub(Token::Value op, | 64 UnaryOpStub(Token::Value op, |
65 UnaryOverwriteMode mode, | 65 UnaryOverwriteMode mode, |
66 UnaryOpIC::TypeInfo operand_type = UnaryOpIC::UNINITIALIZED) | 66 UnaryOpIC::TypeInfo operand_type = UnaryOpIC::UNINITIALIZED) |
67 : op_(op), | 67 : op_(op), |
68 mode_(mode), | 68 mode_(mode), |
69 operand_type_(operand_type), | 69 operand_type_(operand_type) { |
70 name_(NULL) { | |
71 } | 70 } |
72 | 71 |
73 private: | 72 private: |
74 Token::Value op_; | 73 Token::Value op_; |
75 UnaryOverwriteMode mode_; | 74 UnaryOverwriteMode mode_; |
76 | 75 |
77 // Operand type information determined at runtime. | 76 // Operand type information determined at runtime. |
78 UnaryOpIC::TypeInfo operand_type_; | 77 UnaryOpIC::TypeInfo operand_type_; |
79 | 78 |
80 char* name_; | 79 virtual void PrintName(StringStream* stream); |
81 | |
82 virtual const char* GetName(); | |
83 | |
84 #ifdef DEBUG | |
85 void Print() { | |
86 PrintF("UnaryOpStub %d (op %s), (mode %d, runtime_type_info %s)\n", | |
87 MinorKey(), | |
88 Token::String(op_), | |
89 static_cast<int>(mode_), | |
90 UnaryOpIC::GetName(operand_type_)); | |
91 } | |
92 #endif | |
93 | 80 |
94 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {}; | 81 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {}; |
95 class OpBits: public BitField<Token::Value, 1, 7> {}; | 82 class OpBits: public BitField<Token::Value, 1, 7> {}; |
96 class OperandTypeInfoBits: public BitField<UnaryOpIC::TypeInfo, 8, 3> {}; | 83 class OperandTypeInfoBits: public BitField<UnaryOpIC::TypeInfo, 8, 3> {}; |
97 | 84 |
98 Major MajorKey() { return UnaryOp; } | 85 Major MajorKey() { return UnaryOp; } |
99 int MinorKey() { | 86 int MinorKey() { |
100 return ModeBits::encode(mode_) | 87 return ModeBits::encode(mode_) |
101 | OpBits::encode(op_) | 88 | OpBits::encode(op_) |
102 | OperandTypeInfoBits::encode(operand_type_); | 89 | OperandTypeInfoBits::encode(operand_type_); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 129 } |
143 }; | 130 }; |
144 | 131 |
145 | 132 |
146 class BinaryOpStub: public CodeStub { | 133 class BinaryOpStub: public CodeStub { |
147 public: | 134 public: |
148 BinaryOpStub(Token::Value op, OverwriteMode mode) | 135 BinaryOpStub(Token::Value op, OverwriteMode mode) |
149 : op_(op), | 136 : op_(op), |
150 mode_(mode), | 137 mode_(mode), |
151 operands_type_(BinaryOpIC::UNINITIALIZED), | 138 operands_type_(BinaryOpIC::UNINITIALIZED), |
152 result_type_(BinaryOpIC::UNINITIALIZED), | 139 result_type_(BinaryOpIC::UNINITIALIZED) { |
153 name_(NULL) { | |
154 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); | 140 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); |
155 } | 141 } |
156 | 142 |
157 BinaryOpStub( | 143 BinaryOpStub( |
158 int key, | 144 int key, |
159 BinaryOpIC::TypeInfo operands_type, | 145 BinaryOpIC::TypeInfo operands_type, |
160 BinaryOpIC::TypeInfo result_type = BinaryOpIC::UNINITIALIZED) | 146 BinaryOpIC::TypeInfo result_type = BinaryOpIC::UNINITIALIZED) |
161 : op_(OpBits::decode(key)), | 147 : op_(OpBits::decode(key)), |
162 mode_(ModeBits::decode(key)), | 148 mode_(ModeBits::decode(key)), |
163 operands_type_(operands_type), | 149 operands_type_(operands_type), |
164 result_type_(result_type), | 150 result_type_(result_type) { } |
165 name_(NULL) { } | |
166 | 151 |
167 private: | 152 private: |
168 enum SmiCodeGenerateHeapNumberResults { | 153 enum SmiCodeGenerateHeapNumberResults { |
169 ALLOW_HEAPNUMBER_RESULTS, | 154 ALLOW_HEAPNUMBER_RESULTS, |
170 NO_HEAPNUMBER_RESULTS | 155 NO_HEAPNUMBER_RESULTS |
171 }; | 156 }; |
172 | 157 |
173 Token::Value op_; | 158 Token::Value op_; |
174 OverwriteMode mode_; | 159 OverwriteMode mode_; |
175 | 160 |
176 // Operand type information determined at runtime. | 161 // Operand type information determined at runtime. |
177 BinaryOpIC::TypeInfo operands_type_; | 162 BinaryOpIC::TypeInfo operands_type_; |
178 BinaryOpIC::TypeInfo result_type_; | 163 BinaryOpIC::TypeInfo result_type_; |
179 | 164 |
180 char* name_; | 165 virtual void PrintName(StringStream* stream); |
181 | |
182 virtual const char* GetName(); | |
183 | |
184 #ifdef DEBUG | |
185 void Print() { | |
186 PrintF("BinaryOpStub %d (op %s), " | |
187 "(mode %d, runtime_type_info %s)\n", | |
188 MinorKey(), | |
189 Token::String(op_), | |
190 static_cast<int>(mode_), | |
191 BinaryOpIC::GetName(operands_type_)); | |
192 } | |
193 #endif | |
194 | 166 |
195 // Minor key encoding in 15 bits RRRTTTOOOOOOOMM. | 167 // Minor key encoding in 15 bits RRRTTTOOOOOOOMM. |
196 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; | 168 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; |
197 class OpBits: public BitField<Token::Value, 2, 7> {}; | 169 class OpBits: public BitField<Token::Value, 2, 7> {}; |
198 class OperandTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 9, 3> {}; | 170 class OperandTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 9, 3> {}; |
199 class ResultTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 12, 3> {}; | 171 class ResultTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 12, 3> {}; |
200 | 172 |
201 Major MajorKey() { return BinaryOp; } | 173 Major MajorKey() { return BinaryOp; } |
202 int MinorKey() { | 174 int MinorKey() { |
203 return OpBits::encode(op_) | 175 return OpBits::encode(op_) |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 Register dictionary_; | 442 Register dictionary_; |
471 Register result_; | 443 Register result_; |
472 Register index_; | 444 Register index_; |
473 LookupMode mode_; | 445 LookupMode mode_; |
474 }; | 446 }; |
475 | 447 |
476 | 448 |
477 } } // namespace v8::internal | 449 } } // namespace v8::internal |
478 | 450 |
479 #endif // V8_X64_CODE_STUBS_X64_H_ | 451 #endif // V8_X64_CODE_STUBS_X64_H_ |
OLD | NEW |