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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); | 222 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); |
223 switch (state) { | 223 switch (state) { |
224 case CompareIC::UNINITIALIZED: | 224 case CompareIC::UNINITIALIZED: |
225 // Uninitialized means never executed. | 225 // Uninitialized means never executed. |
226 // TODO(fschneider): Introduce a separate value for never-executed ICs. | 226 // TODO(fschneider): Introduce a separate value for never-executed ICs. |
227 return unknown; | 227 return unknown; |
228 case CompareIC::SMIS: | 228 case CompareIC::SMIS: |
229 return TypeInfo::Smi(); | 229 return TypeInfo::Smi(); |
230 case CompareIC::HEAP_NUMBERS: | 230 case CompareIC::HEAP_NUMBERS: |
231 return TypeInfo::Number(); | 231 return TypeInfo::Number(); |
| 232 case CompareIC::SYMBOLS: |
| 233 case CompareIC::STRINGS: |
| 234 return TypeInfo::String(); |
232 case CompareIC::OBJECTS: | 235 case CompareIC::OBJECTS: |
233 // TODO(kasperl): We really need a type for JS objects here. | 236 // TODO(kasperl): We really need a type for JS objects here. |
234 return TypeInfo::NonPrimitive(); | 237 return TypeInfo::NonPrimitive(); |
235 case CompareIC::GENERIC: | 238 case CompareIC::GENERIC: |
236 default: | 239 default: |
237 return unknown; | 240 return unknown; |
238 } | 241 } |
239 } | 242 } |
240 | 243 |
241 | 244 |
| 245 bool TypeFeedbackOracle::IsSymbolCompare(CompareOperation* expr) { |
| 246 Handle<Object> object = GetInfo(expr->id()); |
| 247 if (!object->IsCode()) return false; |
| 248 Handle<Code> code = Handle<Code>::cast(object); |
| 249 if (!code->is_compare_ic_stub()) return false; |
| 250 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); |
| 251 return state == CompareIC::SYMBOLS; |
| 252 } |
| 253 |
| 254 |
242 TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) { | 255 TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) { |
243 Handle<Object> object = GetInfo(expr->id()); | 256 Handle<Object> object = GetInfo(expr->id()); |
244 TypeInfo unknown = TypeInfo::Unknown(); | 257 TypeInfo unknown = TypeInfo::Unknown(); |
245 if (!object->IsCode()) return unknown; | 258 if (!object->IsCode()) return unknown; |
246 Handle<Code> code = Handle<Code>::cast(object); | 259 Handle<Code> code = Handle<Code>::cast(object); |
247 ASSERT(code->is_type_recording_unary_op_stub()); | 260 ASSERT(code->is_type_recording_unary_op_stub()); |
248 TRUnaryOpIC::TypeInfo type = static_cast<TRUnaryOpIC::TypeInfo>( | 261 TRUnaryOpIC::TypeInfo type = static_cast<TRUnaryOpIC::TypeInfo>( |
249 code->type_recording_unary_op_type()); | 262 code->type_recording_unary_op_type()); |
250 switch (type) { | 263 switch (type) { |
251 case TRUnaryOpIC::SMI: | 264 case TRUnaryOpIC::SMI: |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 static_cast<int>(info->pc() - code->instruction_start())); | 496 static_cast<int>(info->pc() - code->instruction_start())); |
484 ASSERT(ast_ids->length() == 0 || | 497 ASSERT(ast_ids->length() == 0 || |
485 (*ast_ids)[ast_ids->length()-1] != | 498 (*ast_ids)[ast_ids->length()-1] != |
486 static_cast<unsigned>(info->data())); | 499 static_cast<unsigned>(info->data())); |
487 ast_ids->Add(static_cast<unsigned>(info->data())); | 500 ast_ids->Add(static_cast<unsigned>(info->data())); |
488 } | 501 } |
489 } | 502 } |
490 } | 503 } |
491 | 504 |
492 } } // namespace v8::internal | 505 } } // namespace v8::internal |
OLD | NEW |