| 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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 TypeHandleList types; | 633 TypeHandleList types; |
| 634 CodeHandleList handlers; | 634 CodeHandleList handlers; |
| 635 | 635 |
| 636 TargetTypes(&types); | 636 TargetTypes(&types); |
| 637 int number_of_types = types.length(); | 637 int number_of_types = types.length(); |
| 638 int deprecated_types = 0; | 638 int deprecated_types = 0; |
| 639 int handler_to_overwrite = -1; | 639 int handler_to_overwrite = -1; |
| 640 | 640 |
| 641 for (int i = 0; i < number_of_types; i++) { | 641 for (int i = 0; i < number_of_types; i++) { |
| 642 Handle<HeapType> current_type = types.at(i); | 642 Handle<HeapType> current_type = types.at(i); |
| 643 if (current_type->IsClass() && current_type->AsClass()->is_deprecated()) { | 643 if (current_type->IsClass() && |
| 644 current_type->AsClass()->Map()->is_deprecated()) { |
| 644 // Filter out deprecated maps to ensure their instances get migrated. | 645 // Filter out deprecated maps to ensure their instances get migrated. |
| 645 ++deprecated_types; | 646 ++deprecated_types; |
| 646 } else if (type->NowIs(current_type)) { | 647 } else if (type->NowIs(current_type)) { |
| 647 // If the receiver type is already in the polymorphic IC, this indicates | 648 // If the receiver type is already in the polymorphic IC, this indicates |
| 648 // there was a prototoype chain failure. In that case, just overwrite the | 649 // there was a prototoype chain failure. In that case, just overwrite the |
| 649 // handler. | 650 // handler. |
| 650 handler_to_overwrite = i; | 651 handler_to_overwrite = i; |
| 651 } else if (handler_to_overwrite == -1 && | 652 } else if (handler_to_overwrite == -1 && |
| 652 current_type->IsClass() && | 653 current_type->IsClass() && |
| 653 type->IsClass() && | 654 type->IsClass() && |
| 654 IsTransitionOfMonomorphicTarget(*current_type->AsClass(), | 655 IsTransitionOfMonomorphicTarget(*current_type->AsClass()->Map(), |
| 655 *type->AsClass())) { | 656 *type->AsClass()->Map())) { |
| 656 handler_to_overwrite = i; | 657 handler_to_overwrite = i; |
| 657 } | 658 } |
| 658 } | 659 } |
| 659 | 660 |
| 660 int number_of_valid_types = | 661 int number_of_valid_types = |
| 661 number_of_types - deprecated_types - (handler_to_overwrite != -1); | 662 number_of_types - deprecated_types - (handler_to_overwrite != -1); |
| 662 | 663 |
| 663 if (number_of_valid_types >= 4) return false; | 664 if (number_of_valid_types >= 4) return false; |
| 664 if (number_of_types == 0) return false; | 665 if (number_of_types == 0) return false; |
| 665 if (!target()->FindHandlers(&handlers, types.length())) return false; | 666 if (!target()->FindHandlers(&handlers, types.length())) return false; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 687 ? HeapType::Constant(Handle<JSGlobalObject>::cast(object), isolate) | 688 ? HeapType::Constant(Handle<JSGlobalObject>::cast(object), isolate) |
| 688 : HeapType::NowOf(object, isolate); | 689 : HeapType::NowOf(object, isolate); |
| 689 } | 690 } |
| 690 | 691 |
| 691 | 692 |
| 692 Handle<Map> IC::TypeToMap(HeapType* type, Isolate* isolate) { | 693 Handle<Map> IC::TypeToMap(HeapType* type, Isolate* isolate) { |
| 693 if (type->Is(HeapType::Number())) | 694 if (type->Is(HeapType::Number())) |
| 694 return isolate->factory()->heap_number_map(); | 695 return isolate->factory()->heap_number_map(); |
| 695 if (type->Is(HeapType::Boolean())) return isolate->factory()->boolean_map(); | 696 if (type->Is(HeapType::Boolean())) return isolate->factory()->boolean_map(); |
| 696 if (type->IsConstant()) { | 697 if (type->IsConstant()) { |
| 697 return handle(Handle<JSGlobalObject>::cast(type->AsConstant())->map()); | 698 return handle( |
| 699 Handle<JSGlobalObject>::cast(type->AsConstant()->Value())->map()); |
| 698 } | 700 } |
| 699 ASSERT(type->IsClass()); | 701 ASSERT(type->IsClass()); |
| 700 return type->AsClass(); | 702 return type->AsClass()->Map(); |
| 701 } | 703 } |
| 702 | 704 |
| 703 | 705 |
| 704 template <class T> | 706 template <class T> |
| 705 typename T::TypeHandle IC::MapToType(Handle<Map> map, | 707 typename T::TypeHandle IC::MapToType(Handle<Map> map, |
| 706 typename T::Region* region) { | 708 typename T::Region* region) { |
| 707 if (map->instance_type() == HEAP_NUMBER_TYPE) { | 709 if (map->instance_type() == HEAP_NUMBER_TYPE) { |
| 708 return T::Number(region); | 710 return T::Number(region); |
| 709 } else if (map->instance_type() == ODDBALL_TYPE) { | 711 } else if (map->instance_type() == ODDBALL_TYPE) { |
| 710 // The only oddballs that can be recorded in ICs are booleans. | 712 // The only oddballs that can be recorded in ICs are booleans. |
| (...skipping 2128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2839 #undef ADDR | 2841 #undef ADDR |
| 2840 }; | 2842 }; |
| 2841 | 2843 |
| 2842 | 2844 |
| 2843 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2845 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2844 return IC_utilities[id]; | 2846 return IC_utilities[id]; |
| 2845 } | 2847 } |
| 2846 | 2848 |
| 2847 | 2849 |
| 2848 } } // namespace v8::internal | 2850 } } // namespace v8::internal |
| OLD | NEW |