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