OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 Handle<Code> code = use_ic ? ComputeHandler(lookup, value) : slow_stub(); | 1707 Handle<Code> code = use_ic ? ComputeHandler(lookup, value) : slow_stub(); |
1708 | 1708 |
1709 PatchCache(lookup->name(), code); | 1709 PatchCache(lookup->name(), code); |
1710 TRACE_IC("StoreIC", lookup->name()); | 1710 TRACE_IC("StoreIC", lookup->name()); |
1711 } | 1711 } |
1712 | 1712 |
1713 | 1713 |
1714 static Handle<Code> PropertyCellStoreHandler( | 1714 static Handle<Code> PropertyCellStoreHandler( |
1715 Isolate* isolate, Handle<JSObject> receiver, Handle<GlobalObject> holder, | 1715 Isolate* isolate, Handle<JSObject> receiver, Handle<GlobalObject> holder, |
1716 Handle<Name> name, Handle<PropertyCell> cell, PropertyCellType type) { | 1716 Handle<Name> name, Handle<PropertyCell> cell, PropertyCellType type) { |
1717 StoreGlobalStub stub(isolate, type == PropertyCellType::kConstant, | 1717 auto constant_type = Nothing<PropertyCellConstantType>(); |
| 1718 if (type == PropertyCellType::kConstantType) { |
| 1719 constant_type = Just(cell->GetConstantType()); |
| 1720 } |
| 1721 StoreGlobalStub stub(isolate, type, constant_type, |
1718 receiver->IsJSGlobalProxy()); | 1722 receiver->IsJSGlobalProxy()); |
1719 auto code = stub.GetCodeCopyFromTemplate(holder, cell); | 1723 auto code = stub.GetCodeCopyFromTemplate(holder, cell); |
1720 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. | 1724 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. |
1721 HeapObject::UpdateMapCodeCache(receiver, name, code); | 1725 HeapObject::UpdateMapCodeCache(receiver, name, code); |
1722 return code; | 1726 return code; |
1723 } | 1727 } |
1724 | 1728 |
1725 | 1729 |
1726 Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup, | 1730 Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup, |
1727 Handle<Object> value, | 1731 Handle<Object> value, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 } | 1812 } |
1809 break; | 1813 break; |
1810 } | 1814 } |
1811 | 1815 |
1812 case LookupIterator::DATA: { | 1816 case LookupIterator::DATA: { |
1813 if (lookup->is_dictionary_holder()) { | 1817 if (lookup->is_dictionary_holder()) { |
1814 if (holder->IsGlobalObject()) { | 1818 if (holder->IsGlobalObject()) { |
1815 DCHECK(holder.is_identical_to(receiver) || | 1819 DCHECK(holder.is_identical_to(receiver) || |
1816 receiver->map()->prototype() == *holder); | 1820 receiver->map()->prototype() == *holder); |
1817 auto cell = lookup->GetPropertyCell(); | 1821 auto cell = lookup->GetPropertyCell(); |
1818 auto union_type = PropertyCell::UpdatedType( | 1822 auto updated_type = PropertyCell::UpdatedType( |
1819 cell, value, lookup->property_details()); | 1823 cell, value, lookup->property_details()); |
1820 return PropertyCellStoreHandler(isolate(), receiver, | 1824 auto code = PropertyCellStoreHandler( |
1821 Handle<GlobalObject>::cast(holder), | 1825 isolate(), receiver, Handle<GlobalObject>::cast(holder), |
1822 lookup->name(), cell, union_type); | 1826 lookup->name(), cell, updated_type); |
| 1827 return code; |
1823 } | 1828 } |
1824 DCHECK(holder.is_identical_to(receiver)); | 1829 DCHECK(holder.is_identical_to(receiver)); |
1825 return isolate()->builtins()->StoreIC_Normal(); | 1830 return isolate()->builtins()->StoreIC_Normal(); |
1826 } | 1831 } |
1827 | 1832 |
1828 // -------------- Fields -------------- | 1833 // -------------- Fields -------------- |
1829 if (lookup->property_details().type() == DATA) { | 1834 if (lookup->property_details().type() == DATA) { |
1830 bool use_stub = true; | 1835 bool use_stub = true; |
1831 if (lookup->representation().IsHeapObject()) { | 1836 if (lookup->representation().IsHeapObject()) { |
1832 // Only use a generic stub if no types need to be tracked. | 1837 // Only use a generic stub if no types need to be tracked. |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3045 static const Address IC_utilities[] = { | 3050 static const Address IC_utilities[] = { |
3046 #define ADDR(name) FUNCTION_ADDR(name), | 3051 #define ADDR(name) FUNCTION_ADDR(name), |
3047 IC_UTIL_LIST(ADDR) NULL | 3052 IC_UTIL_LIST(ADDR) NULL |
3048 #undef ADDR | 3053 #undef ADDR |
3049 }; | 3054 }; |
3050 | 3055 |
3051 | 3056 |
3052 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3057 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
3053 } | 3058 } |
3054 } // namespace v8::internal | 3059 } // namespace v8::internal |
OLD | NEW |