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 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 } | 1244 } |
1245 // There is only one shared stub for loading normalized | 1245 // There is only one shared stub for loading normalized |
1246 // properties. It does not traverse the prototype chain, so the | 1246 // properties. It does not traverse the prototype chain, so the |
1247 // property must be found in the object for the stub to be | 1247 // property must be found in the object for the stub to be |
1248 // applicable. | 1248 // applicable. |
1249 if (!receiver_is_holder) break; | 1249 if (!receiver_is_holder) break; |
1250 return isolate()->builtins()->LoadIC_Normal(); | 1250 return isolate()->builtins()->LoadIC_Normal(); |
1251 } | 1251 } |
1252 | 1252 |
1253 // -------------- Fields -------------- | 1253 // -------------- Fields -------------- |
1254 if (lookup->property_details().type() == FIELD) { | 1254 if (lookup->property_details().type() == DATA_FIELD) { |
1255 FieldIndex field = lookup->GetFieldIndex(); | 1255 FieldIndex field = lookup->GetFieldIndex(); |
1256 if (receiver_is_holder) { | 1256 if (receiver_is_holder) { |
1257 return SimpleFieldLoad(field); | 1257 return SimpleFieldLoad(field); |
1258 } | 1258 } |
1259 NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder, | 1259 NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder, |
1260 cache_holder); | 1260 cache_holder); |
1261 return compiler.CompileLoadField(lookup->name(), field); | 1261 return compiler.CompileLoadField(lookup->name(), field); |
1262 } | 1262 } |
1263 | 1263 |
1264 // -------------- Constant properties -------------- | 1264 // -------------- Constant properties -------------- |
1265 DCHECK(lookup->property_details().type() == CONSTANT); | 1265 DCHECK(lookup->property_details().type() == DATA_CONSTANT); |
1266 if (receiver_is_holder) { | 1266 if (receiver_is_holder) { |
1267 LoadConstantStub stub(isolate(), lookup->GetConstantIndex()); | 1267 LoadConstantStub stub(isolate(), lookup->GetConstantIndex()); |
1268 return stub.GetCode(); | 1268 return stub.GetCode(); |
1269 } | 1269 } |
1270 NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder, | 1270 NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder, |
1271 cache_holder); | 1271 cache_holder); |
1272 return compiler.CompileLoadConstant(lookup->name(), | 1272 return compiler.CompileLoadConstant(lookup->name(), |
1273 lookup->GetConstantIndex()); | 1273 lookup->GetConstantIndex()); |
1274 } | 1274 } |
1275 | 1275 |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1744 Handle<GlobalObject>::cast(holder), cell); | 1744 Handle<GlobalObject>::cast(holder), cell); |
1745 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. | 1745 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. |
1746 HeapObject::UpdateMapCodeCache(receiver, lookup->name(), code); | 1746 HeapObject::UpdateMapCodeCache(receiver, lookup->name(), code); |
1747 return code; | 1747 return code; |
1748 } | 1748 } |
1749 DCHECK(holder.is_identical_to(receiver)); | 1749 DCHECK(holder.is_identical_to(receiver)); |
1750 return isolate()->builtins()->StoreIC_Normal(); | 1750 return isolate()->builtins()->StoreIC_Normal(); |
1751 } | 1751 } |
1752 | 1752 |
1753 // -------------- Fields -------------- | 1753 // -------------- Fields -------------- |
1754 if (lookup->property_details().type() == FIELD) { | 1754 if (lookup->property_details().type() == DATA_FIELD) { |
1755 bool use_stub = true; | 1755 bool use_stub = true; |
1756 if (lookup->representation().IsHeapObject()) { | 1756 if (lookup->representation().IsHeapObject()) { |
1757 // Only use a generic stub if no types need to be tracked. | 1757 // Only use a generic stub if no types need to be tracked. |
1758 Handle<HeapType> field_type = lookup->GetFieldType(); | 1758 Handle<HeapType> field_type = lookup->GetFieldType(); |
1759 HeapType::Iterator<Map> it = field_type->Classes(); | 1759 HeapType::Iterator<Map> it = field_type->Classes(); |
1760 use_stub = it.Done(); | 1760 use_stub = it.Done(); |
1761 } | 1761 } |
1762 if (use_stub) { | 1762 if (use_stub) { |
1763 StoreFieldStub stub(isolate(), lookup->GetFieldIndex(), | 1763 StoreFieldStub stub(isolate(), lookup->GetFieldIndex(), |
1764 lookup->representation()); | 1764 lookup->representation()); |
1765 return stub.GetCode(); | 1765 return stub.GetCode(); |
1766 } | 1766 } |
1767 NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder); | 1767 NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder); |
1768 return compiler.CompileStoreField(lookup); | 1768 return compiler.CompileStoreField(lookup); |
1769 } | 1769 } |
1770 | 1770 |
1771 // -------------- Constant properties -------------- | 1771 // -------------- Constant properties -------------- |
1772 DCHECK(lookup->property_details().type() == CONSTANT); | 1772 DCHECK(lookup->property_details().type() == DATA_CONSTANT); |
1773 TRACE_GENERIC_IC(isolate(), "StoreIC", "constant property"); | 1773 TRACE_GENERIC_IC(isolate(), "StoreIC", "constant property"); |
1774 break; | 1774 break; |
1775 } | 1775 } |
1776 | 1776 |
1777 case LookupIterator::ACCESS_CHECK: | 1777 case LookupIterator::ACCESS_CHECK: |
1778 case LookupIterator::JSPROXY: | 1778 case LookupIterator::JSPROXY: |
1779 case LookupIterator::NOT_FOUND: | 1779 case LookupIterator::NOT_FOUND: |
1780 UNREACHABLE(); | 1780 UNREACHABLE(); |
1781 } | 1781 } |
1782 return slow_stub(); | 1782 return slow_stub(); |
1783 } | 1783 } |
1784 | 1784 |
1785 | 1785 |
1786 Handle<Code> KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver, | 1786 Handle<Code> KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver, |
1787 KeyedAccessStoreMode store_mode) { | 1787 KeyedAccessStoreMode store_mode) { |
1788 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS | 1788 // Don't handle megamorphic property accesses for INTERCEPTORS or |
| 1789 // ACCESSOR_CONSTANT |
1789 // via megamorphic stubs, since they don't have a map in their relocation info | 1790 // via megamorphic stubs, since they don't have a map in their relocation info |
1790 // and so the stubs can't be harvested for the object needed for a map check. | 1791 // and so the stubs can't be harvested for the object needed for a map check. |
1791 if (target()->type() != Code::NORMAL) { | 1792 if (target()->type() != Code::NORMAL) { |
1792 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "non-NORMAL target type"); | 1793 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "non-NORMAL target type"); |
1793 return generic_stub(); | 1794 return generic_stub(); |
1794 } | 1795 } |
1795 | 1796 |
1796 Handle<Map> receiver_map(receiver->map(), isolate()); | 1797 Handle<Map> receiver_map(receiver->map(), isolate()); |
1797 MapHandleList target_receiver_maps; | 1798 MapHandleList target_receiver_maps; |
1798 TargetMaps(&target_receiver_maps); | 1799 TargetMaps(&target_receiver_maps); |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2967 static const Address IC_utilities[] = { | 2968 static const Address IC_utilities[] = { |
2968 #define ADDR(name) FUNCTION_ADDR(name), | 2969 #define ADDR(name) FUNCTION_ADDR(name), |
2969 IC_UTIL_LIST(ADDR) NULL | 2970 IC_UTIL_LIST(ADDR) NULL |
2970 #undef ADDR | 2971 #undef ADDR |
2971 }; | 2972 }; |
2972 | 2973 |
2973 | 2974 |
2974 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 2975 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
2975 } | 2976 } |
2976 } // namespace v8::internal | 2977 } // namespace v8::internal |
OLD | NEW |