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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 return code->is_keyed_store_stub() && | 173 return code->is_keyed_store_stub() && |
174 code->ic_state() == POLYMORPHIC; | 174 code->ic_state() == POLYMORPHIC; |
175 } | 175 } |
176 return false; | 176 return false; |
177 } | 177 } |
178 | 178 |
179 | 179 |
180 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { | 180 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
181 Handle<Object> value = GetInfo(expr->CallFeedbackId()); | 181 Handle<Object> value = GetInfo(expr->CallFeedbackId()); |
182 return value->IsMap() || value->IsAllocationSite() || value->IsJSFunction() || | 182 return value->IsMap() || value->IsAllocationSite() || value->IsJSFunction() || |
183 value->IsSmi(); | 183 value->IsSmi() || |
| 184 (value->IsCode() && Handle<Code>::cast(value)->ic_state() == MONOMORPHIC); |
184 } | 185 } |
185 | 186 |
186 | 187 |
| 188 bool TypeFeedbackOracle::KeyedArrayCallIsHoley(Call* expr) { |
| 189 Handle<Object> value = GetInfo(expr->CallFeedbackId()); |
| 190 Handle<Code> code = Handle<Code>::cast(value); |
| 191 return KeyedArrayCallStub::IsHoley(code); |
| 192 } |
| 193 |
| 194 |
187 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { | 195 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { |
188 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); | 196 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); |
189 return info->IsAllocationSite() || info->IsJSFunction(); | 197 return info->IsAllocationSite() || info->IsJSFunction(); |
190 } | 198 } |
191 | 199 |
192 | 200 |
193 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( | 201 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( |
194 ObjectLiteral::Property* prop) { | 202 ObjectLiteral::Property* prop) { |
195 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); | 203 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); |
196 return map_or_code->IsMap(); | 204 return map_or_code->IsMap(); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 for (int i = 0; i < infos->length(); i++) { | 613 for (int i = 0; i < infos->length(); i++) { |
606 RelocInfo reloc_entry = (*infos)[i]; | 614 RelocInfo reloc_entry = (*infos)[i]; |
607 Address target_address = reloc_entry.target_address(); | 615 Address target_address = reloc_entry.target_address(); |
608 TypeFeedbackId ast_id = | 616 TypeFeedbackId ast_id = |
609 TypeFeedbackId(static_cast<unsigned>((*infos)[i].data())); | 617 TypeFeedbackId(static_cast<unsigned>((*infos)[i].data())); |
610 Code* target = Code::GetCodeFromTargetAddress(target_address); | 618 Code* target = Code::GetCodeFromTargetAddress(target_address); |
611 switch (target->kind()) { | 619 switch (target->kind()) { |
612 case Code::LOAD_IC: | 620 case Code::LOAD_IC: |
613 case Code::STORE_IC: | 621 case Code::STORE_IC: |
614 case Code::CALL_IC: | 622 case Code::CALL_IC: |
615 case Code::KEYED_CALL_IC: | |
616 if (target->ic_state() == MONOMORPHIC) { | 623 if (target->ic_state() == MONOMORPHIC) { |
617 if (target->kind() == Code::CALL_IC && | 624 if (target->kind() == Code::CALL_IC && |
618 target->check_type() != RECEIVER_MAP_CHECK) { | 625 target->check_type() != RECEIVER_MAP_CHECK) { |
619 SetInfo(ast_id, Smi::FromInt(target->check_type())); | 626 SetInfo(ast_id, Smi::FromInt(target->check_type())); |
620 } else { | 627 } else { |
621 Object* map = target->FindFirstMap(); | 628 Object* map = target->FindFirstMap(); |
622 if (map == NULL) { | 629 if (map == NULL) { |
623 SetInfo(ast_id, static_cast<Object*>(target)); | 630 SetInfo(ast_id, static_cast<Object*>(target)); |
624 } else if (!CanRetainOtherContext(Map::cast(map), | 631 } else if (!CanRetainOtherContext(Map::cast(map), |
625 *native_context_)) { | 632 *native_context_)) { |
626 Map* feedback = Map::cast(map)->CurrentMapForDeprecated(); | 633 Map* feedback = Map::cast(map)->CurrentMapForDeprecated(); |
627 if (feedback != NULL) SetInfo(ast_id, feedback); | 634 if (feedback != NULL) SetInfo(ast_id, feedback); |
628 } | 635 } |
629 } | 636 } |
630 } else { | 637 } else { |
631 SetInfo(ast_id, target); | 638 SetInfo(ast_id, target); |
632 } | 639 } |
633 break; | 640 break; |
634 | 641 |
| 642 case Code::KEYED_CALL_IC: |
635 case Code::KEYED_LOAD_IC: | 643 case Code::KEYED_LOAD_IC: |
636 case Code::KEYED_STORE_IC: | 644 case Code::KEYED_STORE_IC: |
637 if (target->ic_state() == MONOMORPHIC || | 645 if (target->ic_state() == MONOMORPHIC || |
638 target->ic_state() == POLYMORPHIC) { | 646 target->ic_state() == POLYMORPHIC) { |
639 SetInfo(ast_id, target); | 647 SetInfo(ast_id, target); |
640 } | 648 } |
641 break; | 649 break; |
642 | 650 |
643 case Code::BINARY_OP_IC: | 651 case Code::BINARY_OP_IC: |
644 case Code::COMPARE_IC: | 652 case Code::COMPARE_IC: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 if (info.IsUninitialized()) return Representation::None(); | 700 if (info.IsUninitialized()) return Representation::None(); |
693 if (info.IsSmi()) return Representation::Smi(); | 701 if (info.IsSmi()) return Representation::Smi(); |
694 if (info.IsInteger32()) return Representation::Integer32(); | 702 if (info.IsInteger32()) return Representation::Integer32(); |
695 if (info.IsDouble()) return Representation::Double(); | 703 if (info.IsDouble()) return Representation::Double(); |
696 if (info.IsNumber()) return Representation::Double(); | 704 if (info.IsNumber()) return Representation::Double(); |
697 return Representation::Tagged(); | 705 return Representation::Tagged(); |
698 } | 706 } |
699 | 707 |
700 | 708 |
701 } } // namespace v8::internal | 709 } } // namespace v8::internal |
OLD | NEW |