| 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_H_ | 5 #ifndef V8_SRC_IC_ACCESSOR_ASSEMBLER_H_ |
| 6 #define V8_SRC_IC_ACCESSOR_ASSEMBLER_H_ | 6 #define V8_SRC_IC_ACCESSOR_ASSEMBLER_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 class ExitPoint; | 17 class ExitPoint; |
| 18 | 18 |
| 19 class AccessorAssembler : public CodeStubAssembler { | 19 class AccessorAssembler : public CodeStubAssembler { |
| 20 public: | 20 public: |
| 21 typedef compiler::Node Node; | 21 typedef compiler::Node Node; |
| 22 | 22 |
| 23 explicit AccessorAssembler(compiler::CodeAssemblerState* state) | 23 explicit AccessorAssembler(compiler::CodeAssemblerState* state) |
| 24 : CodeStubAssembler(state) {} | 24 : CodeStubAssembler(state) {} |
| 25 | 25 |
| 26 void GenerateLoadIC(); | 26 void GenerateLoadIC(); |
| 27 void GenerateLoadIC_Noninlined(); |
| 27 void GenerateLoadIC_Uninitialized(); | 28 void GenerateLoadIC_Uninitialized(); |
| 28 void GenerateLoadField(); | 29 void GenerateLoadField(); |
| 29 void GenerateLoadICTrampoline(); | 30 void GenerateLoadICTrampoline(); |
| 30 void GenerateKeyedLoadIC(); | 31 void GenerateKeyedLoadIC(); |
| 31 void GenerateKeyedLoadICTrampoline(); | 32 void GenerateKeyedLoadICTrampoline(); |
| 32 void GenerateKeyedLoadIC_Megamorphic(); | 33 void GenerateKeyedLoadIC_Megamorphic(); |
| 33 void GenerateStoreIC(LanguageMode language_mode); | 34 void GenerateStoreIC(LanguageMode language_mode); |
| 34 void GenerateStoreICTrampoline(LanguageMode language_mode); | 35 void GenerateStoreICTrampoline(LanguageMode language_mode); |
| 35 | 36 |
| 36 void GenerateLoadICProtoArray(bool throw_reference_error_if_nonexistent); | 37 void GenerateLoadICProtoArray(bool throw_reference_error_if_nonexistent); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 void LoadGlobalIC_TryPropertyCellCase( | 72 void LoadGlobalIC_TryPropertyCellCase( |
| 72 Node* vector, Node* slot, ExitPoint* exit_point, Label* try_handler, | 73 Node* vector, Node* slot, ExitPoint* exit_point, Label* try_handler, |
| 73 Label* miss, ParameterMode slot_mode = SMI_PARAMETERS); | 74 Label* miss, ParameterMode slot_mode = SMI_PARAMETERS); |
| 74 void LoadGlobalIC_TryHandlerCase(const LoadICParameters* p, | 75 void LoadGlobalIC_TryHandlerCase(const LoadICParameters* p, |
| 75 TypeofMode typeof_mode, | 76 TypeofMode typeof_mode, |
| 76 ExitPoint* exit_point, Label* miss); | 77 ExitPoint* exit_point, Label* miss); |
| 77 void LoadGlobalIC_MissCase(const LoadICParameters* p, ExitPoint* exit_point); | 78 void LoadGlobalIC_MissCase(const LoadICParameters* p, ExitPoint* exit_point); |
| 78 | 79 |
| 80 // Checks monomorphic case. There are two variants: the first returns a |
| 81 // ({feedback}, {handler}) pair and falls through on success, while the second |
| 82 // stores {handler} in the given variable and jumps to {if_handler} on |
| 83 // success. |
| 84 std::pair<Node*, Node*> TryMonomorphicCase(Node* slot, Node* vector, |
| 85 Node* receiver_map, |
| 86 Label* if_miss); |
| 87 Node* TryMonomorphicCase(Node* slot, Node* vector, Node* receiver_map, |
| 88 Label* if_handler, Variable* var_handler, |
| 89 Label* if_miss); |
| 90 |
| 91 enum ElementSupport { kOnlyProperties, kSupportElements }; |
| 92 void HandleLoadICHandlerCase( |
| 93 const LoadICParameters* p, Node* handler, Label* miss, |
| 94 ExitPoint* exit_point, ElementSupport support_elements = kOnlyProperties); |
| 95 |
| 79 protected: | 96 protected: |
| 80 struct StoreICParameters : public LoadICParameters { | 97 struct StoreICParameters : public LoadICParameters { |
| 81 StoreICParameters(Node* context, Node* receiver, Node* name, Node* value, | 98 StoreICParameters(Node* context, Node* receiver, Node* name, Node* value, |
| 82 Node* slot, Node* vector) | 99 Node* slot, Node* vector) |
| 83 : LoadICParameters(context, receiver, name, slot, vector), | 100 : LoadICParameters(context, receiver, name, slot, vector), |
| 84 value(value) {} | 101 value(value) {} |
| 85 Node* value; | 102 Node* value; |
| 86 }; | 103 }; |
| 87 | 104 |
| 88 enum ElementSupport { kOnlyProperties, kSupportElements }; | |
| 89 void HandleStoreICHandlerCase( | 105 void HandleStoreICHandlerCase( |
| 90 const StoreICParameters* p, Node* handler, Label* miss, | 106 const StoreICParameters* p, Node* handler, Label* miss, |
| 91 ElementSupport support_elements = kOnlyProperties); | 107 ElementSupport support_elements = kOnlyProperties); |
| 92 void JumpIfDataProperty(Node* details, Label* writable, Label* readonly); | 108 void JumpIfDataProperty(Node* details, Label* writable, Label* readonly); |
| 93 | 109 |
| 94 private: | 110 private: |
| 95 // Stub generation entry points. | 111 // Stub generation entry points. |
| 96 | 112 |
| 113 // LoadIC contains the full LoadIC logic, while LoadIC_Noninlined contains |
| 114 // logic not inlined into Ignition bytecode handlers. |
| 97 void LoadIC(const LoadICParameters* p); | 115 void LoadIC(const LoadICParameters* p); |
| 116 void LoadIC_Noninlined(const LoadICParameters* p, Node* receiver_map, |
| 117 Node* feedback, Variable* var_handler, |
| 118 Label* if_handler, Label* miss, ExitPoint* exit_point); |
| 119 |
| 98 void LoadIC_Uninitialized(const LoadICParameters* p); | 120 void LoadIC_Uninitialized(const LoadICParameters* p); |
| 99 void LoadICProtoArray(const LoadICParameters* p, Node* handler, | 121 void LoadICProtoArray(const LoadICParameters* p, Node* handler, |
| 100 bool throw_reference_error_if_nonexistent); | 122 bool throw_reference_error_if_nonexistent); |
| 101 void LoadGlobalIC(const LoadICParameters* p, TypeofMode typeof_mode); | 123 void LoadGlobalIC(const LoadICParameters* p, TypeofMode typeof_mode); |
| 102 void KeyedLoadIC(const LoadICParameters* p); | 124 void KeyedLoadIC(const LoadICParameters* p); |
| 103 void KeyedLoadICGeneric(const LoadICParameters* p); | 125 void KeyedLoadICGeneric(const LoadICParameters* p); |
| 104 void StoreIC(const StoreICParameters* p); | 126 void StoreIC(const StoreICParameters* p); |
| 105 void KeyedStoreIC(const StoreICParameters* p, LanguageMode language_mode); | 127 void KeyedStoreIC(const StoreICParameters* p, LanguageMode language_mode); |
| 106 | 128 |
| 107 // IC dispatcher behavior. | 129 // IC dispatcher behavior. |
| 108 | |
| 109 // Checks monomorphic case. Returns {feedback} entry of the vector. | |
| 110 Node* TryMonomorphicCase(Node* slot, Node* vector, Node* receiver_map, | |
| 111 Label* if_handler, Variable* var_handler, | |
| 112 Label* if_miss); | |
| 113 void HandlePolymorphicCase(Node* receiver_map, Node* feedback, | 130 void HandlePolymorphicCase(Node* receiver_map, Node* feedback, |
| 114 Label* if_handler, Variable* var_handler, | 131 Label* if_handler, Variable* var_handler, |
| 115 Label* if_miss, int unroll_count); | 132 Label* if_miss, int unroll_count); |
| 116 void HandleKeyedStorePolymorphicCase(Node* receiver_map, Node* feedback, | 133 void HandleKeyedStorePolymorphicCase(Node* receiver_map, Node* feedback, |
| 117 Label* if_handler, Variable* var_handler, | 134 Label* if_handler, Variable* var_handler, |
| 118 Label* if_transition_handler, | 135 Label* if_transition_handler, |
| 119 Variable* var_transition_map_cell, | 136 Variable* var_transition_map_cell, |
| 120 Label* if_miss); | 137 Label* if_miss); |
| 121 | 138 |
| 122 // LoadIC implementation. | 139 // LoadIC implementation. |
| 123 | 140 |
| 124 void HandleLoadICHandlerCase( | |
| 125 const LoadICParameters* p, Node* handler, Label* miss, | |
| 126 ElementSupport support_elements = kOnlyProperties); | |
| 127 | |
| 128 void HandleLoadICSmiHandlerCase(const LoadICParameters* p, Node* holder, | 141 void HandleLoadICSmiHandlerCase(const LoadICParameters* p, Node* holder, |
| 129 Node* smi_handler, Label* miss, | 142 Node* smi_handler, Label* miss, |
| 130 ExitPoint* exit_point, | 143 ExitPoint* exit_point, |
| 131 ElementSupport support_elements); | 144 ElementSupport support_elements); |
| 132 | 145 |
| 133 void HandleLoadICProtoHandlerCase(const LoadICParameters* p, Node* handler, | 146 void HandleLoadICProtoHandlerCase(const LoadICParameters* p, Node* handler, |
| 134 Variable* var_holder, | 147 Variable* var_holder, |
| 135 Variable* var_smi_handler, | 148 Variable* var_smi_handler, |
| 136 Label* if_smi_handler, Label* miss, | 149 Label* if_smi_handler, Label* miss, |
| 137 ExitPoint* exit_point, | 150 ExitPoint* exit_point, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 Node* instance_type, Node* key, | 192 Node* instance_type, Node* key, |
| 180 const LoadICParameters* p, Label* slow, | 193 const LoadICParameters* p, Label* slow, |
| 181 UseStubCache use_stub_cache = kUseStubCache); | 194 UseStubCache use_stub_cache = kUseStubCache); |
| 182 | 195 |
| 183 // Low-level helpers. | 196 // Low-level helpers. |
| 184 | 197 |
| 185 Node* PrepareValueForStore(Node* handler_word, Node* holder, | 198 Node* PrepareValueForStore(Node* handler_word, Node* holder, |
| 186 Representation representation, Node* transition, | 199 Representation representation, Node* transition, |
| 187 Node* value, Label* bailout); | 200 Node* value, Label* bailout); |
| 188 | 201 |
| 202 Node* LoadFeedbackSlot(Node* vector, Node* slot, int additional_offset); |
| 203 |
| 189 // Extends properties backing store by JSObject::kFieldsAdded elements. | 204 // Extends properties backing store by JSObject::kFieldsAdded elements. |
| 190 void ExtendPropertiesBackingStore(Node* object); | 205 void ExtendPropertiesBackingStore(Node* object); |
| 191 | 206 |
| 192 void StoreNamedField(Node* handler_word, Node* object, bool is_inobject, | 207 void StoreNamedField(Node* handler_word, Node* object, bool is_inobject, |
| 193 Representation representation, Node* value, | 208 Representation representation, Node* value, |
| 194 bool transition_to_field, Label* bailout); | 209 bool transition_to_field, Label* bailout); |
| 195 | 210 |
| 196 void EmitFastElementsBoundsCheck(Node* object, Node* elements, | 211 void EmitFastElementsBoundsCheck(Node* object, Node* elements, |
| 197 Node* intptr_index, | 212 Node* intptr_index, |
| 198 Node* is_jsarray_condition, Label* miss); | 213 Node* is_jsarray_condition, Label* miss); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 299 |
| 285 CodeAssemblerLabel* const out_; | 300 CodeAssemblerLabel* const out_; |
| 286 CodeAssemblerVariable* const var_result_; | 301 CodeAssemblerVariable* const var_result_; |
| 287 CodeStubAssembler* const asm_; | 302 CodeStubAssembler* const asm_; |
| 288 }; | 303 }; |
| 289 | 304 |
| 290 } // namespace internal | 305 } // namespace internal |
| 291 } // namespace v8 | 306 } // namespace v8 |
| 292 | 307 |
| 293 #endif // V8_SRC_IC_ACCESSOR_ASSEMBLER_H_ | 308 #endif // V8_SRC_IC_ACCESSOR_ASSEMBLER_H_ |
| OLD | NEW |