| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // Uninitialized means never executed. | 252 // Uninitialized means never executed. |
| 253 return TypeInfo::Uninitialized(); | 253 return TypeInfo::Uninitialized(); |
| 254 case CompareIC::SMIS: | 254 case CompareIC::SMIS: |
| 255 return TypeInfo::Smi(); | 255 return TypeInfo::Smi(); |
| 256 case CompareIC::HEAP_NUMBERS: | 256 case CompareIC::HEAP_NUMBERS: |
| 257 return TypeInfo::Number(); | 257 return TypeInfo::Number(); |
| 258 case CompareIC::SYMBOLS: | 258 case CompareIC::SYMBOLS: |
| 259 case CompareIC::STRINGS: | 259 case CompareIC::STRINGS: |
| 260 return TypeInfo::String(); | 260 return TypeInfo::String(); |
| 261 case CompareIC::OBJECTS: | 261 case CompareIC::OBJECTS: |
| 262 case CompareIC::KNOWN_OBJECTS: | |
| 263 // TODO(kasperl): We really need a type for JS objects here. | 262 // TODO(kasperl): We really need a type for JS objects here. |
| 264 return TypeInfo::NonPrimitive(); | 263 return TypeInfo::NonPrimitive(); |
| 265 case CompareIC::GENERIC: | 264 case CompareIC::GENERIC: |
| 266 default: | 265 default: |
| 267 return unknown; | 266 return unknown; |
| 268 } | 267 } |
| 269 } | 268 } |
| 270 | 269 |
| 271 | 270 |
| 272 bool TypeFeedbackOracle::IsSymbolCompare(CompareOperation* expr) { | 271 bool TypeFeedbackOracle::IsSymbolCompare(CompareOperation* expr) { |
| 273 Handle<Object> object = GetInfo(expr->id()); | 272 Handle<Object> object = GetInfo(expr->id()); |
| 274 if (!object->IsCode()) return false; | 273 if (!object->IsCode()) return false; |
| 275 Handle<Code> code = Handle<Code>::cast(object); | 274 Handle<Code> code = Handle<Code>::cast(object); |
| 276 if (!code->is_compare_ic_stub()) return false; | 275 if (!code->is_compare_ic_stub()) return false; |
| 277 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); | 276 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); |
| 278 return state == CompareIC::SYMBOLS; | 277 return state == CompareIC::SYMBOLS; |
| 279 } | 278 } |
| 280 | 279 |
| 281 | 280 |
| 282 Handle<Map> TypeFeedbackOracle::GetCompareMap(CompareOperation* expr) { | |
| 283 Handle<Object> object = GetInfo(expr->id()); | |
| 284 if (!object->IsCode()) return Handle<Map>::null(); | |
| 285 Handle<Code> code = Handle<Code>::cast(object); | |
| 286 if (!code->is_compare_ic_stub()) return Handle<Map>::null(); | |
| 287 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); | |
| 288 if (state != CompareIC::KNOWN_OBJECTS) { | |
| 289 return Handle<Map>::null(); | |
| 290 } | |
| 291 return Handle<Map>(code->FindFirstMap()); | |
| 292 } | |
| 293 | |
| 294 | |
| 295 TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) { | 281 TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) { |
| 296 Handle<Object> object = GetInfo(expr->id()); | 282 Handle<Object> object = GetInfo(expr->id()); |
| 297 TypeInfo unknown = TypeInfo::Unknown(); | 283 TypeInfo unknown = TypeInfo::Unknown(); |
| 298 if (!object->IsCode()) return unknown; | 284 if (!object->IsCode()) return unknown; |
| 299 Handle<Code> code = Handle<Code>::cast(object); | 285 Handle<Code> code = Handle<Code>::cast(object); |
| 300 ASSERT(code->is_unary_op_stub()); | 286 ASSERT(code->is_unary_op_stub()); |
| 301 UnaryOpIC::TypeInfo type = static_cast<UnaryOpIC::TypeInfo>( | 287 UnaryOpIC::TypeInfo type = static_cast<UnaryOpIC::TypeInfo>( |
| 302 code->unary_op_type()); | 288 code->unary_op_type()); |
| 303 switch (type) { | 289 switch (type) { |
| 304 case UnaryOpIC::SMI: | 290 case UnaryOpIC::SMI: |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 return unknown; | 360 return unknown; |
| 375 case CompareIC::SMIS: | 361 case CompareIC::SMIS: |
| 376 return TypeInfo::Smi(); | 362 return TypeInfo::Smi(); |
| 377 case CompareIC::STRINGS: | 363 case CompareIC::STRINGS: |
| 378 return TypeInfo::String(); | 364 return TypeInfo::String(); |
| 379 case CompareIC::SYMBOLS: | 365 case CompareIC::SYMBOLS: |
| 380 return TypeInfo::Symbol(); | 366 return TypeInfo::Symbol(); |
| 381 case CompareIC::HEAP_NUMBERS: | 367 case CompareIC::HEAP_NUMBERS: |
| 382 return TypeInfo::Number(); | 368 return TypeInfo::Number(); |
| 383 case CompareIC::OBJECTS: | 369 case CompareIC::OBJECTS: |
| 384 case CompareIC::KNOWN_OBJECTS: | |
| 385 // TODO(kasperl): We really need a type for JS objects here. | 370 // TODO(kasperl): We really need a type for JS objects here. |
| 386 return TypeInfo::NonPrimitive(); | 371 return TypeInfo::NonPrimitive(); |
| 387 case CompareIC::GENERIC: | 372 case CompareIC::GENERIC: |
| 388 default: | 373 default: |
| 389 return unknown; | 374 return unknown; |
| 390 } | 375 } |
| 391 } | 376 } |
| 392 | 377 |
| 393 | 378 |
| 394 TypeInfo TypeFeedbackOracle::IncrementType(CountOperation* expr) { | 379 TypeInfo TypeFeedbackOracle::IncrementType(CountOperation* expr) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 USE(maybe_result); | 569 USE(maybe_result); |
| 585 #ifdef DEBUG | 570 #ifdef DEBUG |
| 586 Object* result = NULL; | 571 Object* result = NULL; |
| 587 // Dictionary has been allocated with sufficient size for all elements. | 572 // Dictionary has been allocated with sufficient size for all elements. |
| 588 ASSERT(maybe_result->ToObject(&result)); | 573 ASSERT(maybe_result->ToObject(&result)); |
| 589 ASSERT(*dictionary_ == result); | 574 ASSERT(*dictionary_ == result); |
| 590 #endif | 575 #endif |
| 591 } | 576 } |
| 592 | 577 |
| 593 } } // namespace v8::internal | 578 } } // namespace v8::internal |
| OLD | NEW |