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