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

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

Issue 98853002: StubCompiler gets extra_ic_state member. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 years 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
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 if (!ic.is_null()) return ic; 145 if (!ic.is_null()) return ic;
146 } 146 }
147 147
148 if (kind == Code::LOAD_IC) { 148 if (kind == Code::LOAD_IC) {
149 LoadStubCompiler ic_compiler(isolate(), flag); 149 LoadStubCompiler ic_compiler(isolate(), flag);
150 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); 150 ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
151 } else if (kind == Code::KEYED_LOAD_IC) { 151 } else if (kind == Code::KEYED_LOAD_IC) {
152 KeyedLoadStubCompiler ic_compiler(isolate(), flag); 152 KeyedLoadStubCompiler ic_compiler(isolate(), flag);
153 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); 153 ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
154 } else if (kind == Code::STORE_IC) { 154 } else if (kind == Code::STORE_IC) {
155 StrictModeFlag strict_mode = StoreIC::GetStrictMode(extra_ic_state); 155 StoreStubCompiler ic_compiler(isolate(), extra_ic_state);
156 StoreStubCompiler ic_compiler(isolate(), strict_mode);
157 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); 156 ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
158 } else { 157 } else {
159 ASSERT(kind == Code::KEYED_STORE_IC); 158 ASSERT(kind == Code::KEYED_STORE_IC);
160 StrictModeFlag strict_mode = StoreIC::GetStrictMode(extra_ic_state); 159 ASSERT(STANDARD_STORE ==
161 KeyedStoreStubCompiler ic_compiler(isolate(), strict_mode, STANDARD_STORE); 160 KeyedStoreIC::GetKeyedAccessStoreMode(extra_ic_state));
161 KeyedStoreStubCompiler ic_compiler(isolate(), extra_ic_state);
162 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); 162 ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
163 } 163 }
164 164
165 if (can_be_cached) Map::UpdateCodeCache(stub_holder, name, ic); 165 if (can_be_cached) Map::UpdateCodeCache(stub_holder, name, ic);
166 return ic; 166 return ic;
167 } 167 }
168 168
169 169
170 Handle<Code> StubCache::ComputeLoadNonexistent(Handle<Name> name, 170 Handle<Code> StubCache::ComputeLoadNonexistent(Handle<Name> name,
171 Handle<Type> type) { 171 Handle<Type> type) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 ASSERT(store_mode == STANDARD_STORE || 229 ASSERT(store_mode == STANDARD_STORE ||
230 store_mode == STORE_AND_GROW_NO_TRANSITION || 230 store_mode == STORE_AND_GROW_NO_TRANSITION ||
231 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || 231 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS ||
232 store_mode == STORE_NO_TRANSITION_HANDLE_COW); 232 store_mode == STORE_NO_TRANSITION_HANDLE_COW);
233 233
234 Handle<String> name = 234 Handle<String> name =
235 isolate()->factory()->KeyedStoreElementMonomorphic_string(); 235 isolate()->factory()->KeyedStoreElementMonomorphic_string();
236 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); 236 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_);
237 if (probe->IsCode()) return Handle<Code>::cast(probe); 237 if (probe->IsCode()) return Handle<Code>::cast(probe);
238 238
239 KeyedStoreStubCompiler compiler(isolate(), strict_mode, store_mode); 239 KeyedStoreStubCompiler compiler(isolate(), extra_state);
240 Handle<Code> code = compiler.CompileStoreElement(receiver_map); 240 Handle<Code> code = compiler.CompileStoreElement(receiver_map);
241 241
242 Map::UpdateCodeCache(receiver_map, name, code); 242 Map::UpdateCodeCache(receiver_map, name, code);
243 ASSERT(KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()) 243 ASSERT(KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state())
244 == store_mode); 244 == store_mode);
245 return code; 245 return code;
246 } 246 }
247 247
248 248
249 #define CALL_LOGGER_TAG(kind, type) \ 249 #define CALL_LOGGER_TAG(kind, type) \
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 store_mode == STORE_NO_TRANSITION_HANDLE_COW); 640 store_mode == STORE_NO_TRANSITION_HANDLE_COW);
641 Handle<PolymorphicCodeCache> cache = 641 Handle<PolymorphicCodeCache> cache =
642 isolate_->factory()->polymorphic_code_cache(); 642 isolate_->factory()->polymorphic_code_cache();
643 ExtraICState extra_state = KeyedStoreIC::ComputeExtraICState( 643 ExtraICState extra_state = KeyedStoreIC::ComputeExtraICState(
644 strict_mode, store_mode); 644 strict_mode, store_mode);
645 Code::Flags flags = 645 Code::Flags flags =
646 Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state); 646 Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state);
647 Handle<Object> probe = cache->Lookup(receiver_maps, flags); 647 Handle<Object> probe = cache->Lookup(receiver_maps, flags);
648 if (probe->IsCode()) return Handle<Code>::cast(probe); 648 if (probe->IsCode()) return Handle<Code>::cast(probe);
649 649
650 KeyedStoreStubCompiler compiler(isolate_, strict_mode, store_mode); 650 KeyedStoreStubCompiler compiler(isolate_, extra_state);
651 Handle<Code> code = compiler.CompileStoreElementPolymorphic(receiver_maps); 651 Handle<Code> code = compiler.CompileStoreElementPolymorphic(receiver_maps);
652 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); 652 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code);
653 return code; 653 return code;
654 } 654 }
655 655
656 656
657 #ifdef ENABLE_DEBUGGER_SUPPORT 657 #ifdef ENABLE_DEBUGGER_SUPPORT
658 Handle<Code> StubCache::ComputeCallDebugBreak(int argc, 658 Handle<Code> StubCache::ComputeCallDebugBreak(int argc,
659 Code::Kind kind) { 659 Code::Kind kind) {
660 // Extra IC state is irrelevant for debug break ICs. They jump to 660 // Extra IC state is irrelevant for debug break ICs. They jump to
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 if (lookup->IsFound()) return; 1122 if (lookup->IsFound()) return;
1123 if (holder->GetPrototype()->IsNull()) return; 1123 if (holder->GetPrototype()->IsNull()) return;
1124 holder->GetPrototype()->Lookup(*name, lookup); 1124 holder->GetPrototype()->Lookup(*name, lookup);
1125 } 1125 }
1126 1126
1127 1127
1128 #define __ ACCESS_MASM(masm()) 1128 #define __ ACCESS_MASM(masm())
1129 1129
1130 1130
1131 CallKind CallStubCompiler::call_kind() { 1131 CallKind CallStubCompiler::call_kind() {
1132 return CallICBase::Contextual::decode(extra_state_) 1132 return CallICBase::Contextual::decode(extra_state())
1133 ? CALL_AS_FUNCTION 1133 ? CALL_AS_FUNCTION
1134 : CALL_AS_METHOD; 1134 : CALL_AS_METHOD;
1135 } 1135 }
1136 1136
1137 1137
1138 void CallStubCompiler::HandlerFrontendFooter(Label* miss) { 1138 void CallStubCompiler::HandlerFrontendFooter(Label* miss) {
1139 __ bind(miss); 1139 __ bind(miss);
1140 GenerateMissBranch(); 1140 GenerateMissBranch();
1141 } 1141 }
1142 1142
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 Handle<Code> KeyedStoreStubCompiler::CompileStoreElement( 1570 Handle<Code> KeyedStoreStubCompiler::CompileStoreElement(
1571 Handle<Map> receiver_map) { 1571 Handle<Map> receiver_map) {
1572 ElementsKind elements_kind = receiver_map->elements_kind(); 1572 ElementsKind elements_kind = receiver_map->elements_kind();
1573 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE; 1573 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE;
1574 Handle<Code> stub; 1574 Handle<Code> stub;
1575 if (receiver_map->has_fast_elements() || 1575 if (receiver_map->has_fast_elements() ||
1576 receiver_map->has_external_array_elements()) { 1576 receiver_map->has_external_array_elements()) {
1577 stub = KeyedStoreFastElementStub( 1577 stub = KeyedStoreFastElementStub(
1578 is_jsarray, 1578 is_jsarray,
1579 elements_kind, 1579 elements_kind,
1580 store_mode_).GetCode(isolate()); 1580 store_mode()).GetCode(isolate());
1581 } else { 1581 } else {
1582 stub = KeyedStoreElementStub(is_jsarray, 1582 stub = KeyedStoreElementStub(is_jsarray,
1583 elements_kind, 1583 elements_kind,
1584 store_mode_).GetCode(isolate()); 1584 store_mode()).GetCode(isolate());
1585 } 1585 }
1586 1586
1587 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); 1587 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
1588 1588
1589 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); 1589 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss);
1590 1590
1591 // Return the generated code. 1591 // Return the generated code.
1592 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); 1592 return GetICCode(kind(), Code::NORMAL, factory()->empty_string());
1593 } 1593 }
1594 1594
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 // Tracking to do a better job of ensuring the data types are what they need 1700 // Tracking to do a better job of ensuring the data types are what they need
1701 // to be. Not all the elements are in place yet, pessimistic elements 1701 // to be. Not all the elements are in place yet, pessimistic elements
1702 // transitions are still important for performance. 1702 // transitions are still important for performance.
1703 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 1703 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
1704 ElementsKind elements_kind = receiver_map->elements_kind(); 1704 ElementsKind elements_kind = receiver_map->elements_kind();
1705 if (!transitioned_map.is_null()) { 1705 if (!transitioned_map.is_null()) {
1706 cached_stub = ElementsTransitionAndStoreStub( 1706 cached_stub = ElementsTransitionAndStoreStub(
1707 elements_kind, 1707 elements_kind,
1708 transitioned_map->elements_kind(), 1708 transitioned_map->elements_kind(),
1709 is_js_array, 1709 is_js_array,
1710 store_mode_).GetCode(isolate()); 1710 store_mode()).GetCode(isolate());
1711 } else { 1711 } else {
1712 if (receiver_map->has_fast_elements() || 1712 if (receiver_map->has_fast_elements() ||
1713 receiver_map->has_external_array_elements()) { 1713 receiver_map->has_external_array_elements()) {
1714 cached_stub = KeyedStoreFastElementStub( 1714 cached_stub = KeyedStoreFastElementStub(
1715 is_js_array, 1715 is_js_array,
1716 elements_kind, 1716 elements_kind,
1717 store_mode_).GetCode(isolate()); 1717 store_mode()).GetCode(isolate());
1718 } else { 1718 } else {
1719 cached_stub = KeyedStoreElementStub( 1719 cached_stub = KeyedStoreElementStub(
1720 is_js_array, 1720 is_js_array,
1721 elements_kind, 1721 elements_kind,
1722 store_mode_).GetCode(isolate()); 1722 store_mode()).GetCode(isolate());
1723 } 1723 }
1724 } 1724 }
1725 ASSERT(!cached_stub.is_null()); 1725 ASSERT(!cached_stub.is_null());
1726 handlers.Add(cached_stub); 1726 handlers.Add(cached_stub);
1727 transitioned_maps.Add(transitioned_map); 1727 transitioned_maps.Add(transitioned_map);
1728 } 1728 }
1729 Handle<Code> code = 1729 Handle<Code> code =
1730 CompileStorePolymorphic(receiver_maps, &handlers, &transitioned_maps); 1730 CompileStorePolymorphic(receiver_maps, &handlers, &transitioned_maps);
1731 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); 1731 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment();
1732 PROFILE(isolate(), 1732 PROFILE(isolate(),
1733 CodeCreateEvent(Logger::KEYED_STORE_POLYMORPHIC_IC_TAG, *code, 0)); 1733 CodeCreateEvent(Logger::KEYED_STORE_POLYMORPHIC_IC_TAG, *code, 0));
1734 return code; 1734 return code;
1735 } 1735 }
1736 1736
1737 1737
1738 void KeyedStoreStubCompiler::GenerateStoreDictionaryElement( 1738 void KeyedStoreStubCompiler::GenerateStoreDictionaryElement(
1739 MacroAssembler* masm) { 1739 MacroAssembler* masm) {
1740 KeyedStoreIC::GenerateSlow(masm); 1740 KeyedStoreIC::GenerateSlow(masm);
1741 } 1741 }
1742 1742
1743 1743
1744 CallStubCompiler::CallStubCompiler(Isolate* isolate, 1744 CallStubCompiler::CallStubCompiler(Isolate* isolate,
1745 int argc, 1745 int argc,
1746 Code::Kind kind, 1746 Code::Kind kind,
1747 ExtraICState extra_state, 1747 ExtraICState extra_state,
1748 InlineCacheHolderFlag cache_holder) 1748 InlineCacheHolderFlag cache_holder)
1749 : StubCompiler(isolate), 1749 : StubCompiler(isolate, extra_state),
1750 arguments_(argc), 1750 arguments_(argc),
1751 kind_(kind), 1751 kind_(kind),
1752 extra_state_(extra_state),
1753 cache_holder_(cache_holder) { 1752 cache_holder_(cache_holder) {
1754 } 1753 }
1755 1754
1756 1755
1757 bool CallStubCompiler::HasCustomCallGenerator(Handle<JSFunction> function) { 1756 bool CallStubCompiler::HasCustomCallGenerator(Handle<JSFunction> function) {
1758 if (function->shared()->HasBuiltinFunctionId()) { 1757 if (function->shared()->HasBuiltinFunctionId()) {
1759 BuiltinFunctionId id = function->shared()->builtin_function_id(); 1758 BuiltinFunctionId id = function->shared()->builtin_function_id();
1760 #define CALL_GENERATOR_CASE(name) if (id == k##name) return true; 1759 #define CALL_GENERATOR_CASE(name) if (id == k##name) return true;
1761 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE) 1760 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
1762 #undef CALL_GENERATOR_CASE 1761 #undef CALL_GENERATOR_CASE
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 cell, 1809 cell,
1811 function, 1810 function,
1812 fname); 1811 fname);
1813 } 1812 }
1814 1813
1815 1814
1816 Handle<Code> CallStubCompiler::GetCode(Code::StubType type, 1815 Handle<Code> CallStubCompiler::GetCode(Code::StubType type,
1817 Handle<Name> name) { 1816 Handle<Name> name) {
1818 int argc = arguments_.immediate(); 1817 int argc = arguments_.immediate();
1819 Code::Flags flags = Code::ComputeMonomorphicFlags( 1818 Code::Flags flags = Code::ComputeMonomorphicFlags(
1820 kind_, extra_state_, cache_holder_, type, argc); 1819 kind_, extra_state(), cache_holder_, type, argc);
1821 return GetCodeWithFlags(flags, name); 1820 return GetCodeWithFlags(flags, name);
1822 } 1821 }
1823 1822
1824 1823
1825 Handle<Code> CallStubCompiler::GetCode(Handle<JSFunction> function) { 1824 Handle<Code> CallStubCompiler::GetCode(Handle<JSFunction> function) {
1826 Handle<String> function_name; 1825 Handle<String> function_name;
1827 if (function->shared()->name()->IsString()) { 1826 if (function->shared()->name()->IsString()) {
1828 function_name = Handle<String>(String::cast(function->shared()->name())); 1827 function_name = Handle<String>(String::cast(function->shared()->name()));
1829 } 1828 }
1830 return GetCode(Code::FAST, function_name); 1829 return GetCode(Code::FAST, function_name);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 Handle<FunctionTemplateInfo>( 1897 Handle<FunctionTemplateInfo>(
1899 FunctionTemplateInfo::cast(signature->receiver())); 1898 FunctionTemplateInfo::cast(signature->receiver()));
1900 } 1899 }
1901 } 1900 }
1902 1901
1903 is_simple_api_call_ = true; 1902 is_simple_api_call_ = true;
1904 } 1903 }
1905 1904
1906 1905
1907 } } // namespace v8::internal 1906 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698