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/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/compiler/compiler-source-position-table.h" | 9 #include "src/compiler/compiler-source-position-table.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 // Computes local variable liveness and replaces dead variables in | 256 // Computes local variable liveness and replaces dead variables in |
257 // frame states with the undefined values. | 257 // frame states with the undefined values. |
258 void ClearNonLiveSlotsInFrameStates(); | 258 void ClearNonLiveSlotsInFrameStates(); |
259 | 259 |
260 Node** EnsureInputBufferSize(int size); | 260 Node** EnsureInputBufferSize(int size); |
261 | 261 |
262 // Named and keyed loads require a VectorSlotPair for successful lowering. | 262 // Named and keyed loads require a VectorSlotPair for successful lowering. |
263 VectorSlotPair CreateVectorSlotPair(FeedbackVectorSlot slot) const; | 263 VectorSlotPair CreateVectorSlotPair(FeedbackVectorSlot slot) const; |
264 | 264 |
265 // Determine which contexts need to be checked for extension objects that | |
266 // might shadow the optimistic declaration of dynamic lookup variables. | |
267 uint32_t ComputeBitsetForDynamicGlobal(Variable* variable); | |
268 uint32_t ComputeBitsetForDynamicContext(Variable* variable); | |
269 | |
270 // Computes the frequency for JSCallFunction and JSCallConstruct nodes. | 265 // Computes the frequency for JSCallFunction and JSCallConstruct nodes. |
271 float ComputeCallFrequency(FeedbackVectorSlot slot) const; | 266 float ComputeCallFrequency(FeedbackVectorSlot slot) const; |
272 | 267 |
273 // =========================================================================== | 268 // =========================================================================== |
274 // The following build methods all generate graph fragments and return one | 269 // The following build methods all generate graph fragments and return one |
275 // resulting node. The operand stack height remains the same, variables and | 270 // resulting node. The operand stack height remains the same, variables and |
276 // other dependencies tracked by the environment might be mutated though. | 271 // other dependencies tracked by the environment might be mutated though. |
277 | 272 |
278 // Builders to create local function, script and block contexts. | 273 // Builders to create local function, script and block contexts. |
279 Node* BuildLocalActivationContext(Node* context); | 274 Node* BuildLocalActivationContext(Node* context); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 Handle<Name> name, const VectorSlotPair& feedback); | 320 Handle<Name> name, const VectorSlotPair& feedback); |
326 Node* BuildKeyedSuperLoad(Node* receiver, Node* home_object, Node* key, | 321 Node* BuildKeyedSuperLoad(Node* receiver, Node* home_object, Node* key, |
327 const VectorSlotPair& feedback); | 322 const VectorSlotPair& feedback); |
328 | 323 |
329 // Builders for global variable loads and stores. | 324 // Builders for global variable loads and stores. |
330 Node* BuildGlobalLoad(Handle<Name> name, const VectorSlotPair& feedback, | 325 Node* BuildGlobalLoad(Handle<Name> name, const VectorSlotPair& feedback, |
331 TypeofMode typeof_mode); | 326 TypeofMode typeof_mode); |
332 Node* BuildGlobalStore(Handle<Name> name, Node* value, | 327 Node* BuildGlobalStore(Handle<Name> name, Node* value, |
333 const VectorSlotPair& feedback); | 328 const VectorSlotPair& feedback); |
334 | 329 |
335 // Builders for dynamic variable loads and stores. | |
336 Node* BuildDynamicLoad(Handle<Name> name, TypeofMode typeof_mode); | |
337 Node* BuildDynamicStore(Handle<Name> name, Node* value); | |
338 | |
339 // Builders for accessing the function context. | 330 // Builders for accessing the function context. |
340 Node* BuildLoadGlobalObject(); | 331 Node* BuildLoadGlobalObject(); |
341 Node* BuildLoadNativeContextField(int index); | 332 Node* BuildLoadNativeContextField(int index); |
342 | 333 |
343 // Builders for automatic type conversion. | 334 // Builders for automatic type conversion. |
344 Node* BuildToBoolean(Node* input, TypeFeedbackId feedback_id); | 335 Node* BuildToBoolean(Node* input, TypeFeedbackId feedback_id); |
345 Node* BuildToName(Node* input, BailoutId bailout_id); | 336 Node* BuildToName(Node* input, BailoutId bailout_id); |
346 Node* BuildToObject(Node* input, BailoutId bailout_id); | 337 Node* BuildToObject(Node* input, BailoutId bailout_id); |
347 | 338 |
348 // Builder for adding the [[HomeObject]] to a value if the value came from a | 339 // Builder for adding the [[HomeObject]] to a value if the value came from a |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 371 |
381 // =========================================================================== | 372 // =========================================================================== |
382 // The following build methods have the same contract as the above ones, but | 373 // The following build methods have the same contract as the above ones, but |
383 // they can also return {nullptr} to indicate that no fragment was built. Note | 374 // they can also return {nullptr} to indicate that no fragment was built. Note |
384 // that these are optimizations, disabling any of them should still produce | 375 // that these are optimizations, disabling any of them should still produce |
385 // correct graphs. | 376 // correct graphs. |
386 | 377 |
387 // Optimization for variable load from global object. | 378 // Optimization for variable load from global object. |
388 Node* TryLoadGlobalConstant(Handle<Name> name); | 379 Node* TryLoadGlobalConstant(Handle<Name> name); |
389 | 380 |
390 // Optimization for variable load of dynamic lookup slot that is most likely | |
391 // to resolve to a global slot or context slot (inferred from scope chain). | |
392 Node* TryLoadDynamicVariable(Variable* variable, Handle<String> name, | |
393 BailoutId bailout_id, | |
394 const VectorSlotPair& feedback, | |
395 OutputFrameStateCombine combine, | |
396 TypeofMode typeof_mode); | |
397 | |
398 // Optimizations for automatic type conversion. | 381 // Optimizations for automatic type conversion. |
399 Node* TryFastToBoolean(Node* input); | 382 Node* TryFastToBoolean(Node* input); |
400 Node* TryFastToName(Node* input); | 383 Node* TryFastToName(Node* input); |
401 | 384 |
402 // =========================================================================== | 385 // =========================================================================== |
403 // The following visitation methods all recursively visit a subtree of the | 386 // The following visitation methods all recursively visit a subtree of the |
404 // underlying AST and extent the graph. The operand stack is mutated in a way | 387 // underlying AST and extent the graph. The operand stack is mutated in a way |
405 // consistent with other compilers: | 388 // consistent with other compilers: |
406 // - Expressions pop operands and push result, depending on {AstContext}. | 389 // - Expressions pop operands and push result, depending on {AstContext}. |
407 // - Statements keep the operand stack balanced. | 390 // - Statements keep the operand stack balanced. |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 private: | 627 private: |
645 SourcePositionTable* const source_positions_; | 628 SourcePositionTable* const source_positions_; |
646 SourcePosition const start_position_; | 629 SourcePosition const start_position_; |
647 }; | 630 }; |
648 | 631 |
649 } // namespace compiler | 632 } // namespace compiler |
650 } // namespace internal | 633 } // namespace internal |
651 } // namespace v8 | 634 } // namespace v8 |
652 | 635 |
653 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 636 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
OLD | NEW |