| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 UNREACHABLE(); | 1562 UNREACHABLE(); |
| 1563 default: | 1563 default: |
| 1564 UNREACHABLE(); | 1564 UNREACHABLE(); |
| 1565 } | 1565 } |
| 1566 UNREACHABLE(); | 1566 UNREACHABLE(); |
| 1567 return value; | 1567 return value; |
| 1568 } | 1568 } |
| 1569 | 1569 |
| 1570 | 1570 |
| 1571 // Set a real local property, even if it is READ_ONLY. If the property is not | 1571 // Set a real local property, even if it is READ_ONLY. If the property is not |
| 1572 // present, add it with attributes NONE. This code is the same as in | 1572 // present, add it with attributes NONE. This code is an exact clone of |
| 1573 // SetProperty, except for the check for IsReadOnly and the check for a | 1573 // SetProperty, with the check for IsReadOnly and the check for a |
| 1574 // callback setter. | 1574 // callback setter removed. The two lines looking up the LookupResult |
| 1575 Object* JSObject::IgnoreAttributesAndSetLocalProperty(String* name, | 1575 // result are also added. If one of the functions is changed, the other |
| 1576 Object* value) { | 1576 // should be. |
| 1577 Object* JSObject::IgnoreAttributesAndSetLocalProperty( |
| 1578 String* name, |
| 1579 Object* value, |
| 1580 PropertyAttributes attributes) { |
| 1577 // Make sure that the top context does not change when doing callbacks or | 1581 // Make sure that the top context does not change when doing callbacks or |
| 1578 // interceptor calls. | 1582 // interceptor calls. |
| 1579 AssertNoContextChange ncc; | 1583 AssertNoContextChange ncc; |
| 1580 | 1584 // ADDED TO CLONE |
| 1581 LookupResult result; | 1585 LookupResult result_struct; |
| 1582 LocalLookup(name, &result); | 1586 LocalLookup(name, &result_struct); |
| 1583 | 1587 LookupResult* result = &result_struct; |
| 1588 // END ADDED TO CLONE |
| 1584 // Check access rights if needed. | 1589 // Check access rights if needed. |
| 1585 if (IsAccessCheckNeeded() && | 1590 if (IsAccessCheckNeeded() |
| 1586 !Top::MayNamedAccess(this, name, v8::ACCESS_SET)) { | 1591 && !Top::MayNamedAccess(this, name, v8::ACCESS_SET)) { |
| 1587 Top::ReportFailedAccessCheck(this, v8::ACCESS_SET); | 1592 return SetPropertyWithFailedAccessCheck(result, name, value); |
| 1588 return value; | |
| 1589 } | 1593 } |
| 1590 | 1594 /* |
| 1591 if (result.IsValid()) { | 1595 REMOVED FROM CLONE |
| 1592 switch (result.type()) { | 1596 if (result->IsNotFound() || !result->IsProperty()) { |
| 1593 case NORMAL: | 1597 // We could not find a local property so let's check whether there is an |
| 1594 property_dictionary()->ValueAtPut(result.GetDictionaryEntry(), value); | 1598 // accessor that wants to handle the property. |
| 1595 return value; | 1599 LookupResult accessor_result; |
| 1596 case FIELD: | 1600 LookupCallbackSetterInPrototypes(name, &accessor_result); |
| 1597 properties()->set(result.GetFieldIndex(), value); | 1601 if (accessor_result.IsValid()) { |
| 1598 return value; | 1602 return SetPropertyWithCallback(accessor_result.GetCallbackObject(), |
| 1599 case MAP_TRANSITION: | 1603 name, |
| 1600 return AddFastPropertyUsingMap(result.GetTransitionMap(), name, value); | 1604 value, |
| 1601 case CONSTANT_FUNCTION: | 1605 accessor_result.holder()); |
| 1602 return ReplaceConstantFunctionProperty(name, value); | |
| 1603 case CALLBACKS: | |
| 1604 return SetPropertyWithCallback(result.GetCallbackObject(), name, value, | |
| 1605 result.holder()); | |
| 1606 case INTERCEPTOR: | |
| 1607 return SetPropertyWithInterceptor(name, value, NONE); | |
| 1608 case CONSTANT_TRANSITION: | |
| 1609 case NULL_DESCRIPTOR: | |
| 1610 UNREACHABLE(); | |
| 1611 break; | |
| 1612 } | 1606 } |
| 1607 } |
| 1608 */ |
| 1609 if (result->IsNotFound()) { |
| 1610 return AddProperty(name, value, attributes); |
| 1613 } | 1611 } |
| 1614 | 1612 if (!result->IsLoaded()) { |
| 1615 // The property was not found | 1613 return SetLazyProperty(result, name, value, attributes); |
| 1616 return AddProperty(name, value, NONE); | 1614 } |
| 1615 /* |
| 1616 REMOVED FROM CLONE |
| 1617 if (result->IsReadOnly() && result->IsProperty()) return value; |
| 1618 */ |
| 1619 // This is a real property that is not read-only, or it is a |
| 1620 // transition or null descriptor and there are no setters in the prototypes. |
| 1621 switch (result->type()) { |
| 1622 case NORMAL: |
| 1623 property_dictionary()->ValueAtPut(result->GetDictionaryEntry(), value); |
| 1624 return value; |
| 1625 case FIELD: |
| 1626 properties()->set(result->GetFieldIndex(), value); |
| 1627 return value; |
| 1628 case MAP_TRANSITION: |
| 1629 if (attributes == result->GetAttributes()) { |
| 1630 // Only use map transition if the attributes match. |
| 1631 return AddFastPropertyUsingMap(result->GetTransitionMap(), |
| 1632 name, |
| 1633 value); |
| 1634 } else { |
| 1635 return AddFastProperty(name, value, attributes); |
| 1636 } |
| 1637 case CONSTANT_FUNCTION: |
| 1638 if (value == result->GetConstantFunction()) return value; |
| 1639 // Only replace the function if necessary. |
| 1640 return ReplaceConstantFunctionProperty(name, value); |
| 1641 case CALLBACKS: |
| 1642 return SetPropertyWithCallback(result->GetCallbackObject(), |
| 1643 name, |
| 1644 value, |
| 1645 result->holder()); |
| 1646 case INTERCEPTOR: |
| 1647 return SetPropertyWithInterceptor(name, value, attributes); |
| 1648 case CONSTANT_TRANSITION: |
| 1649 // Replace with a MAP_TRANSITION to a new map with a FIELD, even |
| 1650 // if the value is a function. |
| 1651 // AddProperty has been extended to do this, in this case. |
| 1652 return AddFastProperty(name, value, attributes); |
| 1653 case NULL_DESCRIPTOR: |
| 1654 UNREACHABLE(); |
| 1655 default: |
| 1656 UNREACHABLE(); |
| 1657 } |
| 1658 UNREACHABLE(); |
| 1659 return value; |
| 1617 } | 1660 } |
| 1618 | 1661 |
| 1619 | 1662 |
| 1620 PropertyAttributes JSObject::GetPropertyAttributePostInterceptor( | 1663 PropertyAttributes JSObject::GetPropertyAttributePostInterceptor( |
| 1621 JSObject* receiver, | 1664 JSObject* receiver, |
| 1622 String* name, | 1665 String* name, |
| 1623 bool continue_search) { | 1666 bool continue_search) { |
| 1624 // Check local property, ignore interceptor. | 1667 // Check local property, ignore interceptor. |
| 1625 LookupResult result; | 1668 LookupResult result; |
| 1626 LocalLookupRealNamedProperty(name, &result); | 1669 LocalLookupRealNamedProperty(name, &result); |
| (...skipping 4757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6384 // No break point. | 6427 // No break point. |
| 6385 if (break_point_objects()->IsUndefined()) return 0; | 6428 if (break_point_objects()->IsUndefined()) return 0; |
| 6386 // Single beak point. | 6429 // Single beak point. |
| 6387 if (!break_point_objects()->IsFixedArray()) return 1; | 6430 if (!break_point_objects()->IsFixedArray()) return 1; |
| 6388 // Multiple break points. | 6431 // Multiple break points. |
| 6389 return FixedArray::cast(break_point_objects())->length(); | 6432 return FixedArray::cast(break_point_objects())->length(); |
| 6390 } | 6433 } |
| 6391 | 6434 |
| 6392 | 6435 |
| 6393 } } // namespace v8::internal | 6436 } } // namespace v8::internal |
| OLD | NEW |