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" |
11 #include "src/compiler/js-graph.h" | 11 #include "src/compiler/js-graph.h" |
12 #include "src/compiler/node-aux-data.h" | 12 #include "src/compiler/node-aux-data.h" |
13 #include "src/compiler/simplified-operator.h" | 13 #include "src/compiler/simplified-operator.h" |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 namespace internal { | 16 namespace internal { |
17 | 17 |
18 class TypeFeedbackOracle; | 18 class TypeFeedbackOracle; |
19 class SmallMapList; | 19 class SmallMapList; |
| 20 class CompilationDependencies; |
20 | 21 |
21 namespace compiler { | 22 namespace compiler { |
22 | 23 |
23 // Stores type feedback information for nodes in the graph in a separate | 24 // Stores type feedback information for nodes in the graph in a separate |
24 // data structure. | 25 // data structure. |
25 class JSTypeFeedbackTable : public ZoneObject { | 26 class JSTypeFeedbackTable : public ZoneObject { |
26 public: | 27 public: |
27 explicit JSTypeFeedbackTable(Zone* zone); | 28 explicit JSTypeFeedbackTable(Zone* zone); |
28 | 29 |
29 // TODO(titzer): support recording the feedback vector slot. | 30 // TODO(titzer): support recording the feedback vector slot. |
(...skipping 13 matching lines...) Expand all Loading... |
43 } | 44 } |
44 }; | 45 }; |
45 | 46 |
46 | 47 |
47 // Specializes a graph to the type feedback recorded in the | 48 // Specializes a graph to the type feedback recorded in the |
48 // {js_type_feedback} provided to the constructor. | 49 // {js_type_feedback} provided to the constructor. |
49 class JSTypeFeedbackSpecializer : public Reducer { | 50 class JSTypeFeedbackSpecializer : public Reducer { |
50 public: | 51 public: |
51 JSTypeFeedbackSpecializer(JSGraph* jsgraph, | 52 JSTypeFeedbackSpecializer(JSGraph* jsgraph, |
52 JSTypeFeedbackTable* js_type_feedback, | 53 JSTypeFeedbackTable* js_type_feedback, |
53 TypeFeedbackOracle* oracle) | 54 TypeFeedbackOracle* oracle, |
| 55 Handle<GlobalObject> global_object, |
| 56 CompilationDependencies* dependencies) |
54 : jsgraph_(jsgraph), | 57 : jsgraph_(jsgraph), |
55 simplified_(jsgraph->graph()->zone()), | 58 simplified_(jsgraph->graph()->zone()), |
56 js_type_feedback_(js_type_feedback), | 59 js_type_feedback_(js_type_feedback), |
57 oracle_(oracle) { | 60 oracle_(oracle), |
| 61 global_object_(global_object), |
| 62 dependencies_(dependencies) { |
58 CHECK(js_type_feedback); | 63 CHECK(js_type_feedback); |
59 } | 64 } |
60 | 65 |
61 Reduction Reduce(Node* node) override; | 66 Reduction Reduce(Node* node) override; |
62 | 67 |
63 // Visible for unit testing. | 68 // Visible for unit testing. |
64 Reduction ReduceJSLoadNamed(Node* node); | 69 Reduction ReduceJSLoadNamed(Node* node); |
| 70 Reduction ReduceJSLoadNamedForGlobalVariable(Node* node); |
65 Reduction ReduceJSLoadProperty(Node* node); | 71 Reduction ReduceJSLoadProperty(Node* node); |
66 Reduction ReduceJSStoreNamed(Node* node); | 72 Reduction ReduceJSStoreNamed(Node* node); |
67 Reduction ReduceJSStoreProperty(Node* node); | 73 Reduction ReduceJSStoreProperty(Node* node); |
68 | 74 |
69 private: | 75 private: |
70 JSGraph* jsgraph_; | 76 JSGraph* jsgraph_; |
71 SimplifiedOperatorBuilder simplified_; | 77 SimplifiedOperatorBuilder simplified_; |
72 JSTypeFeedbackTable* js_type_feedback_; | 78 JSTypeFeedbackTable* js_type_feedback_; |
73 TypeFeedbackOracle* oracle_; | 79 TypeFeedbackOracle* oracle_; |
| 80 Handle<GlobalObject> global_object_; |
| 81 CompilationDependencies* dependencies_; |
74 | 82 |
75 TypeFeedbackOracle* oracle() { return oracle_; } | 83 TypeFeedbackOracle* oracle() { return oracle_; } |
76 Graph* graph() { return jsgraph_->graph(); } | 84 Graph* graph() { return jsgraph_->graph(); } |
77 JSGraph* jsgraph() { return jsgraph_; } | 85 JSGraph* jsgraph() { return jsgraph_; } |
78 CommonOperatorBuilder* common() { return jsgraph_->common(); } | 86 CommonOperatorBuilder* common() { return jsgraph_->common(); } |
79 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 87 SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
80 | 88 |
81 void BuildMapCheck(Node* receiver, Handle<Map> map, bool smi_check, | 89 void BuildMapCheck(Node* receiver, Handle<Map> map, bool smi_check, |
82 Node* effect, Node* control, Node** success, Node** fail); | 90 Node* effect, Node* control, Node** success, Node** fail); |
83 | 91 |
84 void GatherReceiverTypes(Node* receiver, Node* effect, TypeFeedbackId id, | 92 void GatherReceiverTypes(Node* receiver, Node* effect, TypeFeedbackId id, |
85 Handle<Name> property, SmallMapList* maps); | 93 Handle<Name> property, SmallMapList* maps); |
86 }; | 94 }; |
87 | 95 |
88 } // namespace compiler | 96 } // namespace compiler |
89 } // namespace internal | 97 } // namespace internal |
90 } // namespace v8 | 98 } // namespace v8 |
91 | 99 |
92 #endif | 100 #endif |
OLD | NEW |