OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_AST_GRAPH_BUILDER_H_ | 5 #ifndef V8_COMPILER_AST_GRAPH_BUILDER_H_ |
6 #define V8_COMPILER_AST_GRAPH_BUILDER_H_ | 6 #define V8_COMPILER_AST_GRAPH_BUILDER_H_ |
7 | 7 |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/liveness-analyzer.h" | 10 #include "src/compiler/liveness-analyzer.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 // The main node creation chokepoint. Adds context, frame state, effect, | 203 // The main node creation chokepoint. Adds context, frame state, effect, |
204 // and control dependencies depending on the operator. | 204 // and control dependencies depending on the operator. |
205 Node* MakeNode(const Operator* op, int value_input_count, Node** value_inputs, | 205 Node* MakeNode(const Operator* op, int value_input_count, Node** value_inputs, |
206 bool incomplete); | 206 bool incomplete); |
207 | 207 |
208 // Helper to indicate a node exits the function body. | 208 // Helper to indicate a node exits the function body. |
209 void UpdateControlDependencyToLeaveFunction(Node* exit); | 209 void UpdateControlDependencyToLeaveFunction(Node* exit); |
210 | 210 |
211 // Builds deoptimization for a given node. | 211 // Builds deoptimization for a given node. |
212 void PrepareFrameState( | 212 void PrepareFrameState(Node* node, BailoutId ast_id, |
213 Node* node, BailoutId ast_id, | 213 OutputFrameStateCombine framestate_combine = |
214 OutputFrameStateCombine combine = OutputFrameStateCombine::Ignore()); | 214 OutputFrameStateCombine::Ignore()); |
215 | 215 |
216 BitVector* GetVariablesAssignedInLoop(IterationStatement* stmt); | 216 BitVector* GetVariablesAssignedInLoop(IterationStatement* stmt); |
217 | 217 |
218 // Check if the given statement is an OSR entry. | 218 // Check if the given statement is an OSR entry. |
219 // If so, record the stack height into the compilation and return {true}. | 219 // If so, record the stack height into the compilation and return {true}. |
220 bool CheckOsrEntry(IterationStatement* stmt); | 220 bool CheckOsrEntry(IterationStatement* stmt); |
221 | 221 |
222 // Computes local variable liveness and replaces dead variables in | 222 // Computes local variable liveness and replaces dead variables in |
223 // frame states with the undefined values. | 223 // frame states with the undefined values. |
224 void ClearNonLiveSlotsInFrameStates(); | 224 void ClearNonLiveSlotsInFrameStates(); |
225 | 225 |
226 // Helper to wrap a Handle<T> into a Unique<T>. | 226 // Helper to wrap a Handle<T> into a Unique<T>. |
227 template <class T> | 227 template <class T> |
228 Unique<T> MakeUnique(Handle<T> object) { | 228 Unique<T> MakeUnique(Handle<T> object) { |
229 return Unique<T>::CreateUninitialized(object); | 229 return Unique<T>::CreateUninitialized(object); |
230 } | 230 } |
231 | 231 |
232 Node** EnsureInputBufferSize(int size); | 232 Node** EnsureInputBufferSize(int size); |
233 | 233 |
234 // Named and keyed loads require a VectorSlotPair for successful lowering. | 234 // Named and keyed loads require a VectorSlotPair for successful lowering. |
235 VectorSlotPair CreateVectorSlotPair(FeedbackVectorICSlot slot) const; | 235 VectorSlotPair CreateVectorSlotPair(FeedbackVectorICSlot slot) const; |
236 | 236 |
| 237 // Determine which contexts need to be checked for extension objects that |
| 238 // might shadow the optimistic declaration of dynamic lookup variables. |
| 239 uint32_t ComputeBitsetForDynamicGlobal(Variable* variable); |
| 240 uint32_t ComputeBitsetForDynamicContext(Variable* variable); |
| 241 |
237 // =========================================================================== | 242 // =========================================================================== |
238 // The following build methods all generate graph fragments and return one | 243 // The following build methods all generate graph fragments and return one |
239 // resulting node. The operand stack height remains the same, variables and | 244 // resulting node. The operand stack height remains the same, variables and |
240 // other dependencies tracked by the environment might be mutated though. | 245 // other dependencies tracked by the environment might be mutated though. |
241 | 246 |
242 // Builder to create a receiver check for sloppy mode. | 247 // Builder to create a receiver check for sloppy mode. |
243 Node* BuildPatchReceiverToGlobalProxy(Node* receiver); | 248 Node* BuildPatchReceiverToGlobalProxy(Node* receiver); |
244 | 249 |
245 // Builders to create local function, script and block contexts. | 250 // Builders to create local function, script and block contexts. |
246 Node* BuildLocalFunctionContext(Node* context, Node* patched_receiver); | 251 Node* BuildLocalFunctionContext(Node* context, Node* patched_receiver); |
247 Node* BuildLocalScriptContext(Scope* scope); | 252 Node* BuildLocalScriptContext(Scope* scope); |
248 Node* BuildLocalBlockContext(Scope* scope); | 253 Node* BuildLocalBlockContext(Scope* scope); |
249 | 254 |
250 // Builder to create an arguments object if it is used. | 255 // Builder to create an arguments object if it is used. |
251 Node* BuildArgumentsObject(Variable* arguments); | 256 Node* BuildArgumentsObject(Variable* arguments); |
252 | 257 |
253 // Builder to create an array of rest parameters if used | 258 // Builder to create an array of rest parameters if used |
254 Node* BuildRestArgumentsArray(Variable* rest, int index); | 259 Node* BuildRestArgumentsArray(Variable* rest, int index); |
255 | 260 |
256 // Builders for variable load and assignment. | 261 // Builders for variable load and assignment. |
257 Node* BuildVariableAssignment( | 262 Node* BuildVariableAssignment(Variable* variable, Node* value, |
258 FrameStateBeforeAndAfter& states, Variable* var, Node* value, | 263 Token::Value op, BailoutId bailout_id, |
259 Token::Value op, BailoutId bailout_id, | 264 FrameStateBeforeAndAfter& states, |
260 OutputFrameStateCombine combine = OutputFrameStateCombine::Ignore()); | 265 OutputFrameStateCombine framestate_combine = |
261 Node* BuildVariableDelete(Variable* var, BailoutId bailout_id, | 266 OutputFrameStateCombine::Ignore()); |
262 OutputFrameStateCombine combine); | 267 Node* BuildVariableDelete(Variable* variable, BailoutId bailout_id, |
263 Node* BuildVariableLoad(FrameStateBeforeAndAfter& states, Variable* var, | 268 OutputFrameStateCombine framestate_combine); |
264 BailoutId bailout_id, const VectorSlotPair& feedback, | 269 Node* BuildVariableLoad(Variable* variable, BailoutId bailout_id, |
265 OutputFrameStateCombine combine, | 270 FrameStateBeforeAndAfter& states, |
| 271 const VectorSlotPair& feedback, |
| 272 OutputFrameStateCombine framestate_combine, |
266 ContextualMode mode = CONTEXTUAL); | 273 ContextualMode mode = CONTEXTUAL); |
267 | 274 |
268 // Builders for property loads and stores. | 275 // Builders for property loads and stores. |
269 Node* BuildKeyedLoad(Node* receiver, Node* key, | 276 Node* BuildKeyedLoad(Node* receiver, Node* key, |
270 const VectorSlotPair& feedback); | 277 const VectorSlotPair& feedback); |
271 Node* BuildNamedLoad(Node* receiver, Handle<Name> name, | 278 Node* BuildNamedLoad(Node* receiver, Handle<Name> name, |
272 const VectorSlotPair& feedback, | 279 const VectorSlotPair& feedback, |
273 ContextualMode mode = NOT_CONTEXTUAL); | 280 ContextualMode mode = NOT_CONTEXTUAL); |
274 Node* BuildKeyedStore(Node* receiver, Node* key, Node* value, | 281 Node* BuildKeyedStore(Node* receiver, Node* key, Node* value, |
275 TypeFeedbackId id); | 282 TypeFeedbackId id); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 513 |
507 // Prepare environment to be used as loop header. | 514 // Prepare environment to be used as loop header. |
508 void PrepareForLoop(BitVector* assigned, bool is_osr = false); | 515 void PrepareForLoop(BitVector* assigned, bool is_osr = false); |
509 }; | 516 }; |
510 | 517 |
511 } // namespace compiler | 518 } // namespace compiler |
512 } // namespace internal | 519 } // namespace internal |
513 } // namespace v8 | 520 } // namespace v8 |
514 | 521 |
515 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 522 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
OLD | NEW |