| 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_LOWERING_H_ | 5 #ifndef V8_COMPILER_JS_TYPE_FEEDBACK_LOWERING_H_ |
| 6 #define V8_COMPILER_JS_TYPE_FEEDBACK_LOWERING_H_ | 6 #define V8_COMPILER_JS_TYPE_FEEDBACK_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/compiler/simplified-operator.h" | |
| 11 | 10 |
| 12 namespace v8 { | 11 namespace v8 { |
| 13 namespace internal { | 12 namespace internal { |
| 14 | 13 |
| 15 // Forward declarations. | 14 // Forward declarations. |
| 16 class Factory; | 15 class Factory; |
| 17 | 16 |
| 18 namespace compiler { | 17 namespace compiler { |
| 19 | 18 |
| 20 // Forward declarations. | 19 // Forward declarations. |
| 21 class CommonOperatorBuilder; | 20 class CommonOperatorBuilder; |
| 22 class JSGraph; | 21 class JSGraph; |
| 23 class MachineOperatorBuilder; | 22 class MachineOperatorBuilder; |
| 23 class SimplifiedOperatorBuilder; |
| 24 | 24 |
| 25 | 25 |
| 26 // Lowers JS-level operators to simplified operators based on type feedback. | 26 // Lowers JS-level operators to simplified operators based on type feedback. |
| 27 class JSTypeFeedbackLowering final : public AdvancedReducer { | 27 class JSTypeFeedbackLowering final : public AdvancedReducer { |
| 28 public: | 28 public: |
| 29 // Various configuration flags to control the operation of this lowering. | 29 // Various configuration flags to control the operation of this lowering. |
| 30 enum Flag { | 30 enum Flag { |
| 31 kNoFlags = 0, | 31 kNoFlags = 0, |
| 32 kDeoptimizationEnabled = 1 << 0, | 32 kDeoptimizationEnabled = 1 << 0, |
| 33 }; | 33 }; |
| 34 typedef base::Flags<Flag> Flags; | 34 typedef base::Flags<Flag> Flags; |
| 35 | 35 |
| 36 JSTypeFeedbackLowering(Editor* editor, Flags flags, JSGraph* jsgraph); | 36 JSTypeFeedbackLowering(Editor* editor, Flags flags, JSGraph* jsgraph); |
| 37 ~JSTypeFeedbackLowering() final {} | 37 ~JSTypeFeedbackLowering() final {} |
| 38 | 38 |
| 39 Reduction Reduce(Node* node) final; | 39 Reduction Reduce(Node* node) final; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 Reduction ReduceJSLoadNamed(Node* node); | 42 Reduction ReduceJSLoadNamed(Node* node); |
| 43 | 43 |
| 44 Factory* factory() const; | 44 Factory* factory() const; |
| 45 Flags flags() const { return flags_; } | 45 Flags flags() const { return flags_; } |
| 46 Graph* graph() const; | 46 Graph* graph() const; |
| 47 Isolate* isolate() const; | 47 Isolate* isolate() const; |
| 48 JSGraph* jsgraph() const { return jsgraph_; } | 48 JSGraph* jsgraph() const { return jsgraph_; } |
| 49 CommonOperatorBuilder* common() const; | 49 CommonOperatorBuilder* common() const; |
| 50 MachineOperatorBuilder* machine() const; | 50 MachineOperatorBuilder* machine() const; |
| 51 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 51 SimplifiedOperatorBuilder* simplified() const; |
| 52 | 52 |
| 53 Flags const flags_; | 53 Flags const flags_; |
| 54 JSGraph* const jsgraph_; | 54 JSGraph* const jsgraph_; |
| 55 SimplifiedOperatorBuilder simplified_; | |
| 56 | 55 |
| 57 DISALLOW_COPY_AND_ASSIGN(JSTypeFeedbackLowering); | 56 DISALLOW_COPY_AND_ASSIGN(JSTypeFeedbackLowering); |
| 58 }; | 57 }; |
| 59 | 58 |
| 60 DEFINE_OPERATORS_FOR_FLAGS(JSTypeFeedbackLowering::Flags) | 59 DEFINE_OPERATORS_FOR_FLAGS(JSTypeFeedbackLowering::Flags) |
| 61 | 60 |
| 62 } // namespace compiler | 61 } // namespace compiler |
| 63 } // namespace internal | 62 } // namespace internal |
| 64 } // namespace v8 | 63 } // namespace v8 |
| 65 | 64 |
| 66 #endif // V8_COMPILER_JS_TYPE_FEEDBACK_LOWERING_H_ | 65 #endif // V8_COMPILER_JS_TYPE_FEEDBACK_LOWERING_H_ |
| OLD | NEW |