OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ | 5 #ifndef V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ |
6 #define V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ | 6 #define V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ |
7 | 7 |
8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
9 #include "src/compiler/graph-reducer.h" | 9 #include "src/compiler/graph-reducer.h" |
10 #include "src/deoptimize-reason.h" | 10 #include "src/deoptimize-reason.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 // Forward declarations. | 15 // Forward declarations. |
16 class CompilationDependencies; | 16 class CompilationDependencies; |
17 class Factory; | 17 class Factory; |
18 class FeedbackNexus; | 18 class FeedbackNexus; |
19 class TypeCache; | 19 class TypeCache; |
20 | 20 |
21 | 21 |
22 namespace compiler { | 22 namespace compiler { |
23 | 23 |
24 // Forward declarations. | 24 // Forward declarations. |
25 enum class AccessMode; | 25 enum class AccessMode; |
26 class CommonOperatorBuilder; | 26 class CommonOperatorBuilder; |
| 27 class ElementAccessInfo; |
27 class JSGraph; | 28 class JSGraph; |
28 class JSOperatorBuilder; | 29 class JSOperatorBuilder; |
29 class MachineOperatorBuilder; | 30 class MachineOperatorBuilder; |
| 31 class PropertyAccessInfo; |
30 class SimplifiedOperatorBuilder; | 32 class SimplifiedOperatorBuilder; |
31 | 33 |
32 | 34 |
33 // Specializes a given JSGraph to a given native context, potentially constant | 35 // Specializes a given JSGraph to a given native context, potentially constant |
34 // folding some {LoadGlobal} nodes or strength reducing some {StoreGlobal} | 36 // folding some {LoadGlobal} nodes or strength reducing some {StoreGlobal} |
35 // nodes. And also specializes {LoadNamed} and {StoreNamed} nodes according | 37 // nodes. And also specializes {LoadNamed} and {StoreNamed} nodes according |
36 // to type feedback (if available). | 38 // to type feedback (if available). |
37 class JSNativeContextSpecialization final : public AdvancedReducer { | 39 class JSNativeContextSpecialization final : public AdvancedReducer { |
38 public: | 40 public: |
39 // Flags that control the mode of operation. | 41 // Flags that control the mode of operation. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 AccessMode access_mode, | 75 AccessMode access_mode, |
74 LanguageMode language_mode); | 76 LanguageMode language_mode); |
75 Reduction ReduceNamedAccess(Node* node, Node* value, | 77 Reduction ReduceNamedAccess(Node* node, Node* value, |
76 MapHandleList const& receiver_maps, | 78 MapHandleList const& receiver_maps, |
77 Handle<Name> name, AccessMode access_mode, | 79 Handle<Name> name, AccessMode access_mode, |
78 LanguageMode language_mode, | 80 LanguageMode language_mode, |
79 Node* index = nullptr); | 81 Node* index = nullptr); |
80 | 82 |
81 Reduction ReduceSoftDeoptimize(Node* node, DeoptimizeReason reason); | 83 Reduction ReduceSoftDeoptimize(Node* node, DeoptimizeReason reason); |
82 | 84 |
| 85 // A triple of nodes that represents a continuation. |
| 86 class ValueEffectControl final { |
| 87 public: |
| 88 ValueEffectControl(Node* value, Node* effect, Node* control) |
| 89 : value_(value), effect_(effect), control_(control) {} |
| 90 |
| 91 Node* value() const { return value_; } |
| 92 Node* effect() const { return effect_; } |
| 93 Node* control() const { return control_; } |
| 94 |
| 95 private: |
| 96 Node* const value_; |
| 97 Node* const effect_; |
| 98 Node* const control_; |
| 99 }; |
| 100 |
| 101 // Construct the appropriate subgraph for property access. |
| 102 ValueEffectControl BuildPropertyAccess(Node* receiver, Node* value, |
| 103 Node* effect, Node* control, |
| 104 Handle<Name> name, |
| 105 Handle<Context> native_context, |
| 106 PropertyAccessInfo const& access_info, |
| 107 AccessMode access_mode); |
| 108 |
| 109 // Construct the appropriate subgraph for element access. |
| 110 ValueEffectControl BuildElementAccess(Node* receiver, Node* index, |
| 111 Node* value, Node* effect, |
| 112 Node* control, |
| 113 Handle<Context> native_context, |
| 114 ElementAccessInfo const& access_info, |
| 115 AccessMode access_mode); |
| 116 |
83 // Adds stability dependencies on all prototypes of every class in | 117 // Adds stability dependencies on all prototypes of every class in |
84 // {receiver_type} up to (and including) the {holder}. | 118 // {receiver_type} up to (and including) the {holder}. |
85 void AssumePrototypesStable(Type* receiver_type, | 119 void AssumePrototypesStable(std::vector<Handle<Map>> const& receiver_maps, |
86 Handle<Context> native_context, | 120 Handle<Context> native_context, |
87 Handle<JSObject> holder); | 121 Handle<JSObject> holder); |
88 | 122 |
89 // Extract receiver maps from {nexus} and filter based on {receiver} if | 123 // Extract receiver maps from {nexus} and filter based on {receiver} if |
90 // possible. | 124 // possible. |
91 bool ExtractReceiverMaps(Node* receiver, Node* effect, | 125 bool ExtractReceiverMaps(Node* receiver, Node* effect, |
92 FeedbackNexus const& nexus, | 126 FeedbackNexus const& nexus, |
93 MapHandleList* receiver_maps); | 127 MapHandleList* receiver_maps); |
94 | 128 |
95 // Try to infer a map for the given {receiver} at the current {effect}. | 129 // Try to infer a map for the given {receiver} at the current {effect}. |
(...skipping 30 matching lines...) Expand all Loading... |
126 DISALLOW_COPY_AND_ASSIGN(JSNativeContextSpecialization); | 160 DISALLOW_COPY_AND_ASSIGN(JSNativeContextSpecialization); |
127 }; | 161 }; |
128 | 162 |
129 DEFINE_OPERATORS_FOR_FLAGS(JSNativeContextSpecialization::Flags) | 163 DEFINE_OPERATORS_FOR_FLAGS(JSNativeContextSpecialization::Flags) |
130 | 164 |
131 } // namespace compiler | 165 } // namespace compiler |
132 } // namespace internal | 166 } // namespace internal |
133 } // namespace v8 | 167 } // namespace v8 |
134 | 168 |
135 #endif // V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ | 169 #endif // V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ |
OLD | NEW |