| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 Handle<Code> StubCache::ComputeKeyedStoreElement( | 439 Handle<Code> StubCache::ComputeKeyedStoreElement( |
| 440 Handle<Map> receiver_map, | 440 Handle<Map> receiver_map, |
| 441 StrictModeFlag strict_mode, | 441 StrictModeFlag strict_mode, |
| 442 KeyedAccessStoreMode store_mode) { | 442 KeyedAccessStoreMode store_mode) { |
| 443 Code::ExtraICState extra_state = | 443 Code::ExtraICState extra_state = |
| 444 Code::ComputeExtraICState(store_mode, strict_mode); | 444 Code::ComputeExtraICState(store_mode, strict_mode); |
| 445 Code::Flags flags = Code::ComputeMonomorphicFlags( | 445 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 446 Code::KEYED_STORE_IC, extra_state); | 446 Code::KEYED_STORE_IC, extra_state); |
| 447 | 447 |
| 448 ASSERT(store_mode == STANDARD_STORE || | 448 ASSERT(store_mode == STANDARD_STORE || |
| 449 store_mode == STORE_AND_GROW_NO_TRANSITION); | 449 store_mode == STORE_AND_GROW_NO_TRANSITION || |
| 450 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
| 451 store_mode == STORE_NO_TRANSITION_HANDLE_COW); |
| 450 | 452 |
| 451 Handle<String> name = | 453 Handle<String> name = |
| 452 isolate()->factory()->KeyedStoreElementMonomorphic_string(); | 454 isolate()->factory()->KeyedStoreElementMonomorphic_string(); |
| 453 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); | 455 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); |
| 454 if (probe->IsCode()) return Handle<Code>::cast(probe); | 456 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 455 | 457 |
| 456 KeyedStoreStubCompiler compiler(isolate(), strict_mode, store_mode); | 458 KeyedStoreStubCompiler compiler(isolate(), strict_mode, store_mode); |
| 457 Handle<Code> code = compiler.CompileStoreElement(receiver_map); | 459 Handle<Code> code = compiler.CompileStoreElement(receiver_map); |
| 458 | 460 |
| 459 Map::UpdateCodeCache(receiver_map, name, code); | 461 Map::UpdateCodeCache(receiver_map, name, code); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 receiver_maps, handlers, name, type, PROPERTY); | 909 receiver_maps, handlers, name, type, PROPERTY); |
| 908 return ic; | 910 return ic; |
| 909 } | 911 } |
| 910 | 912 |
| 911 | 913 |
| 912 Handle<Code> StubCache::ComputeStoreElementPolymorphic( | 914 Handle<Code> StubCache::ComputeStoreElementPolymorphic( |
| 913 MapHandleList* receiver_maps, | 915 MapHandleList* receiver_maps, |
| 914 KeyedAccessStoreMode store_mode, | 916 KeyedAccessStoreMode store_mode, |
| 915 StrictModeFlag strict_mode) { | 917 StrictModeFlag strict_mode) { |
| 916 ASSERT(store_mode == STANDARD_STORE || | 918 ASSERT(store_mode == STANDARD_STORE || |
| 917 store_mode == STORE_AND_GROW_NO_TRANSITION); | 919 store_mode == STORE_AND_GROW_NO_TRANSITION || |
| 920 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
| 921 store_mode == STORE_NO_TRANSITION_HANDLE_COW); |
| 918 Handle<PolymorphicCodeCache> cache = | 922 Handle<PolymorphicCodeCache> cache = |
| 919 isolate_->factory()->polymorphic_code_cache(); | 923 isolate_->factory()->polymorphic_code_cache(); |
| 920 Code::ExtraICState extra_state = Code::ComputeExtraICState(store_mode, | 924 Code::ExtraICState extra_state = Code::ComputeExtraICState(store_mode, |
| 921 strict_mode); | 925 strict_mode); |
| 922 Code::Flags flags = | 926 Code::Flags flags = |
| 923 Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state); | 927 Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state); |
| 924 Handle<Object> probe = cache->Lookup(receiver_maps, flags); | 928 Handle<Object> probe = cache->Lookup(receiver_maps, flags); |
| 925 if (probe->IsCode()) return Handle<Code>::cast(probe); | 929 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 926 | 930 |
| 927 KeyedStoreStubCompiler compiler(isolate_, strict_mode, store_mode); | 931 KeyedStoreStubCompiler compiler(isolate_, strict_mode, store_mode); |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1692 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 1696 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 1693 ElementsKind elements_kind = receiver_map->elements_kind(); | 1697 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 1694 if (!transitioned_map.is_null()) { | 1698 if (!transitioned_map.is_null()) { |
| 1695 cached_stub = ElementsTransitionAndStoreStub( | 1699 cached_stub = ElementsTransitionAndStoreStub( |
| 1696 elements_kind, | 1700 elements_kind, |
| 1697 transitioned_map->elements_kind(), | 1701 transitioned_map->elements_kind(), |
| 1698 is_js_array, | 1702 is_js_array, |
| 1699 strict_mode_, | 1703 strict_mode_, |
| 1700 store_mode_).GetCode(isolate()); | 1704 store_mode_).GetCode(isolate()); |
| 1701 } else { | 1705 } else { |
| 1702 cached_stub = KeyedStoreElementStub( | 1706 if (receiver_map->has_fast_elements() || |
| 1703 is_js_array, | 1707 receiver_map->has_external_array_elements()) { |
| 1704 elements_kind, | 1708 cached_stub = KeyedStoreFastElementStub( |
| 1705 store_mode_).GetCode(isolate()); | 1709 is_js_array, |
| 1710 elements_kind, |
| 1711 store_mode_).GetCode(isolate()); |
| 1712 } else { |
| 1713 cached_stub = KeyedStoreElementStub( |
| 1714 is_js_array, |
| 1715 elements_kind, |
| 1716 store_mode_).GetCode(isolate()); |
| 1717 } |
| 1706 } | 1718 } |
| 1707 ASSERT(!cached_stub.is_null()); | 1719 ASSERT(!cached_stub.is_null()); |
| 1708 handlers.Add(cached_stub); | 1720 handlers.Add(cached_stub); |
| 1709 transitioned_maps.Add(transitioned_map); | 1721 transitioned_maps.Add(transitioned_map); |
| 1710 } | 1722 } |
| 1711 Handle<Code> code = | 1723 Handle<Code> code = |
| 1712 CompileStorePolymorphic(receiver_maps, &handlers, &transitioned_maps); | 1724 CompileStorePolymorphic(receiver_maps, &handlers, &transitioned_maps); |
| 1713 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); | 1725 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); |
| 1714 PROFILE(isolate(), | 1726 PROFILE(isolate(), |
| 1715 CodeCreateEvent(Logger::KEYED_STORE_POLYMORPHIC_IC_TAG, *code, 0)); | 1727 CodeCreateEvent(Logger::KEYED_STORE_POLYMORPHIC_IC_TAG, *code, 0)); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1877 Handle<FunctionTemplateInfo>( | 1889 Handle<FunctionTemplateInfo>( |
| 1878 FunctionTemplateInfo::cast(signature->receiver())); | 1890 FunctionTemplateInfo::cast(signature->receiver())); |
| 1879 } | 1891 } |
| 1880 } | 1892 } |
| 1881 | 1893 |
| 1882 is_simple_api_call_ = true; | 1894 is_simple_api_call_ = true; |
| 1883 } | 1895 } |
| 1884 | 1896 |
| 1885 | 1897 |
| 1886 } } // namespace v8::internal | 1898 } } // namespace v8::internal |
| OLD | NEW |