| 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 Handle<Code> StubCache::ComputeKeyedStoreElement( | 434 Handle<Code> StubCache::ComputeKeyedStoreElement( |
| 435 Handle<Map> receiver_map, | 435 Handle<Map> receiver_map, |
| 436 StrictModeFlag strict_mode, | 436 StrictModeFlag strict_mode, |
| 437 KeyedAccessStoreMode store_mode) { | 437 KeyedAccessStoreMode store_mode) { |
| 438 Code::ExtraICState extra_state = | 438 Code::ExtraICState extra_state = |
| 439 Code::ComputeExtraICState(store_mode, strict_mode); | 439 Code::ComputeExtraICState(store_mode, strict_mode); |
| 440 Code::Flags flags = Code::ComputeMonomorphicFlags( | 440 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 441 Code::KEYED_STORE_IC, extra_state); | 441 Code::KEYED_STORE_IC, extra_state); |
| 442 | 442 |
| 443 ASSERT(store_mode == STANDARD_STORE || | 443 ASSERT(store_mode == STANDARD_STORE || |
| 444 store_mode == STORE_AND_GROW_NO_TRANSITION); | 444 store_mode == STORE_AND_GROW_NO_TRANSITION || |
| 445 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
| 446 store_mode == STORE_NO_TRANSITION_HANDLE_COW); |
| 445 | 447 |
| 446 Handle<String> name = | 448 Handle<String> name = |
| 447 isolate()->factory()->KeyedStoreElementMonomorphic_string(); | 449 isolate()->factory()->KeyedStoreElementMonomorphic_string(); |
| 448 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); | 450 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); |
| 449 if (probe->IsCode()) return Handle<Code>::cast(probe); | 451 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 450 | 452 |
| 451 KeyedStoreStubCompiler compiler(isolate(), strict_mode, store_mode); | 453 KeyedStoreStubCompiler compiler(isolate(), strict_mode, store_mode); |
| 452 Handle<Code> code = compiler.CompileStoreElement(receiver_map); | 454 Handle<Code> code = compiler.CompileStoreElement(receiver_map); |
| 453 | 455 |
| 454 Map::UpdateCodeCache(receiver_map, name, code); | 456 Map::UpdateCodeCache(receiver_map, name, code); |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 receiver_maps, handlers, name, type, PROPERTY); | 894 receiver_maps, handlers, name, type, PROPERTY); |
| 893 return ic; | 895 return ic; |
| 894 } | 896 } |
| 895 | 897 |
| 896 | 898 |
| 897 Handle<Code> StubCache::ComputeStoreElementPolymorphic( | 899 Handle<Code> StubCache::ComputeStoreElementPolymorphic( |
| 898 MapHandleList* receiver_maps, | 900 MapHandleList* receiver_maps, |
| 899 KeyedAccessStoreMode store_mode, | 901 KeyedAccessStoreMode store_mode, |
| 900 StrictModeFlag strict_mode) { | 902 StrictModeFlag strict_mode) { |
| 901 ASSERT(store_mode == STANDARD_STORE || | 903 ASSERT(store_mode == STANDARD_STORE || |
| 902 store_mode == STORE_AND_GROW_NO_TRANSITION); | 904 store_mode == STORE_AND_GROW_NO_TRANSITION || |
| 905 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
| 906 store_mode == STORE_NO_TRANSITION_HANDLE_COW); |
| 903 Handle<PolymorphicCodeCache> cache = | 907 Handle<PolymorphicCodeCache> cache = |
| 904 isolate_->factory()->polymorphic_code_cache(); | 908 isolate_->factory()->polymorphic_code_cache(); |
| 905 Code::ExtraICState extra_state = Code::ComputeExtraICState(store_mode, | 909 Code::ExtraICState extra_state = Code::ComputeExtraICState(store_mode, |
| 906 strict_mode); | 910 strict_mode); |
| 907 Code::Flags flags = | 911 Code::Flags flags = |
| 908 Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state); | 912 Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state); |
| 909 Handle<Object> probe = cache->Lookup(receiver_maps, flags); | 913 Handle<Object> probe = cache->Lookup(receiver_maps, flags); |
| 910 if (probe->IsCode()) return Handle<Code>::cast(probe); | 914 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 911 | 915 |
| 912 KeyedStoreStubCompiler compiler(isolate_, strict_mode, store_mode); | 916 KeyedStoreStubCompiler compiler(isolate_, strict_mode, store_mode); |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 | 1657 |
| 1654 // Return the generated code. | 1658 // Return the generated code. |
| 1655 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); | 1659 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); |
| 1656 } | 1660 } |
| 1657 | 1661 |
| 1658 | 1662 |
| 1659 Handle<Code> KeyedStoreStubCompiler::CompileStoreElement( | 1663 Handle<Code> KeyedStoreStubCompiler::CompileStoreElement( |
| 1660 Handle<Map> receiver_map) { | 1664 Handle<Map> receiver_map) { |
| 1661 ElementsKind elements_kind = receiver_map->elements_kind(); | 1665 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 1662 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE; | 1666 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 1663 Handle<Code> stub = | 1667 Handle<Code> stub; |
| 1664 KeyedStoreElementStub(is_jsarray, | 1668 if (FLAG_compiled_keyed_stores && |
| 1665 elements_kind, | 1669 (receiver_map->has_fast_elements() || |
| 1666 store_mode_).GetCode(isolate()); | 1670 receiver_map->has_external_array_elements())) { |
| 1671 stub = KeyedStoreFastElementStub( |
| 1672 is_jsarray, |
| 1673 elements_kind, |
| 1674 store_mode_).GetCode(isolate()); |
| 1675 } else { |
| 1676 stub = KeyedStoreElementStub(is_jsarray, |
| 1677 elements_kind, |
| 1678 store_mode_).GetCode(isolate()); |
| 1679 } |
| 1667 | 1680 |
| 1668 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); | 1681 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); |
| 1669 | 1682 |
| 1670 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); | 1683 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); |
| 1671 | 1684 |
| 1672 // Return the generated code. | 1685 // Return the generated code. |
| 1673 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); | 1686 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); |
| 1674 } | 1687 } |
| 1675 | 1688 |
| 1676 | 1689 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1802 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 1815 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 1803 ElementsKind elements_kind = receiver_map->elements_kind(); | 1816 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 1804 if (!transitioned_map.is_null()) { | 1817 if (!transitioned_map.is_null()) { |
| 1805 cached_stub = ElementsTransitionAndStoreStub( | 1818 cached_stub = ElementsTransitionAndStoreStub( |
| 1806 elements_kind, | 1819 elements_kind, |
| 1807 transitioned_map->elements_kind(), | 1820 transitioned_map->elements_kind(), |
| 1808 is_js_array, | 1821 is_js_array, |
| 1809 strict_mode(), | 1822 strict_mode(), |
| 1810 store_mode_).GetCode(isolate()); | 1823 store_mode_).GetCode(isolate()); |
| 1811 } else { | 1824 } else { |
| 1812 cached_stub = KeyedStoreElementStub( | 1825 if (FLAG_compiled_keyed_stores && |
| 1813 is_js_array, | 1826 (receiver_map->has_fast_elements() || |
| 1814 elements_kind, | 1827 receiver_map->has_external_array_elements())) { |
| 1815 store_mode_).GetCode(isolate()); | 1828 cached_stub = KeyedStoreFastElementStub( |
| 1829 is_js_array, |
| 1830 elements_kind, |
| 1831 store_mode_).GetCode(isolate()); |
| 1832 } else { |
| 1833 cached_stub = KeyedStoreElementStub( |
| 1834 is_js_array, |
| 1835 elements_kind, |
| 1836 store_mode_).GetCode(isolate()); |
| 1837 } |
| 1816 } | 1838 } |
| 1817 ASSERT(!cached_stub.is_null()); | 1839 ASSERT(!cached_stub.is_null()); |
| 1818 handlers.Add(cached_stub); | 1840 handlers.Add(cached_stub); |
| 1819 transitioned_maps.Add(transitioned_map); | 1841 transitioned_maps.Add(transitioned_map); |
| 1820 } | 1842 } |
| 1821 Handle<Code> code = | 1843 Handle<Code> code = |
| 1822 CompileStorePolymorphic(receiver_maps, &handlers, &transitioned_maps); | 1844 CompileStorePolymorphic(receiver_maps, &handlers, &transitioned_maps); |
| 1823 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); | 1845 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); |
| 1824 PROFILE(isolate(), | 1846 PROFILE(isolate(), |
| 1825 CodeCreateEvent(Logger::KEYED_STORE_POLYMORPHIC_IC_TAG, *code, 0)); | 1847 CodeCreateEvent(Logger::KEYED_STORE_POLYMORPHIC_IC_TAG, *code, 0)); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1987 Handle<FunctionTemplateInfo>( | 2009 Handle<FunctionTemplateInfo>( |
| 1988 FunctionTemplateInfo::cast(signature->receiver())); | 2010 FunctionTemplateInfo::cast(signature->receiver())); |
| 1989 } | 2011 } |
| 1990 } | 2012 } |
| 1991 | 2013 |
| 1992 is_simple_api_call_ = true; | 2014 is_simple_api_call_ = true; |
| 1993 } | 2015 } |
| 1994 | 2016 |
| 1995 | 2017 |
| 1996 } } // namespace v8::internal | 2018 } } // namespace v8::internal |
| OLD | NEW |