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 auto constant_type = Nothing<PropertyCellConstantType>(); | 1717 StoreGlobalStub stub(isolate, type == PropertyCellType::kConstant, |
1718 if (type == PropertyCellType::kConstantType) { | |
1719 constant_type = Just(cell->GetConstantType()); | |
1720 } | |
1721 StoreGlobalStub stub(isolate, type, constant_type, | |
1722 receiver->IsJSGlobalProxy()); | 1718 receiver->IsJSGlobalProxy()); |
1723 auto code = stub.GetCodeCopyFromTemplate(holder, cell); | 1719 auto code = stub.GetCodeCopyFromTemplate(holder, cell); |
1724 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. | 1720 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. |
1725 HeapObject::UpdateMapCodeCache(receiver, name, code); | 1721 HeapObject::UpdateMapCodeCache(receiver, name, code); |
1726 return code; | 1722 return code; |
1727 } | 1723 } |
1728 | 1724 |
1729 | 1725 |
1730 Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup, | 1726 Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup, |
1731 Handle<Object> value, | 1727 Handle<Object> value, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 } | 1808 } |
1813 break; | 1809 break; |
1814 } | 1810 } |
1815 | 1811 |
1816 case LookupIterator::DATA: { | 1812 case LookupIterator::DATA: { |
1817 if (lookup->is_dictionary_holder()) { | 1813 if (lookup->is_dictionary_holder()) { |
1818 if (holder->IsGlobalObject()) { | 1814 if (holder->IsGlobalObject()) { |
1819 DCHECK(holder.is_identical_to(receiver) || | 1815 DCHECK(holder.is_identical_to(receiver) || |
1820 receiver->map()->prototype() == *holder); | 1816 receiver->map()->prototype() == *holder); |
1821 auto cell = lookup->GetPropertyCell(); | 1817 auto cell = lookup->GetPropertyCell(); |
1822 auto updated_type = PropertyCell::UpdatedType( | 1818 auto union_type = PropertyCell::UpdatedType( |
1823 cell, value, lookup->property_details()); | 1819 cell, value, lookup->property_details()); |
1824 auto code = PropertyCellStoreHandler( | 1820 return PropertyCellStoreHandler(isolate(), receiver, |
1825 isolate(), receiver, Handle<GlobalObject>::cast(holder), | 1821 Handle<GlobalObject>::cast(holder), |
1826 lookup->name(), cell, updated_type); | 1822 lookup->name(), cell, union_type); |
1827 return code; | |
1828 } | 1823 } |
1829 DCHECK(holder.is_identical_to(receiver)); | 1824 DCHECK(holder.is_identical_to(receiver)); |
1830 return isolate()->builtins()->StoreIC_Normal(); | 1825 return isolate()->builtins()->StoreIC_Normal(); |
1831 } | 1826 } |
1832 | 1827 |
1833 // -------------- Fields -------------- | 1828 // -------------- Fields -------------- |
1834 if (lookup->property_details().type() == DATA) { | 1829 if (lookup->property_details().type() == DATA) { |
1835 bool use_stub = true; | 1830 bool use_stub = true; |
1836 if (lookup->representation().IsHeapObject()) { | 1831 if (lookup->representation().IsHeapObject()) { |
1837 // Only use a generic stub if no types need to be tracked. | 1832 // 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... |
3050 static const Address IC_utilities[] = { | 3045 static const Address IC_utilities[] = { |
3051 #define ADDR(name) FUNCTION_ADDR(name), | 3046 #define ADDR(name) FUNCTION_ADDR(name), |
3052 IC_UTIL_LIST(ADDR) NULL | 3047 IC_UTIL_LIST(ADDR) NULL |
3053 #undef ADDR | 3048 #undef ADDR |
3054 }; | 3049 }; |
3055 | 3050 |
3056 | 3051 |
3057 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3052 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
3058 } | 3053 } |
3059 } // namespace v8::internal | 3054 } // namespace v8::internal |
OLD | NEW |