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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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: |
145 // Uninitialized state means never executed. | |
146 return unknown; | |
147 case CompareIC::SMIS: | 145 case CompareIC::SMIS: |
148 return TypeInfo::Smi(); | 146 return TypeInfo::Smi(); |
149 case CompareIC::HEAP_NUMBERS: | 147 case CompareIC::HEAP_NUMBERS: |
150 return TypeInfo::Number(); | 148 return TypeInfo::Number(); |
151 case CompareIC::OBJECTS: | 149 case CompareIC::OBJECTS: |
152 // TODO(kasperl): We really need a type for JS objects here. | 150 // TODO(kasperl): We really need a type for JS objects here. |
153 return TypeInfo::NonPrimitive(); | 151 return TypeInfo::NonPrimitive(); |
154 case CompareIC::GENERIC: | 152 case CompareIC::GENERIC: |
155 default: | 153 default: |
156 return unknown; | 154 return unknown; |
(...skipping 22 matching lines...) Expand all Loading... |
179 return unknown; | 177 return unknown; |
180 } | 178 } |
181 } else if (code->is_type_recording_binary_op_stub()) { | 179 } else if (code->is_type_recording_binary_op_stub()) { |
182 TRBinaryOpIC::TypeInfo type = static_cast<TRBinaryOpIC::TypeInfo>( | 180 TRBinaryOpIC::TypeInfo type = static_cast<TRBinaryOpIC::TypeInfo>( |
183 code->type_recording_binary_op_type()); | 181 code->type_recording_binary_op_type()); |
184 TRBinaryOpIC::TypeInfo result_type = static_cast<TRBinaryOpIC::TypeInfo>( | 182 TRBinaryOpIC::TypeInfo result_type = static_cast<TRBinaryOpIC::TypeInfo>( |
185 code->type_recording_binary_op_result_type()); | 183 code->type_recording_binary_op_result_type()); |
186 | 184 |
187 switch (type) { | 185 switch (type) { |
188 case TRBinaryOpIC::UNINITIALIZED: | 186 case TRBinaryOpIC::UNINITIALIZED: |
189 // Uninitialized state means never executed. | |
190 return unknown; | |
191 case TRBinaryOpIC::SMI: | 187 case TRBinaryOpIC::SMI: |
192 switch (result_type) { | 188 switch (result_type) { |
193 case TRBinaryOpIC::UNINITIALIZED: | 189 case TRBinaryOpIC::UNINITIALIZED: |
194 case TRBinaryOpIC::SMI: | 190 case TRBinaryOpIC::SMI: |
195 return TypeInfo::Smi(); | 191 return TypeInfo::Smi(); |
196 case TRBinaryOpIC::INT32: | 192 case TRBinaryOpIC::INT32: |
197 return TypeInfo::Integer32(); | 193 return TypeInfo::Integer32(); |
198 case TRBinaryOpIC::HEAP_NUMBER: | 194 case TRBinaryOpIC::HEAP_NUMBER: |
199 return TypeInfo::Double(); | 195 return TypeInfo::Double(); |
200 default: | 196 default: |
(...skipping 20 matching lines...) Expand all Loading... |
221 TypeInfo TypeFeedbackOracle::SwitchType(CaseClause* clause) { | 217 TypeInfo TypeFeedbackOracle::SwitchType(CaseClause* clause) { |
222 Handle<Object> object = GetElement(map_, clause->position()); | 218 Handle<Object> object = GetElement(map_, clause->position()); |
223 TypeInfo unknown = TypeInfo::Unknown(); | 219 TypeInfo unknown = TypeInfo::Unknown(); |
224 if (!object->IsCode()) return unknown; | 220 if (!object->IsCode()) return unknown; |
225 Handle<Code> code = Handle<Code>::cast(object); | 221 Handle<Code> code = Handle<Code>::cast(object); |
226 if (!code->is_compare_ic_stub()) return unknown; | 222 if (!code->is_compare_ic_stub()) return unknown; |
227 | 223 |
228 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); | 224 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); |
229 switch (state) { | 225 switch (state) { |
230 case CompareIC::UNINITIALIZED: | 226 case CompareIC::UNINITIALIZED: |
231 // Uninitialized state means never executed. | |
232 return unknown; | |
233 case CompareIC::SMIS: | 227 case CompareIC::SMIS: |
234 return TypeInfo::Smi(); | 228 return TypeInfo::Smi(); |
235 case CompareIC::HEAP_NUMBERS: | 229 case CompareIC::HEAP_NUMBERS: |
236 return TypeInfo::Number(); | 230 return TypeInfo::Number(); |
237 case CompareIC::OBJECTS: | 231 case CompareIC::OBJECTS: |
238 // TODO(kasperl): We really need a type for JS objects here. | 232 // TODO(kasperl): We really need a type for JS objects here. |
239 return TypeInfo::NonPrimitive(); | 233 return TypeInfo::NonPrimitive(); |
240 case CompareIC::GENERIC: | 234 case CompareIC::GENERIC: |
241 default: | 235 default: |
242 return unknown; | 236 return unknown; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 source_positions->Add(position); | 342 source_positions->Add(position); |
349 } | 343 } |
350 } else { | 344 } else { |
351 ASSERT(RelocInfo::IsPosition(mode)); | 345 ASSERT(RelocInfo::IsPosition(mode)); |
352 position = static_cast<int>(info->data()); | 346 position = static_cast<int>(info->data()); |
353 } | 347 } |
354 } | 348 } |
355 } | 349 } |
356 | 350 |
357 } } // namespace v8::internal | 351 } } // namespace v8::internal |
OLD | NEW |