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 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 // polymorphic loads where the property is sometimes found in the prototype | 1624 // polymorphic loads where the property is sometimes found in the prototype |
1625 // chain. | 1625 // chain. |
1626 static bool PrototypeChainCanNeverResolve( | 1626 static bool PrototypeChainCanNeverResolve( |
1627 Handle<Map> map, Handle<String> name) { | 1627 Handle<Map> map, Handle<String> name) { |
1628 Isolate* isolate = map->GetIsolate(); | 1628 Isolate* isolate = map->GetIsolate(); |
1629 Object* current = map->prototype(); | 1629 Object* current = map->prototype(); |
1630 while (current != isolate->heap()->null_value()) { | 1630 while (current != isolate->heap()->null_value()) { |
1631 if (current->IsJSGlobalProxy() || | 1631 if (current->IsJSGlobalProxy() || |
1632 current->IsGlobalObject() || | 1632 current->IsGlobalObject() || |
1633 !current->IsJSObject() || | 1633 !current->IsJSObject() || |
| 1634 JSObject::cast(current)->map()->has_named_interceptor() || |
1634 JSObject::cast(current)->IsAccessCheckNeeded() || | 1635 JSObject::cast(current)->IsAccessCheckNeeded() || |
1635 !JSObject::cast(current)->HasFastProperties()) { | 1636 !JSObject::cast(current)->HasFastProperties()) { |
1636 return false; | 1637 return false; |
1637 } | 1638 } |
1638 | 1639 |
1639 LookupResult lookup(isolate); | 1640 LookupResult lookup(isolate); |
1640 JSObject::cast(current)->map()->LookupInDescriptors(NULL, *name, &lookup); | 1641 JSObject::cast(current)->map()->LookupInDescriptors(NULL, *name, &lookup); |
1641 if (lookup.IsFound()) { | 1642 if (lookup.IsFound()) { |
1642 if (lookup.type() != MAP_TRANSITION) return false; | 1643 if (lookup.type() != MAP_TRANSITION) return false; |
1643 } else if (!lookup.IsCacheable()) { | 1644 } else if (!lookup.IsCacheable()) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 } else { | 1679 } else { |
1679 SetGVNFlag(kDependsOnBackingStoreFields); | 1680 SetGVNFlag(kDependsOnBackingStoreFields); |
1680 } | 1681 } |
1681 types_.Add(types->at(i), zone); | 1682 types_.Add(types->at(i), zone); |
1682 break; | 1683 break; |
1683 } | 1684 } |
1684 case CONSTANT_FUNCTION: | 1685 case CONSTANT_FUNCTION: |
1685 types_.Add(types->at(i), zone); | 1686 types_.Add(types->at(i), zone); |
1686 break; | 1687 break; |
1687 case MAP_TRANSITION: | 1688 case MAP_TRANSITION: |
1688 if (PrototypeChainCanNeverResolve(map, name)) { | 1689 if (!map->has_named_interceptor() && |
| 1690 PrototypeChainCanNeverResolve(map, name)) { |
1689 negative_lookups.Add(types->at(i), zone); | 1691 negative_lookups.Add(types->at(i), zone); |
1690 } | 1692 } |
1691 break; | 1693 break; |
1692 default: | 1694 default: |
1693 break; | 1695 break; |
1694 } | 1696 } |
1695 } else if (lookup.IsCacheable()) { | 1697 } else if (lookup.IsCacheable()) { |
1696 if (PrototypeChainCanNeverResolve(map, name)) { | 1698 if (!map->has_named_interceptor() && |
| 1699 PrototypeChainCanNeverResolve(map, name)) { |
1697 negative_lookups.Add(types->at(i), zone); | 1700 negative_lookups.Add(types->at(i), zone); |
1698 } | 1701 } |
1699 } | 1702 } |
1700 } | 1703 } |
1701 | 1704 |
1702 bool need_generic = | 1705 bool need_generic = |
1703 (types->length() != negative_lookups.length() + types_.length()); | 1706 (types->length() != negative_lookups.length() + types_.length()); |
1704 if (!need_generic && FLAG_deoptimize_uncommon_cases) { | 1707 if (!need_generic && FLAG_deoptimize_uncommon_cases) { |
1705 SetFlag(kUseGVN); | 1708 SetFlag(kUseGVN); |
1706 for (int i = 0; i < negative_lookups.length(); i++) { | 1709 for (int i = 0; i < negative_lookups.length(); i++) { |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2520 | 2523 |
2521 | 2524 |
2522 void HCheckPrototypeMaps::Verify() { | 2525 void HCheckPrototypeMaps::Verify() { |
2523 HInstruction::Verify(); | 2526 HInstruction::Verify(); |
2524 ASSERT(HasNoUses()); | 2527 ASSERT(HasNoUses()); |
2525 } | 2528 } |
2526 | 2529 |
2527 #endif | 2530 #endif |
2528 | 2531 |
2529 } } // namespace v8::internal | 2532 } } // namespace v8::internal |
OLD | NEW |