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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 | 134 |
135 TypeInfo TypeFeedbackOracle::CompareType(CompareOperation* expr, Side side) { | 135 TypeInfo TypeFeedbackOracle::CompareType(CompareOperation* expr, Side side) { |
136 Handle<Object> object = GetElement(map_, expr->position()); | 136 Handle<Object> object = GetElement(map_, expr->position()); |
137 TypeInfo unknown = TypeInfo::Unknown(); | 137 TypeInfo unknown = TypeInfo::Unknown(); |
138 if (!object->IsCode()) return unknown; | 138 if (!object->IsCode()) return unknown; |
139 Handle<Code> code = Handle<Code>::cast(object); | 139 Handle<Code> code = Handle<Code>::cast(object); |
140 if (!code->is_compare_ic_stub()) return unknown; | 140 if (!code->is_compare_ic_stub()) return unknown; |
141 | 141 |
142 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); | 142 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); |
143 switch (state) { | 143 switch (state) { |
144 case CompareIC::UNINITIALIZED: | 144 case CompareIC::UNINITIALIZED: |
Vitaly Repeshko
2010/12/10 13:38:56
Return unknown?
fschneider
2010/12/10 14:32:17
Done.
| |
145 case CompareIC::SMIS: | 145 case CompareIC::SMIS: |
146 return TypeInfo::Smi(); | 146 return TypeInfo::Smi(); |
147 case CompareIC::HEAP_NUMBERS: | 147 case CompareIC::HEAP_NUMBERS: |
148 return TypeInfo::Number(); | 148 return TypeInfo::Number(); |
149 case CompareIC::OBJECTS: | 149 case CompareIC::OBJECTS: |
150 // TODO(kasperl): We really need a type for JS objects here. | 150 // TODO(kasperl): We really need a type for JS objects here. |
151 return TypeInfo::NonPrimitive(); | 151 return TypeInfo::NonPrimitive(); |
152 case CompareIC::GENERIC: | 152 case CompareIC::GENERIC: |
153 default: | 153 default: |
154 return unknown; | 154 return unknown; |
(...skipping 22 matching lines...) Expand all Loading... | |
177 return unknown; | 177 return unknown; |
178 } | 178 } |
179 } else if (code->is_type_recording_binary_op_stub()) { | 179 } else if (code->is_type_recording_binary_op_stub()) { |
180 TRBinaryOpIC::TypeInfo type = static_cast<TRBinaryOpIC::TypeInfo>( | 180 TRBinaryOpIC::TypeInfo type = static_cast<TRBinaryOpIC::TypeInfo>( |
181 code->type_recording_binary_op_type()); | 181 code->type_recording_binary_op_type()); |
182 TRBinaryOpIC::TypeInfo result_type = static_cast<TRBinaryOpIC::TypeInfo>( | 182 TRBinaryOpIC::TypeInfo result_type = static_cast<TRBinaryOpIC::TypeInfo>( |
183 code->type_recording_binary_op_result_type()); | 183 code->type_recording_binary_op_result_type()); |
184 | 184 |
185 switch (type) { | 185 switch (type) { |
186 case TRBinaryOpIC::UNINITIALIZED: | 186 case TRBinaryOpIC::UNINITIALIZED: |
187 // Uninitialized state means never executed. | |
188 return unknown; | |
187 case TRBinaryOpIC::SMI: | 189 case TRBinaryOpIC::SMI: |
188 switch (result_type) { | 190 switch (result_type) { |
189 case TRBinaryOpIC::UNINITIALIZED: | 191 case TRBinaryOpIC::UNINITIALIZED: |
190 case TRBinaryOpIC::SMI: | 192 case TRBinaryOpIC::SMI: |
191 return TypeInfo::Smi(); | 193 return TypeInfo::Smi(); |
192 case TRBinaryOpIC::INT32: | 194 case TRBinaryOpIC::INT32: |
193 return TypeInfo::Integer32(); | 195 return TypeInfo::Integer32(); |
194 case TRBinaryOpIC::HEAP_NUMBER: | 196 case TRBinaryOpIC::HEAP_NUMBER: |
195 return TypeInfo::Double(); | 197 return TypeInfo::Double(); |
196 default: | 198 default: |
(...skipping 19 matching lines...) Expand all Loading... | |
216 | 218 |
217 TypeInfo TypeFeedbackOracle::SwitchType(CaseClause* clause) { | 219 TypeInfo TypeFeedbackOracle::SwitchType(CaseClause* clause) { |
218 Handle<Object> object = GetElement(map_, clause->position()); | 220 Handle<Object> object = GetElement(map_, clause->position()); |
219 TypeInfo unknown = TypeInfo::Unknown(); | 221 TypeInfo unknown = TypeInfo::Unknown(); |
220 if (!object->IsCode()) return unknown; | 222 if (!object->IsCode()) return unknown; |
221 Handle<Code> code = Handle<Code>::cast(object); | 223 Handle<Code> code = Handle<Code>::cast(object); |
222 if (!code->is_compare_ic_stub()) return unknown; | 224 if (!code->is_compare_ic_stub()) return unknown; |
223 | 225 |
224 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); | 226 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); |
225 switch (state) { | 227 switch (state) { |
226 case CompareIC::UNINITIALIZED: | 228 case CompareIC::UNINITIALIZED: |
Vitaly Repeshko
2010/12/10 13:38:56
Same here.
fschneider
2010/12/10 14:32:17
Done.
| |
227 case CompareIC::SMIS: | 229 case CompareIC::SMIS: |
228 return TypeInfo::Smi(); | 230 return TypeInfo::Smi(); |
229 case CompareIC::HEAP_NUMBERS: | 231 case CompareIC::HEAP_NUMBERS: |
230 return TypeInfo::Number(); | 232 return TypeInfo::Number(); |
231 case CompareIC::OBJECTS: | 233 case CompareIC::OBJECTS: |
232 // TODO(kasperl): We really need a type for JS objects here. | 234 // TODO(kasperl): We really need a type for JS objects here. |
233 return TypeInfo::NonPrimitive(); | 235 return TypeInfo::NonPrimitive(); |
234 case CompareIC::GENERIC: | 236 case CompareIC::GENERIC: |
235 default: | 237 default: |
236 return unknown; | 238 return unknown; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 source_positions->Add(position); | 344 source_positions->Add(position); |
343 } | 345 } |
344 } else { | 346 } else { |
345 ASSERT(RelocInfo::IsPosition(mode)); | 347 ASSERT(RelocInfo::IsPosition(mode)); |
346 position = static_cast<int>(info->data()); | 348 position = static_cast<int>(info->data()); |
347 } | 349 } |
348 } | 350 } |
349 } | 351 } |
350 | 352 |
351 } } // namespace v8::internal | 353 } } // namespace v8::internal |
OLD | NEW |