| 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 target()->FindAllTypes(&types); | 627 target()->FindAllTypes(&types); |
| 628 int number_of_types = types.length(); | 628 int number_of_types = types.length(); |
| 629 int deprecated_types = 0; | 629 int deprecated_types = 0; |
| 630 int handler_to_overwrite = -1; | 630 int handler_to_overwrite = -1; |
| 631 | 631 |
| 632 for (int i = 0; i < number_of_types; i++) { | 632 for (int i = 0; i < number_of_types; i++) { |
| 633 Handle<HeapType> current_type = types.at(i); | 633 Handle<HeapType> current_type = types.at(i); |
| 634 if (current_type->IsClass() && current_type->AsClass()->is_deprecated()) { | 634 if (current_type->IsClass() && current_type->AsClass()->is_deprecated()) { |
| 635 // Filter out deprecated maps to ensure their instances get migrated. | 635 // Filter out deprecated maps to ensure their instances get migrated. |
| 636 ++deprecated_types; | 636 ++deprecated_types; |
| 637 } else if (type->IsCurrently(current_type)) { | 637 } else if (type->NowIs(current_type)) { |
| 638 // If the receiver type is already in the polymorphic IC, this indicates | 638 // If the receiver type is already in the polymorphic IC, this indicates |
| 639 // there was a prototoype chain failure. In that case, just overwrite the | 639 // there was a prototoype chain failure. In that case, just overwrite the |
| 640 // handler. | 640 // handler. |
| 641 handler_to_overwrite = i; | 641 handler_to_overwrite = i; |
| 642 } else if (handler_to_overwrite == -1 && | 642 } else if (handler_to_overwrite == -1 && |
| 643 current_type->IsClass() && | 643 current_type->IsClass() && |
| 644 type->IsClass() && | 644 type->IsClass() && |
| 645 IsTransitionOfMonomorphicTarget(*current_type->AsClass(), | 645 IsTransitionOfMonomorphicTarget(*current_type->AsClass(), |
| 646 *type->AsClass())) { | 646 *type->AsClass())) { |
| 647 handler_to_overwrite = i; | 647 handler_to_overwrite = i; |
| 648 } | 648 } |
| 649 } | 649 } |
| 650 | 650 |
| 651 int number_of_valid_types = | 651 int number_of_valid_types = |
| 652 number_of_types - deprecated_types - (handler_to_overwrite != -1); | 652 number_of_types - deprecated_types - (handler_to_overwrite != -1); |
| 653 | 653 |
| 654 if (number_of_valid_types >= 4) return false; | 654 if (number_of_valid_types >= 4) return false; |
| 655 if (number_of_types == 0) return false; | 655 if (number_of_types == 0) return false; |
| 656 if (!target()->FindHandlers(&handlers, types.length())) return false; | 656 if (!target()->FindHandlers(&handlers, types.length())) return false; |
| 657 | 657 |
| 658 number_of_valid_types++; | 658 number_of_valid_types++; |
| 659 if (handler_to_overwrite >= 0) { | 659 if (handler_to_overwrite >= 0) { |
| 660 handlers.Set(handler_to_overwrite, code); | 660 handlers.Set(handler_to_overwrite, code); |
| 661 if (!type->IsCurrently(types.at(handler_to_overwrite))) { | 661 if (!type->NowIs(types.at(handler_to_overwrite))) { |
| 662 types.Set(handler_to_overwrite, type); | 662 types.Set(handler_to_overwrite, type); |
| 663 } | 663 } |
| 664 } else { | 664 } else { |
| 665 types.Add(type); | 665 types.Add(type); |
| 666 handlers.Add(code); | 666 handlers.Add(code); |
| 667 } | 667 } |
| 668 | 668 |
| 669 Handle<Code> ic = isolate()->stub_cache()->ComputePolymorphicIC( | 669 Handle<Code> ic = isolate()->stub_cache()->ComputePolymorphicIC( |
| 670 kind(), &types, &handlers, number_of_valid_types, name, extra_ic_state()); | 670 kind(), &types, &handlers, number_of_valid_types, name, extra_ic_state()); |
| 671 set_target(*ic); | 671 set_target(*ic); |
| 672 return true; | 672 return true; |
| 673 } | 673 } |
| 674 | 674 |
| 675 | 675 |
| 676 Handle<HeapType> IC::CurrentTypeOf(Handle<Object> object, Isolate* isolate) { | 676 Handle<HeapType> IC::CurrentTypeOf(Handle<Object> object, Isolate* isolate) { |
| 677 return object->IsJSGlobalObject() | 677 return object->IsJSGlobalObject() |
| 678 ? HeapType::Constant(Handle<JSGlobalObject>::cast(object), isolate) | 678 ? HeapType::Constant(Handle<JSGlobalObject>::cast(object), isolate) |
| 679 : HeapType::OfCurrently(object, isolate); | 679 : HeapType::NowOf(object, isolate); |
| 680 } | 680 } |
| 681 | 681 |
| 682 | 682 |
| 683 Handle<Map> IC::TypeToMap(HeapType* type, Isolate* isolate) { | 683 Handle<Map> IC::TypeToMap(HeapType* type, Isolate* isolate) { |
| 684 if (type->Is(HeapType::Number())) | 684 if (type->Is(HeapType::Number())) |
| 685 return isolate->factory()->heap_number_map(); | 685 return isolate->factory()->heap_number_map(); |
| 686 if (type->Is(HeapType::Boolean())) return isolate->factory()->oddball_map(); | 686 if (type->Is(HeapType::Boolean())) return isolate->factory()->oddball_map(); |
| 687 if (type->IsConstant()) { | 687 if (type->IsConstant()) { |
| 688 return handle(Handle<JSGlobalObject>::cast(type->AsConstant())->map()); | 688 return handle(Handle<JSGlobalObject>::cast(type->AsConstant())->map()); |
| 689 } | 689 } |
| (...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2838 #undef ADDR | 2838 #undef ADDR |
| 2839 }; | 2839 }; |
| 2840 | 2840 |
| 2841 | 2841 |
| 2842 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2842 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2843 return IC_utilities[id]; | 2843 return IC_utilities[id]; |
| 2844 } | 2844 } |
| 2845 | 2845 |
| 2846 | 2846 |
| 2847 } } // namespace v8::internal | 2847 } } // namespace v8::internal |
| OLD | NEW |