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 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 // polymorphic loads where the property is sometimes found in the prototype | 1675 // polymorphic loads where the property is sometimes found in the prototype |
1676 // chain. | 1676 // chain. |
1677 static bool PrototypeChainCanNeverResolve( | 1677 static bool PrototypeChainCanNeverResolve( |
1678 Handle<Map> map, Handle<String> name) { | 1678 Handle<Map> map, Handle<String> name) { |
1679 Isolate* isolate = map->GetIsolate(); | 1679 Isolate* isolate = map->GetIsolate(); |
1680 Object* current = map->prototype(); | 1680 Object* current = map->prototype(); |
1681 while (current != isolate->heap()->null_value()) { | 1681 while (current != isolate->heap()->null_value()) { |
1682 if (current->IsJSGlobalProxy() || | 1682 if (current->IsJSGlobalProxy() || |
1683 current->IsGlobalObject() || | 1683 current->IsGlobalObject() || |
1684 !current->IsJSObject() || | 1684 !current->IsJSObject() || |
| 1685 JSObject::cast(current)->map()->has_named_interceptor() || |
1685 JSObject::cast(current)->IsAccessCheckNeeded() || | 1686 JSObject::cast(current)->IsAccessCheckNeeded() || |
1686 !JSObject::cast(current)->HasFastProperties()) { | 1687 !JSObject::cast(current)->HasFastProperties()) { |
1687 return false; | 1688 return false; |
1688 } | 1689 } |
1689 | 1690 |
1690 LookupResult lookup(isolate); | 1691 LookupResult lookup(isolate); |
1691 Map* map = JSObject::cast(current)->map(); | 1692 Map* map = JSObject::cast(current)->map(); |
1692 map->LookupDescriptor(NULL, *name, &lookup); | 1693 map->LookupDescriptor(NULL, *name, &lookup); |
1693 if (lookup.IsFound()) return false; | 1694 if (lookup.IsFound()) return false; |
1694 if (!lookup.IsCacheable()) return false; | 1695 if (!lookup.IsCacheable()) return false; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 break; | 1737 break; |
1737 case TRANSITION: | 1738 case TRANSITION: |
1738 case INTERCEPTOR: | 1739 case INTERCEPTOR: |
1739 case NONEXISTENT: | 1740 case NONEXISTENT: |
1740 case NORMAL: | 1741 case NORMAL: |
1741 case HANDLER: | 1742 case HANDLER: |
1742 UNREACHABLE(); | 1743 UNREACHABLE(); |
1743 break; | 1744 break; |
1744 } | 1745 } |
1745 } else if (lookup.IsCacheable() && | 1746 } else if (lookup.IsCacheable() && |
| 1747 // For dicts the lookup on the map will fail, but the object may |
| 1748 // contain the property so we cannot generate a negative lookup |
| 1749 // (which would just be a map check and return undefined). |
| 1750 !map->is_dictionary_map() && |
| 1751 !map->has_named_interceptor() && |
1746 PrototypeChainCanNeverResolve(map, name)) { | 1752 PrototypeChainCanNeverResolve(map, name)) { |
1747 negative_lookups.Add(types->at(i), zone); | 1753 negative_lookups.Add(types->at(i), zone); |
1748 } | 1754 } |
1749 } | 1755 } |
1750 | 1756 |
1751 bool need_generic = | 1757 bool need_generic = |
1752 (types->length() != negative_lookups.length() + types_.length()); | 1758 (types->length() != negative_lookups.length() + types_.length()); |
1753 if (!need_generic && FLAG_deoptimize_uncommon_cases) { | 1759 if (!need_generic && FLAG_deoptimize_uncommon_cases) { |
1754 SetFlag(kUseGVN); | 1760 SetFlag(kUseGVN); |
1755 for (int i = 0; i < negative_lookups.length(); i++) { | 1761 for (int i = 0; i < negative_lookups.length(); i++) { |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2584 | 2590 |
2585 | 2591 |
2586 void HCheckPrototypeMaps::Verify() { | 2592 void HCheckPrototypeMaps::Verify() { |
2587 HInstruction::Verify(); | 2593 HInstruction::Verify(); |
2588 ASSERT(HasNoUses()); | 2594 ASSERT(HasNoUses()); |
2589 } | 2595 } |
2590 | 2596 |
2591 #endif | 2597 #endif |
2592 | 2598 |
2593 } } // namespace v8::internal | 2599 } } // namespace v8::internal |
OLD | NEW |