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 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 // polymorphic loads where the property is sometimes found in the prototype | 1707 // polymorphic loads where the property is sometimes found in the prototype |
1708 // chain. | 1708 // chain. |
1709 static bool PrototypeChainCanNeverResolve( | 1709 static bool PrototypeChainCanNeverResolve( |
1710 Handle<Map> map, Handle<String> name) { | 1710 Handle<Map> map, Handle<String> name) { |
1711 Isolate* isolate = map->GetIsolate(); | 1711 Isolate* isolate = map->GetIsolate(); |
1712 Object* current = map->prototype(); | 1712 Object* current = map->prototype(); |
1713 while (current != isolate->heap()->null_value()) { | 1713 while (current != isolate->heap()->null_value()) { |
1714 if (current->IsJSGlobalProxy() || | 1714 if (current->IsJSGlobalProxy() || |
1715 current->IsGlobalObject() || | 1715 current->IsGlobalObject() || |
1716 !current->IsJSObject() || | 1716 !current->IsJSObject() || |
| 1717 JSObject::cast(current)->map()->has_named_interceptor() || |
1717 JSObject::cast(current)->IsAccessCheckNeeded() || | 1718 JSObject::cast(current)->IsAccessCheckNeeded() || |
1718 !JSObject::cast(current)->HasFastProperties()) { | 1719 !JSObject::cast(current)->HasFastProperties()) { |
1719 return false; | 1720 return false; |
1720 } | 1721 } |
1721 | 1722 |
1722 LookupResult lookup(isolate); | 1723 LookupResult lookup(isolate); |
1723 Map* map = JSObject::cast(current)->map(); | 1724 Map* map = JSObject::cast(current)->map(); |
1724 map->LookupDescriptor(NULL, *name, &lookup); | 1725 map->LookupDescriptor(NULL, *name, &lookup); |
1725 if (lookup.IsFound()) return false; | 1726 if (lookup.IsFound()) return false; |
1726 if (!lookup.IsCacheable()) return false; | 1727 if (!lookup.IsCacheable()) return false; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 case NORMAL: | 1773 case NORMAL: |
1773 case HANDLER: | 1774 case HANDLER: |
1774 UNREACHABLE(); | 1775 UNREACHABLE(); |
1775 break; | 1776 break; |
1776 } | 1777 } |
1777 } else if (lookup.IsCacheable() && | 1778 } else if (lookup.IsCacheable() && |
1778 // For dicts the lookup on the map will fail, but the object may | 1779 // For dicts the lookup on the map will fail, but the object may |
1779 // contain the property so we cannot generate a negative lookup | 1780 // contain the property so we cannot generate a negative lookup |
1780 // (which would just be a map check and return undefined). | 1781 // (which would just be a map check and return undefined). |
1781 !map->is_dictionary_map() && | 1782 !map->is_dictionary_map() && |
| 1783 !map->has_named_interceptor() && |
1782 PrototypeChainCanNeverResolve(map, name)) { | 1784 PrototypeChainCanNeverResolve(map, name)) { |
1783 negative_lookups.Add(types->at(i), zone); | 1785 negative_lookups.Add(types->at(i), zone); |
1784 } | 1786 } |
1785 } | 1787 } |
1786 | 1788 |
1787 bool need_generic = | 1789 bool need_generic = |
1788 (types->length() != negative_lookups.length() + types_.length()); | 1790 (types->length() != negative_lookups.length() + types_.length()); |
1789 if (!need_generic && FLAG_deoptimize_uncommon_cases) { | 1791 if (!need_generic && FLAG_deoptimize_uncommon_cases) { |
1790 SetFlag(kUseGVN); | 1792 SetFlag(kUseGVN); |
1791 for (int i = 0; i < negative_lookups.length(); i++) { | 1793 for (int i = 0; i < negative_lookups.length(); i++) { |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2620 | 2622 |
2621 | 2623 |
2622 void HCheckPrototypeMaps::Verify() { | 2624 void HCheckPrototypeMaps::Verify() { |
2623 HInstruction::Verify(); | 2625 HInstruction::Verify(); |
2624 ASSERT(HasNoUses()); | 2626 ASSERT(HasNoUses()); |
2625 } | 2627 } |
2626 | 2628 |
2627 #endif | 2629 #endif |
2628 | 2630 |
2629 } } // namespace v8::internal | 2631 } } // namespace v8::internal |
OLD | NEW |