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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 while (current != isolate->heap()->null_value()) { | 1631 while (current != isolate->heap()->null_value()) { |
1632 if (current->IsJSGlobalProxy() || | 1632 if (current->IsJSGlobalProxy() || |
1633 current->IsGlobalObject() || | 1633 current->IsGlobalObject() || |
1634 !current->IsJSObject() || | 1634 !current->IsJSObject() || |
1635 JSObject::cast(current)->IsAccessCheckNeeded() || | 1635 JSObject::cast(current)->IsAccessCheckNeeded() || |
1636 !JSObject::cast(current)->HasFastProperties()) { | 1636 !JSObject::cast(current)->HasFastProperties()) { |
1637 return false; | 1637 return false; |
1638 } | 1638 } |
1639 | 1639 |
1640 LookupResult lookup(isolate); | 1640 LookupResult lookup(isolate); |
1641 JSObject::cast(current)->map()->LookupInDescriptors(NULL, *name, &lookup); | 1641 Map* map = JSObject::cast(current)->map(); |
| 1642 map->LookupTransitionOrDescriptor(NULL, *name, &lookup); |
1642 if (lookup.IsFound()) { | 1643 if (lookup.IsFound()) { |
1643 if (lookup.type() != MAP_TRANSITION) return false; | 1644 if (!lookup.IsTransition()) return false; |
1644 } else if (!lookup.IsCacheable()) { | 1645 } else if (!lookup.IsCacheable()) { |
1645 return false; | 1646 return false; |
1646 } | 1647 } |
1647 | 1648 |
1648 current = JSObject::cast(current)->GetPrototype(); | 1649 current = JSObject::cast(current)->GetPrototype(); |
1649 } | 1650 } |
1650 return true; | 1651 return true; |
1651 } | 1652 } |
1652 | 1653 |
1653 | 1654 |
1654 HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context, | 1655 HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context, |
1655 HValue* object, | 1656 HValue* object, |
1656 SmallMapList* types, | 1657 SmallMapList* types, |
1657 Handle<String> name, | 1658 Handle<String> name, |
1658 Zone* zone) | 1659 Zone* zone) |
1659 : types_(Min(types->length(), kMaxLoadPolymorphism), zone), | 1660 : types_(Min(types->length(), kMaxLoadPolymorphism), zone), |
1660 name_(name), | 1661 name_(name), |
1661 need_generic_(false) { | 1662 need_generic_(false) { |
1662 SetOperandAt(0, context); | 1663 SetOperandAt(0, context); |
1663 SetOperandAt(1, object); | 1664 SetOperandAt(1, object); |
1664 set_representation(Representation::Tagged()); | 1665 set_representation(Representation::Tagged()); |
1665 SetGVNFlag(kDependsOnMaps); | 1666 SetGVNFlag(kDependsOnMaps); |
1666 SmallMapList negative_lookups; | 1667 SmallMapList negative_lookups; |
1667 for (int i = 0; | 1668 for (int i = 0; |
1668 i < types->length() && types_.length() < kMaxLoadPolymorphism; | 1669 i < types->length() && types_.length() < kMaxLoadPolymorphism; |
1669 ++i) { | 1670 ++i) { |
1670 Handle<Map> map = types->at(i); | 1671 Handle<Map> map = types->at(i); |
1671 LookupResult lookup(map->GetIsolate()); | 1672 LookupResult lookup(map->GetIsolate()); |
1672 map->LookupInDescriptors(NULL, *name, &lookup); | 1673 map->LookupTransitionOrDescriptor(NULL, *name, &lookup); |
1673 if (lookup.IsFound()) { | 1674 if (lookup.IsFound()) { |
1674 switch (lookup.type()) { | 1675 switch (lookup.type()) { |
1675 case FIELD: { | 1676 case FIELD: { |
1676 int index = lookup.GetLocalFieldIndexFromMap(*map); | 1677 int index = lookup.GetLocalFieldIndexFromMap(*map); |
1677 if (index < 0) { | 1678 if (index < 0) { |
1678 SetGVNFlag(kDependsOnInobjectFields); | 1679 SetGVNFlag(kDependsOnInobjectFields); |
1679 } else { | 1680 } else { |
1680 SetGVNFlag(kDependsOnBackingStoreFields); | 1681 SetGVNFlag(kDependsOnBackingStoreFields); |
1681 } | 1682 } |
1682 types_.Add(types->at(i), zone); | 1683 types_.Add(types->at(i), zone); |
1683 break; | 1684 break; |
1684 } | 1685 } |
1685 case CONSTANT_FUNCTION: | 1686 case CONSTANT_FUNCTION: |
1686 types_.Add(types->at(i), zone); | 1687 types_.Add(types->at(i), zone); |
1687 break; | 1688 break; |
1688 case MAP_TRANSITION: | 1689 case CALLBACKS: |
| 1690 break; |
| 1691 case TRANSITION: |
1689 if (PrototypeChainCanNeverResolve(map, name)) { | 1692 if (PrototypeChainCanNeverResolve(map, name)) { |
1690 negative_lookups.Add(types->at(i), zone); | 1693 negative_lookups.Add(types->at(i), zone); |
1691 } | 1694 } |
1692 break; | 1695 break; |
1693 default: | 1696 case INTERCEPTOR: |
| 1697 case NONEXISTENT: |
| 1698 case NORMAL: |
| 1699 case HANDLER: |
| 1700 UNREACHABLE(); |
1694 break; | 1701 break; |
1695 } | 1702 } |
1696 } else if (lookup.IsCacheable()) { | 1703 } else if (lookup.IsCacheable()) { |
1697 if (PrototypeChainCanNeverResolve(map, name)) { | 1704 if (PrototypeChainCanNeverResolve(map, name)) { |
1698 negative_lookups.Add(types->at(i), zone); | 1705 negative_lookups.Add(types->at(i), zone); |
1699 } | 1706 } |
1700 } | 1707 } |
1701 } | 1708 } |
1702 | 1709 |
1703 bool need_generic = | 1710 bool need_generic = |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 | 2535 |
2529 | 2536 |
2530 void HCheckPrototypeMaps::Verify() { | 2537 void HCheckPrototypeMaps::Verify() { |
2531 HInstruction::Verify(); | 2538 HInstruction::Verify(); |
2532 ASSERT(HasNoUses()); | 2539 ASSERT(HasNoUses()); |
2533 } | 2540 } |
2534 | 2541 |
2535 #endif | 2542 #endif |
2536 | 2543 |
2537 } } // namespace v8::internal | 2544 } } // namespace v8::internal |
OLD | NEW |