OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_NODE_PROPERTIES_H_ | 5 #ifndef V8_COMPILER_NODE_PROPERTIES_H_ |
6 #define V8_COMPILER_NODE_PROPERTIES_H_ | 6 #define V8_COMPILER_NODE_PROPERTIES_H_ |
7 | 7 |
8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
9 #include "src/compiler/types.h" | 9 #include "src/compiler/types.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 // --------------------------------------------------------------------------- | 126 // --------------------------------------------------------------------------- |
127 // Context. | 127 // Context. |
128 | 128 |
129 // Try to retrieve the specialization context from the given {node}, | 129 // Try to retrieve the specialization context from the given {node}, |
130 // optionally utilizing the knowledge about the (outermost) function | 130 // optionally utilizing the knowledge about the (outermost) function |
131 // {context}. | 131 // {context}. |
132 static MaybeHandle<Context> GetSpecializationContext( | 132 static MaybeHandle<Context> GetSpecializationContext( |
133 Node* node, MaybeHandle<Context> context = MaybeHandle<Context>()); | 133 Node* node, MaybeHandle<Context> context = MaybeHandle<Context>()); |
134 | 134 |
| 135 // Walk up the context chain from the given {node} until we reduce the {depth} |
| 136 // to 0 or hit a node that does not extend the context chain ({depth} will be |
| 137 // updated accordingly). |
| 138 static Node* GetOuterContext(Node* node, size_t* depth); |
| 139 |
135 // --------------------------------------------------------------------------- | 140 // --------------------------------------------------------------------------- |
136 // Type. | 141 // Type. |
137 | 142 |
138 static bool IsTyped(Node* node) { return node->type() != nullptr; } | 143 static bool IsTyped(Node* node) { return node->type() != nullptr; } |
139 static Type* GetType(Node* node) { | 144 static Type* GetType(Node* node) { |
140 DCHECK(IsTyped(node)); | 145 DCHECK(IsTyped(node)); |
141 return node->type(); | 146 return node->type(); |
142 } | 147 } |
143 static Type* GetTypeOrAny(Node* node); | 148 static Type* GetTypeOrAny(Node* node); |
144 static void SetType(Node* node, Type* type) { | 149 static void SetType(Node* node, Type* type) { |
145 DCHECK_NOT_NULL(type); | 150 DCHECK_NOT_NULL(type); |
146 node->set_type(type); | 151 node->set_type(type); |
147 } | 152 } |
148 static void RemoveType(Node* node) { node->set_type(nullptr); } | 153 static void RemoveType(Node* node) { node->set_type(nullptr); } |
149 static bool AllValueInputsAreTyped(Node* node); | 154 static bool AllValueInputsAreTyped(Node* node); |
150 | 155 |
151 private: | 156 private: |
152 static inline bool IsInputRange(Edge edge, int first, int count); | 157 static inline bool IsInputRange(Edge edge, int first, int count); |
153 }; | 158 }; |
154 | 159 |
155 } // namespace compiler | 160 } // namespace compiler |
156 } // namespace internal | 161 } // namespace internal |
157 } // namespace v8 | 162 } // namespace v8 |
158 | 163 |
159 #endif // V8_COMPILER_NODE_PROPERTIES_H_ | 164 #endif // V8_COMPILER_NODE_PROPERTIES_H_ |
OLD | NEW |