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 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 Handle<Code> StoreIC::CompileHandler(LookupResult* lookup, | 1626 Handle<Code> StoreIC::CompileHandler(LookupResult* lookup, |
1627 Handle<Object> object, | 1627 Handle<Object> object, |
1628 Handle<String> name, | 1628 Handle<String> name, |
1629 Handle<Object> value, | 1629 Handle<Object> value, |
1630 InlineCacheHolderFlag cache_holder) { | 1630 InlineCacheHolderFlag cache_holder) { |
1631 ASSERT(cache_holder == OWN_MAP); | 1631 ASSERT(cache_holder == OWN_MAP); |
1632 // This is currently guaranteed by checks in StoreIC::Store. | 1632 // This is currently guaranteed by checks in StoreIC::Store. |
1633 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 1633 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
1634 | 1634 |
1635 Handle<JSObject> holder(lookup->holder()); | 1635 Handle<JSObject> holder(lookup->holder()); |
1636 StoreStubCompiler compiler(isolate(), strict_mode(), kind()); | 1636 // Handlers do not use strict mode. |
| 1637 StoreStubCompiler compiler(isolate(), kNonStrictMode, kind()); |
1637 switch (lookup->type()) { | 1638 switch (lookup->type()) { |
1638 case FIELD: | 1639 case FIELD: |
1639 return compiler.CompileStoreField(receiver, lookup, name); | 1640 return compiler.CompileStoreField(receiver, lookup, name); |
1640 case TRANSITION: { | 1641 case TRANSITION: { |
1641 // Explicitly pass in the receiver map since LookupForWrite may have | 1642 // Explicitly pass in the receiver map since LookupForWrite may have |
1642 // stored something else than the receiver in the holder. | 1643 // stored something else than the receiver in the holder. |
1643 Handle<Map> transition( | 1644 Handle<Map> transition( |
1644 lookup->GetTransitionTarget(receiver->map()), isolate()); | 1645 lookup->GetTransitionTarget(receiver->map()), isolate()); |
1645 int descriptor = transition->LastAdded(); | 1646 int descriptor = transition->LastAdded(); |
1646 | 1647 |
1647 DescriptorArray* target_descriptors = transition->instance_descriptors(); | 1648 DescriptorArray* target_descriptors = transition->instance_descriptors(); |
1648 PropertyDetails details = target_descriptors->GetDetails(descriptor); | 1649 PropertyDetails details = target_descriptors->GetDetails(descriptor); |
1649 | 1650 |
1650 if (details.type() == CALLBACKS || details.attributes() != NONE) break; | 1651 if (details.type() == CALLBACKS || details.attributes() != NONE) break; |
1651 | 1652 |
1652 return compiler.CompileStoreTransition( | 1653 return compiler.CompileStoreTransition( |
1653 receiver, lookup, transition, name); | 1654 receiver, lookup, transition, name); |
1654 } | 1655 } |
1655 case NORMAL: | 1656 case NORMAL: |
1656 if (kind() == Code::KEYED_STORE_IC) break; | 1657 if (kind() == Code::KEYED_STORE_IC) break; |
1657 if (receiver->IsGlobalObject()) { | 1658 if (receiver->IsGlobalObject()) { |
1658 // The stub generated for the global object picks the value directly | 1659 // The stub generated for the global object picks the value directly |
1659 // from the property cell. So the property must be directly on the | 1660 // from the property cell. So the property must be directly on the |
1660 // global object. | 1661 // global object. |
1661 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); | 1662 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); |
1662 Handle<PropertyCell> cell(global->GetPropertyCell(lookup), isolate()); | 1663 Handle<PropertyCell> cell(global->GetPropertyCell(lookup), isolate()); |
1663 Handle<Type> union_type = PropertyCell::UpdatedType(cell, value); | 1664 Handle<Type> union_type = PropertyCell::UpdatedType(cell, value); |
1664 StoreGlobalStub stub(strict_mode(), union_type->IsConstant()); | 1665 StoreGlobalStub stub(union_type->IsConstant()); |
1665 | 1666 |
1666 Handle<Code> code = stub.GetCodeCopyFromTemplate( | 1667 Handle<Code> code = stub.GetCodeCopyFromTemplate( |
1667 isolate(), receiver->map(), *cell); | 1668 isolate(), receiver->map(), *cell); |
1668 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. | 1669 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. |
1669 HeapObject::UpdateMapCodeCache(receiver, name, code); | 1670 HeapObject::UpdateMapCodeCache(receiver, name, code); |
1670 return code; | 1671 return code; |
1671 } | 1672 } |
1672 ASSERT(holder.is_identical_to(receiver)); | 1673 ASSERT(holder.is_identical_to(receiver)); |
1673 return strict_mode() == kStrictMode | 1674 return isolate()->builtins()->StoreIC_Normal(); |
1674 ? isolate()->builtins()->StoreIC_Normal_Strict() | |
1675 : isolate()->builtins()->StoreIC_Normal(); | |
1676 case CALLBACKS: { | 1675 case CALLBACKS: { |
1677 if (kind() == Code::KEYED_STORE_IC) break; | 1676 if (kind() == Code::KEYED_STORE_IC) break; |
1678 Handle<Object> callback(lookup->GetCallbackObject(), isolate()); | 1677 Handle<Object> callback(lookup->GetCallbackObject(), isolate()); |
1679 if (callback->IsExecutableAccessorInfo()) { | 1678 if (callback->IsExecutableAccessorInfo()) { |
1680 Handle<ExecutableAccessorInfo> info = | 1679 Handle<ExecutableAccessorInfo> info = |
1681 Handle<ExecutableAccessorInfo>::cast(callback); | 1680 Handle<ExecutableAccessorInfo>::cast(callback); |
1682 if (v8::ToCData<Address>(info->setter()) == 0) break; | 1681 if (v8::ToCData<Address>(info->setter()) == 0) break; |
1683 if (!holder->HasFastProperties()) break; | 1682 if (!holder->HasFastProperties()) break; |
1684 if (!info->IsCompatibleReceiver(*receiver)) break; | 1683 if (!info->IsCompatibleReceiver(*receiver)) break; |
1685 return compiler.CompileStoreCallback(receiver, holder, name, info); | 1684 return compiler.CompileStoreCallback(receiver, holder, name, info); |
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2768 #undef ADDR | 2767 #undef ADDR |
2769 }; | 2768 }; |
2770 | 2769 |
2771 | 2770 |
2772 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2771 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2773 return IC_utilities[id]; | 2772 return IC_utilities[id]; |
2774 } | 2773 } |
2775 | 2774 |
2776 | 2775 |
2777 } } // namespace v8::internal | 2776 } } // namespace v8::internal |
OLD | NEW |