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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 void ClearNonLiveSlotsInFrameStates(); | 229 void ClearNonLiveSlotsInFrameStates(); |
230 | 230 |
231 // Helper to wrap a Handle<T> into a Unique<T>. | 231 // Helper to wrap a Handle<T> into a Unique<T>. |
232 template <class T> | 232 template <class T> |
233 Unique<T> MakeUnique(Handle<T> object) { | 233 Unique<T> MakeUnique(Handle<T> object) { |
234 return Unique<T>::CreateUninitialized(object); | 234 return Unique<T>::CreateUninitialized(object); |
235 } | 235 } |
236 | 236 |
237 Node** EnsureInputBufferSize(int size); | 237 Node** EnsureInputBufferSize(int size); |
238 | 238 |
239 // Named and keyed loads require a ResolvedFeedbackSlot for successful | 239 // Named and keyed loads require a VectorSlotPair for successful lowering. |
240 // lowering. | 240 VectorSlotPair CreateVectorSlotPair(FeedbackVectorICSlot slot) const; |
241 ResolvedFeedbackSlot ResolveFeedbackSlot(FeedbackVectorICSlot slot) const; | |
242 | 241 |
243 // Determine which contexts need to be checked for extension objects that | 242 // Determine which contexts need to be checked for extension objects that |
244 // might shadow the optimistic declaration of dynamic lookup variables. | 243 // might shadow the optimistic declaration of dynamic lookup variables. |
245 uint32_t ComputeBitsetForDynamicGlobal(Variable* variable); | 244 uint32_t ComputeBitsetForDynamicGlobal(Variable* variable); |
246 uint32_t ComputeBitsetForDynamicContext(Variable* variable); | 245 uint32_t ComputeBitsetForDynamicContext(Variable* variable); |
247 | 246 |
248 // =========================================================================== | 247 // =========================================================================== |
249 // The following build methods all generate graph fragments and return one | 248 // The following build methods all generate graph fragments and return one |
250 // resulting node. The operand stack height remains the same, variables and | 249 // resulting node. The operand stack height remains the same, variables and |
251 // other dependencies tracked by the environment might be mutated though. | 250 // other dependencies tracked by the environment might be mutated though. |
(...skipping 10 matching lines...) Expand all Loading... |
262 Node* BuildArgumentsObject(Variable* arguments); | 261 Node* BuildArgumentsObject(Variable* arguments); |
263 | 262 |
264 // Builder to create an array of rest parameters if used | 263 // Builder to create an array of rest parameters if used |
265 Node* BuildRestArgumentsArray(Variable* rest, int index); | 264 Node* BuildRestArgumentsArray(Variable* rest, int index); |
266 | 265 |
267 // Builder that assigns to the .this_function internal variable if needed. | 266 // Builder that assigns to the .this_function internal variable if needed. |
268 Node* BuildThisFunctionVar(Variable* this_function_var); | 267 Node* BuildThisFunctionVar(Variable* this_function_var); |
269 | 268 |
270 // Builders for variable load and assignment. | 269 // Builders for variable load and assignment. |
271 Node* BuildVariableAssignment(Variable* variable, Node* value, | 270 Node* BuildVariableAssignment(Variable* variable, Node* value, |
272 Token::Value op, | 271 Token::Value op, const VectorSlotPair& slot, |
273 const ResolvedFeedbackSlot& slot, | |
274 BailoutId bailout_id, | 272 BailoutId bailout_id, |
275 FrameStateBeforeAndAfter& states, | 273 FrameStateBeforeAndAfter& states, |
276 OutputFrameStateCombine framestate_combine = | 274 OutputFrameStateCombine framestate_combine = |
277 OutputFrameStateCombine::Ignore()); | 275 OutputFrameStateCombine::Ignore()); |
278 Node* BuildVariableDelete(Variable* variable, BailoutId bailout_id, | 276 Node* BuildVariableDelete(Variable* variable, BailoutId bailout_id, |
279 OutputFrameStateCombine framestate_combine); | 277 OutputFrameStateCombine framestate_combine); |
280 Node* BuildVariableLoad(Variable* variable, BailoutId bailout_id, | 278 Node* BuildVariableLoad(Variable* variable, BailoutId bailout_id, |
281 FrameStateBeforeAndAfter& states, | 279 FrameStateBeforeAndAfter& states, |
282 const ResolvedFeedbackSlot& feedback, | 280 const VectorSlotPair& feedback, |
283 OutputFrameStateCombine framestate_combine, | 281 OutputFrameStateCombine framestate_combine, |
284 ContextualMode mode = CONTEXTUAL); | 282 ContextualMode mode = CONTEXTUAL); |
285 | 283 |
286 // Builders for property loads and stores. | 284 // Builders for property loads and stores. |
287 Node* BuildKeyedLoad(Node* receiver, Node* key, | 285 Node* BuildKeyedLoad(Node* receiver, Node* key, |
288 const ResolvedFeedbackSlot& feedback); | 286 const VectorSlotPair& feedback); |
289 Node* BuildNamedLoad(Node* receiver, Handle<Name> name, | 287 Node* BuildNamedLoad(Node* receiver, Handle<Name> name, |
290 const ResolvedFeedbackSlot& feedback, | 288 const VectorSlotPair& feedback, |
291 ContextualMode mode = NOT_CONTEXTUAL); | 289 ContextualMode mode = NOT_CONTEXTUAL); |
292 Node* BuildKeyedStore(Node* receiver, Node* key, Node* value, | 290 Node* BuildKeyedStore(Node* receiver, Node* key, Node* value, |
293 const ResolvedFeedbackSlot& feedback, | 291 const VectorSlotPair& feedback, TypeFeedbackId id); |
294 TypeFeedbackId id); | |
295 Node* BuildNamedStore(Node* receiver, Handle<Name>, Node* value, | 292 Node* BuildNamedStore(Node* receiver, Handle<Name>, Node* value, |
296 const ResolvedFeedbackSlot& feedback, | 293 const VectorSlotPair& feedback, TypeFeedbackId id); |
297 TypeFeedbackId id); | |
298 | 294 |
299 // Builders for super property loads and stores. | 295 // Builders for super property loads and stores. |
300 Node* BuildKeyedSuperStore(Node* receiver, Node* home_object, Node* key, | 296 Node* BuildKeyedSuperStore(Node* receiver, Node* home_object, Node* key, |
301 Node* value, TypeFeedbackId id); | 297 Node* value, TypeFeedbackId id); |
302 Node* BuildNamedSuperStore(Node* receiver, Node* home_object, | 298 Node* BuildNamedSuperStore(Node* receiver, Node* home_object, |
303 Handle<Name> name, Node* value, TypeFeedbackId id); | 299 Handle<Name> name, Node* value, TypeFeedbackId id); |
304 Node* BuildNamedSuperLoad(Node* receiver, Node* home_object, | 300 Node* BuildNamedSuperLoad(Node* receiver, Node* home_object, |
305 Handle<Name> name, | 301 Handle<Name> name, const VectorSlotPair& feedback); |
306 const ResolvedFeedbackSlot& feedback); | |
307 Node* BuildKeyedSuperLoad(Node* receiver, Node* home_object, Node* key, | 302 Node* BuildKeyedSuperLoad(Node* receiver, Node* home_object, Node* key, |
308 const ResolvedFeedbackSlot& feedback); | 303 const VectorSlotPair& feedback); |
309 | 304 |
310 // Builders for accessing the function context. | 305 // Builders for accessing the function context. |
311 Node* BuildLoadBuiltinsObject(); | 306 Node* BuildLoadBuiltinsObject(); |
312 Node* BuildLoadGlobalObject(); | 307 Node* BuildLoadGlobalObject(); |
313 Node* BuildLoadGlobalProxy(); | 308 Node* BuildLoadGlobalProxy(); |
314 Node* BuildLoadClosure(); | 309 Node* BuildLoadClosure(); |
315 Node* BuildLoadObjectField(Node* object, int offset); | 310 Node* BuildLoadObjectField(Node* object, int offset); |
316 | 311 |
317 // Builders for accessing external references. | 312 // Builders for accessing external references. |
318 Node* BuildLoadExternal(ExternalReference ref, MachineType type); | 313 Node* BuildLoadExternal(ExternalReference ref, MachineType type); |
319 Node* BuildStoreExternal(ExternalReference ref, MachineType type, Node* val); | 314 Node* BuildStoreExternal(ExternalReference ref, MachineType type, Node* val); |
320 | 315 |
321 // Builders for automatic type conversion. | 316 // Builders for automatic type conversion. |
322 Node* BuildToBoolean(Node* input); | 317 Node* BuildToBoolean(Node* input); |
323 Node* BuildToName(Node* input, BailoutId bailout_id); | 318 Node* BuildToName(Node* input, BailoutId bailout_id); |
324 Node* BuildToObject(Node* input, BailoutId bailout_id); | 319 Node* BuildToObject(Node* input, BailoutId bailout_id); |
325 | 320 |
326 // Builder for adding the [[HomeObject]] to a value if the value came from a | 321 // Builder for adding the [[HomeObject]] to a value if the value came from a |
327 // function literal and needs a home object. Do nothing otherwise. | 322 // function literal and needs a home object. Do nothing otherwise. |
328 Node* BuildSetHomeObject(Node* value, Node* home_object, Expression* expr, | 323 Node* BuildSetHomeObject(Node* value, Node* home_object, Expression* expr, |
329 const ResolvedFeedbackSlot& slot); | 324 const VectorSlotPair& feedback); |
330 | 325 |
331 // Builders for error reporting at runtime. | 326 // Builders for error reporting at runtime. |
332 Node* BuildThrowError(Node* exception, BailoutId bailout_id); | 327 Node* BuildThrowError(Node* exception, BailoutId bailout_id); |
333 Node* BuildThrowReferenceError(Variable* var, BailoutId bailout_id); | 328 Node* BuildThrowReferenceError(Variable* var, BailoutId bailout_id); |
334 Node* BuildThrowConstAssignError(BailoutId bailout_id); | 329 Node* BuildThrowConstAssignError(BailoutId bailout_id); |
335 Node* BuildThrowStaticPrototypeError(BailoutId bailout_id); | 330 Node* BuildThrowStaticPrototypeError(BailoutId bailout_id); |
336 | 331 |
337 // Builders for dynamic hole-checks at runtime. | 332 // Builders for dynamic hole-checks at runtime. |
338 Node* BuildHoleCheckSilent(Node* value, Node* for_hole, Node* not_hole); | 333 Node* BuildHoleCheckSilent(Node* value, Node* for_hole, Node* not_hole); |
339 Node* BuildHoleCheckThrow(Node* value, Variable* var, Node* not_hole, | 334 Node* BuildHoleCheckThrow(Node* value, Variable* var, Node* not_hole, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 void VisitTypeof(UnaryOperation* expr); | 380 void VisitTypeof(UnaryOperation* expr); |
386 void VisitNot(UnaryOperation* expr); | 381 void VisitNot(UnaryOperation* expr); |
387 | 382 |
388 // Dispatched from VisitBinaryOperation. | 383 // Dispatched from VisitBinaryOperation. |
389 void VisitComma(BinaryOperation* expr); | 384 void VisitComma(BinaryOperation* expr); |
390 void VisitLogicalExpression(BinaryOperation* expr); | 385 void VisitLogicalExpression(BinaryOperation* expr); |
391 void VisitArithmeticExpression(BinaryOperation* expr); | 386 void VisitArithmeticExpression(BinaryOperation* expr); |
392 | 387 |
393 // Dispatched from VisitForInStatement. | 388 // Dispatched from VisitForInStatement. |
394 void VisitForInAssignment(Expression* expr, Node* value, | 389 void VisitForInAssignment(Expression* expr, Node* value, |
395 const ResolvedFeedbackSlot& slot, | 390 const VectorSlotPair& feedback, |
396 BailoutId bailout_id); | 391 BailoutId bailout_id); |
397 | 392 |
398 // Dispatched from VisitClassLiteral. | 393 // Dispatched from VisitClassLiteral. |
399 void VisitClassLiteralContents(ClassLiteral* expr); | 394 void VisitClassLiteralContents(ClassLiteral* expr); |
400 | 395 |
401 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 396 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
402 DISALLOW_COPY_AND_ASSIGN(AstGraphBuilder); | 397 DISALLOW_COPY_AND_ASSIGN(AstGraphBuilder); |
403 }; | 398 }; |
404 | 399 |
405 | 400 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 | 535 |
541 // Prepare environment to be used as loop header. | 536 // Prepare environment to be used as loop header. |
542 void PrepareForLoop(BitVector* assigned, bool is_osr = false); | 537 void PrepareForLoop(BitVector* assigned, bool is_osr = false); |
543 }; | 538 }; |
544 | 539 |
545 } // namespace compiler | 540 } // namespace compiler |
546 } // namespace internal | 541 } // namespace internal |
547 } // namespace v8 | 542 } // namespace v8 |
548 | 543 |
549 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 544 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
OLD | NEW |