| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef V8_SRC_IC_ACCESSOR_ASSEMBLER_IMPL_H_ | 5 #ifndef V8_SRC_IC_ACCESSOR_ASSEMBLER_IMPL_H_ |
| 6 #define V8_SRC_IC_ACCESSOR_ASSEMBLER_IMPL_H_ | 6 #define V8_SRC_IC_ACCESSOR_ASSEMBLER_IMPL_H_ |
| 7 | 7 |
| 8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 namespace compiler { | 13 namespace compiler { |
| 14 class CodeAssemblerState; | 14 class CodeAssemblerState; |
| 15 } | 15 } |
| 16 | 16 |
| 17 using compiler::Node; | 17 using compiler::Node; |
| 18 | 18 |
| 19 #define ACCESSOR_ASSEMBLER_PUBLIC_INTERFACE(V) \ | 19 #define ACCESSOR_ASSEMBLER_PUBLIC_INTERFACE(V) \ |
| 20 V(LoadIC) \ | 20 V(LoadIC) \ |
| 21 V(LoadICTrampoline) \ | 21 V(LoadICTrampoline) \ |
| 22 V(LoadICProtoArray) \ | |
| 23 V(LoadGlobalIC) \ | |
| 24 V(LoadGlobalICTrampoline) \ | |
| 25 V(KeyedLoadICTF) \ | 22 V(KeyedLoadICTF) \ |
| 26 V(KeyedLoadICTrampolineTF) \ | 23 V(KeyedLoadICTrampolineTF) \ |
| 27 V(KeyedLoadICMegamorphic) \ | 24 V(KeyedLoadICMegamorphic) \ |
| 28 V(StoreIC) \ | 25 V(StoreIC) \ |
| 29 V(StoreICTrampoline) | 26 V(StoreICTrampoline) |
| 30 // KeyedStoreIC and KeyedStoreICTrampoline need custom handling because of | 27 // The other IC entry points need custom handling because of additional |
| 31 // their "language_mode" parameter. | 28 // parameters like "typeof_mode" or "language_mode". |
| 32 | 29 |
| 33 class AccessorAssemblerImpl : public CodeStubAssembler { | 30 class AccessorAssemblerImpl : public CodeStubAssembler { |
| 34 public: | 31 public: |
| 35 explicit AccessorAssemblerImpl(compiler::CodeAssemblerState* state) | 32 explicit AccessorAssemblerImpl(compiler::CodeAssemblerState* state) |
| 36 : CodeStubAssembler(state) {} | 33 : CodeStubAssembler(state) {} |
| 37 | 34 |
| 38 #define DECLARE_PUBLIC_METHOD(Name) void Generate##Name(); | 35 #define DECLARE_PUBLIC_METHOD(Name) void Generate##Name(); |
| 39 | 36 |
| 40 ACCESSOR_ASSEMBLER_PUBLIC_INTERFACE(DECLARE_PUBLIC_METHOD) | 37 ACCESSOR_ASSEMBLER_PUBLIC_INTERFACE(DECLARE_PUBLIC_METHOD) |
| 41 #undef DECLARE_PUBLIC_METHOD | 38 #undef DECLARE_PUBLIC_METHOD |
| 42 | 39 |
| 40 void GenerateLoadICProtoArray(bool throw_reference_error_if_nonexistent); |
| 41 |
| 42 void GenerateLoadGlobalIC(TypeofMode typeof_mode); |
| 43 void GenerateLoadGlobalICTrampoline(TypeofMode typeof_mode); |
| 44 |
| 43 void GenerateKeyedStoreICTF(LanguageMode language_mode); | 45 void GenerateKeyedStoreICTF(LanguageMode language_mode); |
| 44 void GenerateKeyedStoreICTrampolineTF(LanguageMode language_mode); | 46 void GenerateKeyedStoreICTrampolineTF(LanguageMode language_mode); |
| 45 | 47 |
| 46 void TryProbeStubCache(StubCache* stub_cache, Node* receiver, Node* name, | 48 void TryProbeStubCache(StubCache* stub_cache, Node* receiver, Node* name, |
| 47 Label* if_handler, Variable* var_handler, | 49 Label* if_handler, Variable* var_handler, |
| 48 Label* if_miss); | 50 Label* if_miss); |
| 49 | 51 |
| 50 Node* StubCachePrimaryOffsetForTesting(Node* name, Node* map) { | 52 Node* StubCachePrimaryOffsetForTesting(Node* name, Node* map) { |
| 51 return StubCachePrimaryOffset(name, map); | 53 return StubCachePrimaryOffset(name, map); |
| 52 } | 54 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 81 | 83 |
| 82 void HandleStoreICHandlerCase(const StoreICParameters* p, Node* handler, | 84 void HandleStoreICHandlerCase(const StoreICParameters* p, Node* handler, |
| 83 Label* miss); | 85 Label* miss); |
| 84 | 86 |
| 85 private: | 87 private: |
| 86 enum ElementSupport { kOnlyProperties, kSupportElements }; | 88 enum ElementSupport { kOnlyProperties, kSupportElements }; |
| 87 | 89 |
| 88 // Stub generation entry points. | 90 // Stub generation entry points. |
| 89 | 91 |
| 90 void LoadIC(const LoadICParameters* p); | 92 void LoadIC(const LoadICParameters* p); |
| 91 void LoadICProtoArray(const LoadICParameters* p, Node* handler); | 93 void LoadICProtoArray(const LoadICParameters* p, Node* handler, |
| 92 void LoadGlobalIC(const LoadICParameters* p); | 94 bool throw_reference_error_if_nonexistent); |
| 95 void LoadGlobalIC(const LoadICParameters* p, TypeofMode typeof_mode); |
| 93 void KeyedLoadIC(const LoadICParameters* p); | 96 void KeyedLoadIC(const LoadICParameters* p); |
| 94 void KeyedLoadICGeneric(const LoadICParameters* p); | 97 void KeyedLoadICGeneric(const LoadICParameters* p); |
| 95 void StoreIC(const StoreICParameters* p); | 98 void StoreIC(const StoreICParameters* p); |
| 96 void KeyedStoreIC(const StoreICParameters* p, LanguageMode language_mode); | 99 void KeyedStoreIC(const StoreICParameters* p, LanguageMode language_mode); |
| 97 | 100 |
| 98 // IC dispatcher behavior. | 101 // IC dispatcher behavior. |
| 99 | 102 |
| 100 // Checks monomorphic case. Returns {feedback} entry of the vector. | 103 // Checks monomorphic case. Returns {feedback} entry of the vector. |
| 101 Node* TryMonomorphicCase(Node* slot, Node* vector, Node* receiver_map, | 104 Node* TryMonomorphicCase(Node* slot, Node* vector, Node* receiver_map, |
| 102 Label* if_handler, Variable* var_handler, | 105 Label* if_handler, Variable* var_handler, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 113 // LoadIC implementation. | 116 // LoadIC implementation. |
| 114 | 117 |
| 115 void HandleLoadICHandlerCase( | 118 void HandleLoadICHandlerCase( |
| 116 const LoadICParameters* p, Node* handler, Label* miss, | 119 const LoadICParameters* p, Node* handler, Label* miss, |
| 117 ElementSupport support_elements = kOnlyProperties); | 120 ElementSupport support_elements = kOnlyProperties); |
| 118 | 121 |
| 119 void HandleLoadICSmiHandlerCase(const LoadICParameters* p, Node* holder, | 122 void HandleLoadICSmiHandlerCase(const LoadICParameters* p, Node* holder, |
| 120 Node* smi_handler, Label* miss, | 123 Node* smi_handler, Label* miss, |
| 121 ElementSupport support_elements); | 124 ElementSupport support_elements); |
| 122 | 125 |
| 123 void HandleLoadICProtoHandler(const LoadICParameters* p, Node* handler, | 126 void HandleLoadICProtoHandlerCase(const LoadICParameters* p, Node* handler, |
| 124 Variable* var_holder, Variable* var_smi_handler, | 127 Variable* var_holder, |
| 125 Label* if_smi_handler, Label* miss); | 128 Variable* var_smi_handler, |
| 129 Label* if_smi_handler, Label* miss, |
| 130 bool throw_reference_error_if_nonexistent); |
| 126 | 131 |
| 127 Node* EmitLoadICProtoArrayCheck(const LoadICParameters* p, Node* handler, | 132 Node* EmitLoadICProtoArrayCheck(const LoadICParameters* p, Node* handler, |
| 128 Node* handler_length, Node* handler_flags, | 133 Node* handler_length, Node* handler_flags, |
| 129 Label* miss); | 134 Label* miss, |
| 135 bool throw_reference_error_if_nonexistent); |
| 136 |
| 137 // LoadGlobalIC implementation. |
| 138 |
| 139 void HandleLoadGlobalICHandlerCase(const LoadICParameters* p, Node* handler, |
| 140 Label* miss, |
| 141 bool throw_reference_error_if_nonexistent); |
| 130 | 142 |
| 131 // StoreIC implementation. | 143 // StoreIC implementation. |
| 132 | 144 |
| 133 void HandleStoreICProtoHandler(const StoreICParameters* p, Node* handler, | 145 void HandleStoreICProtoHandler(const StoreICParameters* p, Node* handler, |
| 134 Label* miss); | 146 Label* miss); |
| 135 // If |transition| is nullptr then the normal field store is generated or | 147 // If |transition| is nullptr then the normal field store is generated or |
| 136 // transitioning store otherwise. | 148 // transitioning store otherwise. |
| 137 void HandleStoreICSmiHandlerCase(Node* handler_word, Node* holder, | 149 void HandleStoreICSmiHandlerCase(Node* handler_word, Node* holder, |
| 138 Node* value, Node* transition, Label* miss); | 150 Node* value, Node* transition, Label* miss); |
| 139 // If |transition| is nullptr then the normal field store is generated or | 151 // If |transition| is nullptr then the normal field store is generated or |
| (...skipping 27 matching lines...) Expand all Loading... |
| 167 void TryProbeStubCacheTable(StubCache* stub_cache, StubCacheTable table_id, | 179 void TryProbeStubCacheTable(StubCache* stub_cache, StubCacheTable table_id, |
| 168 Node* entry_offset, Node* name, Node* map, | 180 Node* entry_offset, Node* name, Node* map, |
| 169 Label* if_handler, Variable* var_handler, | 181 Label* if_handler, Variable* var_handler, |
| 170 Label* if_miss); | 182 Label* if_miss); |
| 171 }; | 183 }; |
| 172 | 184 |
| 173 } // namespace internal | 185 } // namespace internal |
| 174 } // namespace v8 | 186 } // namespace v8 |
| 175 | 187 |
| 176 #endif // V8_SRC_IC_ACCESSOR_ASSEMBLER_IMPL_H_ | 188 #endif // V8_SRC_IC_ACCESSOR_ASSEMBLER_IMPL_H_ |
| OLD | NEW |