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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 TypeHandleList types; | 673 TypeHandleList types; |
674 CodeHandleList handlers; | 674 CodeHandleList handlers; |
675 | 675 |
676 TargetTypes(&types); | 676 TargetTypes(&types); |
677 int number_of_types = types.length(); | 677 int number_of_types = types.length(); |
678 int deprecated_types = 0; | 678 int deprecated_types = 0; |
679 int handler_to_overwrite = -1; | 679 int handler_to_overwrite = -1; |
680 | 680 |
681 for (int i = 0; i < number_of_types; i++) { | 681 for (int i = 0; i < number_of_types; i++) { |
682 Handle<HeapType> current_type = types.at(i); | 682 Handle<HeapType> current_type = types.at(i); |
683 if (current_type->IsClass() && current_type->AsClass()->is_deprecated()) { | 683 if (current_type->IsClass() && |
| 684 current_type->AsClass()->Map()->is_deprecated()) { |
684 // Filter out deprecated maps to ensure their instances get migrated. | 685 // Filter out deprecated maps to ensure their instances get migrated. |
685 ++deprecated_types; | 686 ++deprecated_types; |
686 } else if (type->NowIs(current_type)) { | 687 } else if (type->NowIs(current_type)) { |
687 // If the receiver type is already in the polymorphic IC, this indicates | 688 // If the receiver type is already in the polymorphic IC, this indicates |
688 // there was a prototoype chain failure. In that case, just overwrite the | 689 // there was a prototoype chain failure. In that case, just overwrite the |
689 // handler. | 690 // handler. |
690 handler_to_overwrite = i; | 691 handler_to_overwrite = i; |
691 } else if (handler_to_overwrite == -1 && | 692 } else if (handler_to_overwrite == -1 && |
692 current_type->IsClass() && | 693 current_type->IsClass() && |
693 type->IsClass() && | 694 type->IsClass() && |
694 IsTransitionOfMonomorphicTarget(*current_type->AsClass(), | 695 IsTransitionOfMonomorphicTarget(*current_type->AsClass()->Map(), |
695 *type->AsClass())) { | 696 *type->AsClass()->Map())) { |
696 handler_to_overwrite = i; | 697 handler_to_overwrite = i; |
697 } | 698 } |
698 } | 699 } |
699 | 700 |
700 int number_of_valid_types = | 701 int number_of_valid_types = |
701 number_of_types - deprecated_types - (handler_to_overwrite != -1); | 702 number_of_types - deprecated_types - (handler_to_overwrite != -1); |
702 | 703 |
703 if (number_of_valid_types >= 4) return false; | 704 if (number_of_valid_types >= 4) return false; |
704 if (number_of_types == 0) return false; | 705 if (number_of_types == 0) return false; |
705 if (!target()->FindHandlers(&handlers, types.length())) return false; | 706 if (!target()->FindHandlers(&handlers, types.length())) return false; |
(...skipping 21 matching lines...) Expand all Loading... |
727 ? HeapType::Constant(Handle<JSGlobalObject>::cast(object), isolate) | 728 ? HeapType::Constant(Handle<JSGlobalObject>::cast(object), isolate) |
728 : HeapType::NowOf(object, isolate); | 729 : HeapType::NowOf(object, isolate); |
729 } | 730 } |
730 | 731 |
731 | 732 |
732 Handle<Map> IC::TypeToMap(HeapType* type, Isolate* isolate) { | 733 Handle<Map> IC::TypeToMap(HeapType* type, Isolate* isolate) { |
733 if (type->Is(HeapType::Number())) | 734 if (type->Is(HeapType::Number())) |
734 return isolate->factory()->heap_number_map(); | 735 return isolate->factory()->heap_number_map(); |
735 if (type->Is(HeapType::Boolean())) return isolate->factory()->boolean_map(); | 736 if (type->Is(HeapType::Boolean())) return isolate->factory()->boolean_map(); |
736 if (type->IsConstant()) { | 737 if (type->IsConstant()) { |
737 return handle(Handle<JSGlobalObject>::cast(type->AsConstant())->map()); | 738 return handle( |
| 739 Handle<JSGlobalObject>::cast(type->AsConstant()->Value())->map()); |
738 } | 740 } |
739 ASSERT(type->IsClass()); | 741 ASSERT(type->IsClass()); |
740 return type->AsClass(); | 742 return type->AsClass()->Map(); |
741 } | 743 } |
742 | 744 |
743 | 745 |
744 template <class T> | 746 template <class T> |
745 typename T::TypeHandle IC::MapToType(Handle<Map> map, | 747 typename T::TypeHandle IC::MapToType(Handle<Map> map, |
746 typename T::Region* region) { | 748 typename T::Region* region) { |
747 if (map->instance_type() == HEAP_NUMBER_TYPE) { | 749 if (map->instance_type() == HEAP_NUMBER_TYPE) { |
748 return T::Number(region); | 750 return T::Number(region); |
749 } else if (map->instance_type() == ODDBALL_TYPE) { | 751 } else if (map->instance_type() == ODDBALL_TYPE) { |
750 // The only oddballs that can be recorded in ICs are booleans. | 752 // The only oddballs that can be recorded in ICs are booleans. |
(...skipping 2195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2946 #undef ADDR | 2948 #undef ADDR |
2947 }; | 2949 }; |
2948 | 2950 |
2949 | 2951 |
2950 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2952 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2951 return IC_utilities[id]; | 2953 return IC_utilities[id]; |
2952 } | 2954 } |
2953 | 2955 |
2954 | 2956 |
2955 } } // namespace v8::internal | 2957 } } // namespace v8::internal |
OLD | NEW |