OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 | 71 |
72 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { | 72 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { |
73 int entry = dictionary_->FindEntry(ast_id); | 73 int entry = dictionary_->FindEntry(ast_id); |
74 return entry != UnseededNumberDictionary::kNotFound | 74 return entry != UnseededNumberDictionary::kNotFound |
75 ? Handle<Object>(dictionary_->ValueAt(entry)) | 75 ? Handle<Object>(dictionary_->ValueAt(entry)) |
76 : Handle<Object>::cast(isolate_->factory()->undefined_value()); | 76 : Handle<Object>::cast(isolate_->factory()->undefined_value()); |
77 } | 77 } |
78 | 78 |
79 | 79 |
| 80 bool TypeFeedbackOracle::LoadIsUninitialized(Property* expr) { |
| 81 Handle<Object> map_or_code = GetInfo(expr->id()); |
| 82 if (map_or_code->IsMap()) return false; |
| 83 if (map_or_code->IsCode()) { |
| 84 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 85 return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED; |
| 86 } |
| 87 return false; |
| 88 } |
| 89 |
| 90 |
80 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { | 91 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { |
81 Handle<Object> map_or_code = GetInfo(expr->id()); | 92 Handle<Object> map_or_code = GetInfo(expr->id()); |
82 if (map_or_code->IsMap()) return true; | 93 if (map_or_code->IsMap()) return true; |
83 if (map_or_code->IsCode()) { | 94 if (map_or_code->IsCode()) { |
84 Handle<Code> code = Handle<Code>::cast(map_or_code); | 95 Handle<Code> code = Handle<Code>::cast(map_or_code); |
85 return code->is_keyed_load_stub() && | 96 return code->is_keyed_load_stub() && |
86 code->ic_state() == MONOMORPHIC && | 97 code->ic_state() == MONOMORPHIC && |
87 Code::ExtractTypeFromFlags(code->flags()) == NORMAL && | 98 Code::ExtractTypeFromFlags(code->flags()) == NORMAL && |
88 code->FindFirstMap() != NULL && | 99 code->FindFirstMap() != NULL && |
89 !CanRetainOtherContext(code->FindFirstMap(), *global_context_); | 100 !CanRetainOtherContext(code->FindFirstMap(), *global_context_); |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 SetInfo(ast_id, Smi::FromInt(target->check_type())); | 653 SetInfo(ast_id, Smi::FromInt(target->check_type())); |
643 } else { | 654 } else { |
644 Object* map = target->FindFirstMap(); | 655 Object* map = target->FindFirstMap(); |
645 if (map == NULL) { | 656 if (map == NULL) { |
646 SetInfo(ast_id, static_cast<Object*>(target)); | 657 SetInfo(ast_id, static_cast<Object*>(target)); |
647 } else if (!CanRetainOtherContext(Map::cast(map), | 658 } else if (!CanRetainOtherContext(Map::cast(map), |
648 *global_context_)) { | 659 *global_context_)) { |
649 SetInfo(ast_id, map); | 660 SetInfo(ast_id, map); |
650 } | 661 } |
651 } | 662 } |
652 } else if (target->ic_state() == MEGAMORPHIC) { | 663 } else { |
653 SetInfo(ast_id, target); | 664 SetInfo(ast_id, target); |
654 } | 665 } |
655 break; | 666 break; |
656 | 667 |
657 case Code::KEYED_LOAD_IC: | 668 case Code::KEYED_LOAD_IC: |
658 case Code::KEYED_STORE_IC: | 669 case Code::KEYED_STORE_IC: |
659 if (target->ic_state() == MONOMORPHIC || | 670 if (target->ic_state() == MONOMORPHIC || |
660 target->ic_state() == MEGAMORPHIC) { | 671 target->ic_state() == MEGAMORPHIC) { |
661 SetInfo(ast_id, target); | 672 SetInfo(ast_id, target); |
662 } | 673 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 USE(maybe_result); | 711 USE(maybe_result); |
701 #ifdef DEBUG | 712 #ifdef DEBUG |
702 Object* result = NULL; | 713 Object* result = NULL; |
703 // Dictionary has been allocated with sufficient size for all elements. | 714 // Dictionary has been allocated with sufficient size for all elements. |
704 ASSERT(maybe_result->ToObject(&result)); | 715 ASSERT(maybe_result->ToObject(&result)); |
705 ASSERT(*dictionary_ == result); | 716 ASSERT(*dictionary_ == result); |
706 #endif | 717 #endif |
707 } | 718 } |
708 | 719 |
709 } } // namespace v8::internal | 720 } } // namespace v8::internal |
OLD | NEW |