Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: src/compiler/ast-graph-builder.h

Issue 1487973002: [turbofan] Add binary operation hints for javascript operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/liveness-analyzer.h" 10 #include "src/compiler/liveness-analyzer.h"
11 #include "src/compiler/state-values-utils.h" 11 #include "src/compiler/state-values-utils.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 // Forward declarations.
16 class BitVector; 17 class BitVector;
17 18
19
18 namespace compiler { 20 namespace compiler {
19 21
22 // Forward declarations.
20 class ControlBuilder; 23 class ControlBuilder;
21 class Graph; 24 class Graph;
22 class LoopAssignmentAnalysis; 25 class LoopAssignmentAnalysis;
23 class LoopBuilder; 26 class LoopBuilder;
24 class Node; 27 class Node;
28 class TypeHintAnalysis;
29
25 30
26 // The AstGraphBuilder produces a high-level IR graph, based on an 31 // The AstGraphBuilder produces a high-level IR graph, based on an
27 // underlying AST. The produced graph can either be compiled into a 32 // underlying AST. The produced graph can either be compiled into a
28 // stand-alone function or be wired into another graph for the purposes 33 // stand-alone function or be wired into another graph for the purposes
29 // of function inlining. 34 // of function inlining.
30 class AstGraphBuilder : public AstVisitor { 35 class AstGraphBuilder : public AstVisitor {
31 public: 36 public:
32 AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph, 37 AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph,
33 LoopAssignmentAnalysis* loop_assignment = NULL); 38 LoopAssignmentAnalysis* loop_assignment = nullptr,
39 TypeHintAnalysis* type_hint_analysis = nullptr);
34 40
35 // Creates a graph by visiting the entire AST. 41 // Creates a graph by visiting the entire AST.
36 bool CreateGraph(bool stack_check = true); 42 bool CreateGraph(bool stack_check = true);
37 43
38 // Helpers to create new control nodes. 44 // Helpers to create new control nodes.
39 Node* NewIfTrue() { return NewNode(common()->IfTrue()); } 45 Node* NewIfTrue() { return NewNode(common()->IfTrue()); }
40 Node* NewIfFalse() { return NewNode(common()->IfFalse()); } 46 Node* NewIfFalse() { return NewNode(common()->IfFalse()); }
41 Node* NewMerge() { return NewNode(common()->Merge(1), true); } 47 Node* NewMerge() { return NewNode(common()->Merge(1), true); }
42 Node* NewLoop() { return NewNode(common()->Loop(1), true); } 48 Node* NewLoop() { return NewNode(common()->Loop(1), true); }
43 Node* NewBranch(Node* condition, BranchHint hint = BranchHint::kNone) { 49 Node* NewBranch(Node* condition, BranchHint hint = BranchHint::kNone) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 105
100 // Optimization to cache loaded feedback vector. 106 // Optimization to cache loaded feedback vector.
101 SetOncePointer<Node> feedback_vector_; 107 SetOncePointer<Node> feedback_vector_;
102 108
103 // Control nodes that exit the function body. 109 // Control nodes that exit the function body.
104 ZoneVector<Node*> exit_controls_; 110 ZoneVector<Node*> exit_controls_;
105 111
106 // Result of loop assignment analysis performed before graph creation. 112 // Result of loop assignment analysis performed before graph creation.
107 LoopAssignmentAnalysis* loop_assignment_analysis_; 113 LoopAssignmentAnalysis* loop_assignment_analysis_;
108 114
115 // Result of type hint analysis performed before graph creation.
116 TypeHintAnalysis* type_hint_analysis_;
117
109 // Cache for StateValues nodes for frame states. 118 // Cache for StateValues nodes for frame states.
110 StateValuesCache state_values_cache_; 119 StateValuesCache state_values_cache_;
111 120
112 // Analyzer of local variable liveness. 121 // Analyzer of local variable liveness.
113 LivenessAnalyzer liveness_analyzer_; 122 LivenessAnalyzer liveness_analyzer_;
114 123
115 // Function info for frame state construction. 124 // Function info for frame state construction.
116 const FrameStateFunctionInfo* const frame_state_function_info_; 125 const FrameStateFunctionInfo* const frame_state_function_info_;
117 126
118 // Growth increment for the temporary buffer used to construct input lists to 127 // Growth increment for the temporary buffer used to construct input lists to
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 BailoutId bailout_id); 346 BailoutId bailout_id);
338 347
339 // Builders for conditional errors. 348 // Builders for conditional errors.
340 Node* BuildThrowIfStaticPrototype(Node* name, BailoutId bailout_id); 349 Node* BuildThrowIfStaticPrototype(Node* name, BailoutId bailout_id);
341 350
342 // Builders for non-local control flow. 351 // Builders for non-local control flow.
343 Node* BuildReturn(Node* return_value); 352 Node* BuildReturn(Node* return_value);
344 Node* BuildThrow(Node* exception_value); 353 Node* BuildThrow(Node* exception_value);
345 354
346 // Builders for binary operations. 355 // Builders for binary operations.
347 Node* BuildBinaryOp(Node* left, Node* right, Token::Value op); 356 Node* BuildBinaryOp(Node* left, Node* right, Token::Value op,
357 TypeFeedbackId feedback_id);
348 358
349 // Process arguments to a call by popping {arity} elements off the operand 359 // Process arguments to a call by popping {arity} elements off the operand
350 // stack and build a call node using the given call operator. 360 // stack and build a call node using the given call operator.
351 Node* ProcessArguments(const Operator* op, int arity); 361 Node* ProcessArguments(const Operator* op, int arity);
352 362
353 // =========================================================================== 363 // ===========================================================================
354 // The following build methods have the same contract as the above ones, but 364 // The following build methods have the same contract as the above ones, but
355 // they can also return {NULL} to indicate that no fragment was built. Note 365 // they can also return {NULL} to indicate that no fragment was built. Note
356 // that these are optimizations, disabling any of them should still produce 366 // that these are optimizations, disabling any of them should still produce
357 // correct graphs. 367 // correct graphs.
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 581
572 // Prepare environment to be used as loop header. 582 // Prepare environment to be used as loop header.
573 void PrepareForLoop(BitVector* assigned, bool is_osr = false); 583 void PrepareForLoop(BitVector* assigned, bool is_osr = false);
574 }; 584 };
575 585
576 } // namespace compiler 586 } // namespace compiler
577 } // namespace internal 587 } // namespace internal
578 } // namespace v8 588 } // namespace v8
579 589
580 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ 590 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698