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

Side by Side Diff: src/compiler/js-type-hint-lowering.h

Issue 2858933004: [turbofan] Lower monomorphic loads during graph building.
Patch Set: Prune headers Created 3 years, 6 months 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
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | src/compiler/js-type-hint-lowering.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 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_JS_TYPE_HINT_LOWERING_H_ 5 #ifndef V8_COMPILER_JS_TYPE_HINT_LOWERING_H_
6 #define V8_COMPILER_JS_TYPE_HINT_LOWERING_H_ 6 #define V8_COMPILER_JS_TYPE_HINT_LOWERING_H_
7 7
8 #include "src/base/flags.h" 8 #include "src/base/flags.h"
9 #include "src/compiler/graph-reducer.h" 9 #include "src/compiler/graph-reducer.h"
10 #include "src/deoptimize-reason.h" 10 #include "src/deoptimize-reason.h"
11 #include "src/handles.h" 11 #include "src/handles.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 // Forward declarations. 16 // Forward declarations.
17 class CompilationDependencies;
17 class FeedbackNexus; 18 class FeedbackNexus;
18 class FeedbackSlot; 19 class FeedbackSlot;
19 20
20 namespace compiler { 21 namespace compiler {
21 22
22 // Forward declarations. 23 // Forward declarations.
23 class JSGraph; 24 class JSGraph;
24 class Node; 25 class Node;
25 class Operator; 26 class Operator;
26 27
(...skipping 13 matching lines...) Expand all
40 // effect and carry {Operator::Property} for the entire lowering). Use-sites 41 // effect and carry {Operator::Property} for the entire lowering). Use-sites
41 // rely on this invariant, if it ever changes we need to switch the interface 42 // rely on this invariant, if it ever changes we need to switch the interface
42 // away from using the {Reduction} class. 43 // away from using the {Reduction} class.
43 class JSTypeHintLowering { 44 class JSTypeHintLowering {
44 public: 45 public:
45 // Flags that control the mode of operation. 46 // Flags that control the mode of operation.
46 enum Flag { kNoFlags = 0u, kBailoutOnUninitialized = 1u << 1 }; 47 enum Flag { kNoFlags = 0u, kBailoutOnUninitialized = 1u << 1 };
47 typedef base::Flags<Flag> Flags; 48 typedef base::Flags<Flag> Flags;
48 49
49 JSTypeHintLowering(JSGraph* jsgraph, Handle<FeedbackVector> feedback_vector, 50 JSTypeHintLowering(JSGraph* jsgraph, Handle<FeedbackVector> feedback_vector,
50 Flags flags); 51 Handle<Context> native_context,
52 CompilationDependencies* dependencies, Flags flags);
51 53
52 // Potential reduction of binary (arithmetic, logical, shift and relational 54 // Potential reduction of binary (arithmetic, logical, shift and relational
53 // comparison) operations. 55 // comparison) operations.
54 Reduction ReduceBinaryOperation(const Operator* op, Node* left, Node* right, 56 Reduction ReduceBinaryOperation(const Operator* op, Node* left, Node* right,
55 Node* effect, Node* control, 57 Node* effect, Node* control,
56 FeedbackSlot slot) const; 58 FeedbackSlot slot) const;
57 59
58 // Potential reduction to ToNumber operations 60 // Potential reduction to ToNumber operations
59 Reduction ReduceToNumberOperation(Node* value, Node* effect, Node* control, 61 Reduction ReduceToNumberOperation(Node* value, Node* effect, Node* control,
60 FeedbackSlot slot) const; 62 FeedbackSlot slot) const;
61 63
62 // Potential reduction to ToPrimitiveToString operations 64 // Potential reduction to ToPrimitiveToString operations
63 Reduction ReduceToPrimitiveToStringOperation(Node* value, Node* effect, 65 Reduction ReduceToPrimitiveToStringOperation(Node* value, Node* effect,
64 Node* control, 66 Node* control,
65 FeedbackSlot slot) const; 67 FeedbackSlot slot) const;
68 class LoweringResult {
69 public:
70 Node* value() const { return value_; }
71 Node* effect() const { return effect_; }
72 Node* control() const { return control_; }
73
74 bool Changed() const { return kind_ != LoweringResultKind::kNoChange; }
75 bool IsExit() const { return kind_ == LoweringResultKind::kExit; }
76 bool IsSideEffectFree() const {
77 return kind_ == LoweringResultKind::kSideEffectFree;
78 }
79
80 static LoweringResult SideEffectFree(Node* value, Node* effect,
81 Node* control) {
82 DCHECK_NOT_NULL(effect);
83 DCHECK_NOT_NULL(control);
84 return LoweringResult(LoweringResultKind::kSideEffectFree, value, effect,
85 control);
86 }
87
88 static LoweringResult NoChange() {
89 return LoweringResult(LoweringResultKind::kNoChange, nullptr, nullptr,
90 nullptr);
91 }
92
93 static LoweringResult Exit(Node* control) {
94 return LoweringResult(LoweringResultKind::kExit, nullptr, nullptr,
95 control);
96 }
97
98 private:
99 enum class LoweringResultKind { kNoChange, kSideEffectFree, kExit };
100
101 LoweringResult(LoweringResultKind kind, Node* value, Node* effect,
102 Node* control)
103 : kind_(kind), value_(value), effect_(effect), control_(control) {}
104
105 LoweringResultKind kind_;
106 Node* value_;
107 Node* effect_;
108 Node* control_;
109 };
66 110
67 // Potential reduction of property access operations. 111 // Potential reduction of property access operations.
68 Reduction ReduceLoadNamedOperation(const Operator* op, Node* obj, 112 LoweringResult ReduceLoadNamedOperation(const Operator* op, Node* obj,
69 Node* effect, Node* control, 113 Node* effect, Node* control,
70 FeedbackSlot slot) const; 114 FeedbackSlot slot) const;
71 Reduction ReduceLoadKeyedOperation(const Operator* op, Node* obj, Node* key, 115 Reduction ReduceLoadKeyedOperation(const Operator* op, Node* obj, Node* key,
72 Node* effect, Node* control, 116 Node* effect, Node* control,
73 FeedbackSlot slot) const; 117 FeedbackSlot slot) const;
74 Reduction ReduceStoreNamedOperation(const Operator* op, Node* obj, Node* val, 118 Reduction ReduceStoreNamedOperation(const Operator* op, Node* obj, Node* val,
75 Node* effect, Node* control, 119 Node* effect, Node* control,
76 FeedbackSlot slot) const; 120 FeedbackSlot slot) const;
77 Reduction ReduceStoreKeyedOperation(const Operator* op, Node* obj, Node* key, 121 Reduction ReduceStoreKeyedOperation(const Operator* op, Node* obj, Node* key,
78 Node* val, Node* effect, Node* control, 122 Node* val, Node* effect, Node* control,
79 FeedbackSlot slot) const; 123 FeedbackSlot slot) const;
80 124
81 private: 125 private:
82 friend class JSSpeculativeBinopBuilder; 126 friend class JSSpeculativeBinopBuilder;
83 Node* TryBuildSoftDeopt(FeedbackNexus& nexus, Node* effect, Node* control, 127 Node* TryBuildSoftDeopt(FeedbackNexus& nexus, Node* effect, Node* control,
84 DeoptimizeReason reson) const; 128 DeoptimizeReason reson) const;
85 129
86 JSGraph* jsgraph() const { return jsgraph_; } 130 JSGraph* jsgraph() const { return jsgraph_; }
87 Flags flags() const { return flags_; } 131 Flags flags() const { return flags_; }
88 const Handle<FeedbackVector>& feedback_vector() const { 132 const Handle<FeedbackVector>& feedback_vector() const {
89 return feedback_vector_; 133 return feedback_vector_;
90 } 134 }
135 Graph* graph() const;
136
137 Handle<Context> native_context() const { return native_context_; }
138 CompilationDependencies* dependencies() const { return dependencies_; }
91 139
92 JSGraph* jsgraph_; 140 JSGraph* jsgraph_;
93 Flags const flags_; 141 Flags const flags_;
94 Handle<FeedbackVector> feedback_vector_; 142 Handle<FeedbackVector> feedback_vector_;
95 143
144 Handle<Context> native_context_;
145 CompilationDependencies* dependencies_;
146
96 DISALLOW_COPY_AND_ASSIGN(JSTypeHintLowering); 147 DISALLOW_COPY_AND_ASSIGN(JSTypeHintLowering);
97 }; 148 };
98 149
99 } // namespace compiler 150 } // namespace compiler
100 } // namespace internal 151 } // namespace internal
101 } // namespace v8 152 } // namespace v8
102 153
103 #endif // V8_COMPILER_JS_TYPE_HINT_LOWERING_H_ 154 #endif // V8_COMPILER_JS_TYPE_HINT_LOWERING_H_
OLDNEW
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | src/compiler/js-type-hint-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698