OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_FEEDBACK_H_ | 5 #ifndef V8_COMPILER_JS_TYPE_FEEDBACK_H_ |
6 #define V8_COMPILER_JS_TYPE_FEEDBACK_H_ | 6 #define V8_COMPILER_JS_TYPE_FEEDBACK_H_ |
7 | 7 |
8 #include "src/utils.h" | 8 #include "src/utils.h" |
9 | 9 |
10 #include "src/compiler/graph-reducer.h" | 10 #include "src/compiler/graph-reducer.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 ? FeedbackVectorICSlot::Invalid() | 55 ? FeedbackVectorICSlot::Invalid() |
56 : it->second; | 56 : it->second; |
57 } | 57 } |
58 }; | 58 }; |
59 | 59 |
60 | 60 |
61 // Specializes a graph to the type feedback recorded in the | 61 // Specializes a graph to the type feedback recorded in the |
62 // {js_type_feedback} provided to the constructor. | 62 // {js_type_feedback} provided to the constructor. |
63 class JSTypeFeedbackSpecializer : public AdvancedReducer { | 63 class JSTypeFeedbackSpecializer : public AdvancedReducer { |
64 public: | 64 public: |
| 65 enum DeoptimizationMode { kDeoptimizationEnabled, kDeoptimizationDisabled }; |
| 66 |
65 JSTypeFeedbackSpecializer(Editor* editor, JSGraph* jsgraph, | 67 JSTypeFeedbackSpecializer(Editor* editor, JSGraph* jsgraph, |
66 JSTypeFeedbackTable* js_type_feedback, | 68 JSTypeFeedbackTable* js_type_feedback, |
67 TypeFeedbackOracle* oracle, | 69 TypeFeedbackOracle* oracle, |
68 Handle<GlobalObject> global_object, | 70 Handle<GlobalObject> global_object, |
| 71 DeoptimizationMode mode, |
69 CompilationDependencies* dependencies) | 72 CompilationDependencies* dependencies) |
70 : AdvancedReducer(editor), | 73 : AdvancedReducer(editor), |
71 jsgraph_(jsgraph), | 74 jsgraph_(jsgraph), |
72 simplified_(jsgraph->graph()->zone()), | 75 simplified_(jsgraph->graph()->zone()), |
73 js_type_feedback_(js_type_feedback), | 76 js_type_feedback_(js_type_feedback), |
74 oracle_(oracle), | 77 oracle_(oracle), |
75 global_object_(global_object), | 78 global_object_(global_object), |
| 79 mode_(mode), |
76 dependencies_(dependencies) { | 80 dependencies_(dependencies) { |
77 CHECK(js_type_feedback); | 81 CHECK_NOT_NULL(js_type_feedback); |
78 } | 82 } |
79 | 83 |
80 Reduction Reduce(Node* node) override; | 84 Reduction Reduce(Node* node) override; |
81 | 85 |
82 // Visible for unit testing. | 86 // Visible for unit testing. |
83 Reduction ReduceJSLoadNamed(Node* node); | 87 Reduction ReduceJSLoadNamed(Node* node); |
84 Reduction ReduceJSLoadNamedForGlobalVariable(Node* node); | 88 Reduction ReduceJSLoadNamedForGlobalVariable(Node* node); |
85 Reduction ReduceJSLoadProperty(Node* node); | 89 Reduction ReduceJSLoadProperty(Node* node); |
86 Reduction ReduceJSStoreNamed(Node* node); | 90 Reduction ReduceJSStoreNamed(Node* node); |
87 Reduction ReduceJSStoreProperty(Node* node); | 91 Reduction ReduceJSStoreProperty(Node* node); |
88 | 92 |
89 private: | 93 private: |
90 JSGraph* jsgraph_; | 94 JSGraph* jsgraph_; |
91 SimplifiedOperatorBuilder simplified_; | 95 SimplifiedOperatorBuilder simplified_; |
92 JSTypeFeedbackTable* js_type_feedback_; | 96 JSTypeFeedbackTable* js_type_feedback_; |
93 TypeFeedbackOracle* oracle_; | 97 TypeFeedbackOracle* oracle_; |
94 Handle<GlobalObject> global_object_; | 98 Handle<GlobalObject> global_object_; |
| 99 DeoptimizationMode const mode_; |
95 CompilationDependencies* dependencies_; | 100 CompilationDependencies* dependencies_; |
96 | 101 |
97 TypeFeedbackOracle* oracle() { return oracle_; } | 102 TypeFeedbackOracle* oracle() { return oracle_; } |
98 Graph* graph() { return jsgraph_->graph(); } | 103 Graph* graph() { return jsgraph_->graph(); } |
99 JSGraph* jsgraph() { return jsgraph_; } | 104 JSGraph* jsgraph() { return jsgraph_; } |
100 CommonOperatorBuilder* common() { return jsgraph_->common(); } | 105 CommonOperatorBuilder* common() { return jsgraph_->common(); } |
| 106 DeoptimizationMode mode() const { return mode_; } |
101 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 107 SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
102 | 108 |
103 void BuildMapCheck(Node* receiver, Handle<Map> map, bool smi_check, | 109 void BuildMapCheck(Node* receiver, Handle<Map> map, bool smi_check, |
104 Node* effect, Node* control, Node** success, Node** fail); | 110 Node* effect, Node* control, Node** success, Node** fail); |
105 | 111 |
106 Node* GetFrameStateBefore(Node* node); | 112 Node* GetFrameStateBefore(Node* node); |
107 }; | 113 }; |
108 | 114 |
109 } // namespace compiler | 115 } // namespace compiler |
110 } // namespace internal | 116 } // namespace internal |
111 } // namespace v8 | 117 } // namespace v8 |
112 | 118 |
113 #endif | 119 #endif |
OLD | NEW |