Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/stub-cache.cc

Issue 12221064: Implement many KeyedStoreStubs using Crankshaft (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add runtime flag and address review feedback Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/ic.cc ('K') | « src/runtime.cc ('k') | src/type-info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 1741 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
1738 ElementsKind elements_kind = receiver_map->elements_kind(); 1742 ElementsKind elements_kind = receiver_map->elements_kind();
1739 if (!transitioned_map.is_null()) { 1743 if (!transitioned_map.is_null()) {
1740 cached_stub = ElementsTransitionAndStoreStub( 1744 cached_stub = ElementsTransitionAndStoreStub(
1741 elements_kind, 1745 elements_kind,
1742 transitioned_map->elements_kind(), 1746 transitioned_map->elements_kind(),
1743 is_js_array, 1747 is_js_array,
1744 strict_mode(), 1748 strict_mode(),
1745 store_mode_).GetCode(isolate()); 1749 store_mode_).GetCode(isolate());
1746 } else { 1750 } else {
1747 cached_stub = KeyedStoreElementStub( 1751 if (FLAG_compiled_keyed_stores &&
1748 is_js_array, 1752 (receiver_map->has_fast_elements() ||
1749 elements_kind, 1753 receiver_map->has_external_array_elements())) {
1750 store_mode_).GetCode(isolate()); 1754 cached_stub = KeyedStoreFastElementStub(
1755 is_js_array,
1756 elements_kind,
1757 store_mode_).GetCode(isolate());
1758 } else {
1759 cached_stub = KeyedStoreElementStub(
1760 is_js_array,
1761 elements_kind,
1762 store_mode_).GetCode(isolate());
1763 }
1751 } 1764 }
1752 ASSERT(!cached_stub.is_null()); 1765 ASSERT(!cached_stub.is_null());
1753 handlers.Add(cached_stub); 1766 handlers.Add(cached_stub);
1754 transitioned_maps.Add(transitioned_map); 1767 transitioned_maps.Add(transitioned_map);
1755 } 1768 }
1756 Handle<Code> code = 1769 Handle<Code> code =
1757 CompileStorePolymorphic(receiver_maps, &handlers, &transitioned_maps); 1770 CompileStorePolymorphic(receiver_maps, &handlers, &transitioned_maps);
1758 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); 1771 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment();
1759 PROFILE(isolate(), 1772 PROFILE(isolate(),
1760 CodeCreateEvent(Logger::KEYED_STORE_POLYMORPHIC_IC_TAG, *code, 0)); 1773 CodeCreateEvent(Logger::KEYED_STORE_POLYMORPHIC_IC_TAG, *code, 0));
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 Handle<FunctionTemplateInfo>( 1935 Handle<FunctionTemplateInfo>(
1923 FunctionTemplateInfo::cast(signature->receiver())); 1936 FunctionTemplateInfo::cast(signature->receiver()));
1924 } 1937 }
1925 } 1938 }
1926 1939
1927 is_simple_api_call_ = true; 1940 is_simple_api_call_ = true;
1928 } 1941 }
1929 1942
1930 1943
1931 } } // namespace v8::internal 1944 } } // namespace v8::internal
OLDNEW
« src/ic.cc ('K') | « src/runtime.cc ('k') | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698