OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_BUILTIN_REDUCER_H_ | 5 #ifndef V8_COMPILER_JS_BUILTIN_REDUCER_H_ |
6 #define V8_COMPILER_JS_BUILTIN_REDUCER_H_ | 6 #define V8_COMPILER_JS_BUILTIN_REDUCER_H_ |
7 | 7 |
| 8 #include "src/base/flags.h" |
8 #include "src/compiler/graph-reducer.h" | 9 #include "src/compiler/graph-reducer.h" |
9 | 10 |
10 namespace v8 { | 11 namespace v8 { |
11 namespace internal { | 12 namespace internal { |
12 | 13 |
13 // Forward declarations. | 14 // Forward declarations. |
| 15 class CompilationDependencies; |
| 16 class Factory; |
14 class TypeCache; | 17 class TypeCache; |
15 | 18 |
16 namespace compiler { | 19 namespace compiler { |
17 | 20 |
18 // Forward declarations. | 21 // Forward declarations. |
19 class CommonOperatorBuilder; | 22 class CommonOperatorBuilder; |
20 struct FieldAccess; | 23 struct FieldAccess; |
21 class JSGraph; | 24 class JSGraph; |
22 class SimplifiedOperatorBuilder; | 25 class SimplifiedOperatorBuilder; |
23 | 26 |
24 | 27 |
25 class JSBuiltinReducer final : public AdvancedReducer { | 28 class JSBuiltinReducer final : public AdvancedReducer { |
26 public: | 29 public: |
27 explicit JSBuiltinReducer(Editor* editor, JSGraph* jsgraph); | 30 // Flags that control the mode of operation. |
| 31 enum Flag { |
| 32 kNoFlags = 0u, |
| 33 kDeoptimizationEnabled = 1u << 0, |
| 34 }; |
| 35 typedef base::Flags<Flag> Flags; |
| 36 |
| 37 JSBuiltinReducer(Editor* editor, JSGraph* jsgraph, Flags flags, |
| 38 CompilationDependencies* dependencies); |
28 ~JSBuiltinReducer() final {} | 39 ~JSBuiltinReducer() final {} |
29 | 40 |
30 Reduction Reduce(Node* node) final; | 41 Reduction Reduce(Node* node) final; |
31 | 42 |
32 private: | 43 private: |
| 44 Reduction ReduceArrayPop(Node* node); |
33 Reduction ReduceMathAbs(Node* node); | 45 Reduction ReduceMathAbs(Node* node); |
34 Reduction ReduceMathAcos(Node* node); | 46 Reduction ReduceMathAcos(Node* node); |
35 Reduction ReduceMathAcosh(Node* node); | 47 Reduction ReduceMathAcosh(Node* node); |
36 Reduction ReduceMathAsin(Node* node); | 48 Reduction ReduceMathAsin(Node* node); |
37 Reduction ReduceMathAsinh(Node* node); | 49 Reduction ReduceMathAsinh(Node* node); |
38 Reduction ReduceMathAtan(Node* node); | 50 Reduction ReduceMathAtan(Node* node); |
39 Reduction ReduceMathAtanh(Node* node); | 51 Reduction ReduceMathAtanh(Node* node); |
40 Reduction ReduceMathAtan2(Node* node); | 52 Reduction ReduceMathAtan2(Node* node); |
41 Reduction ReduceMathCbrt(Node* node); | 53 Reduction ReduceMathCbrt(Node* node); |
42 Reduction ReduceMathCeil(Node* node); | 54 Reduction ReduceMathCeil(Node* node); |
(...skipping 24 matching lines...) Expand all Loading... |
67 Reduction ReduceStringCharAt(Node* node); | 79 Reduction ReduceStringCharAt(Node* node); |
68 Reduction ReduceStringCharCodeAt(Node* node); | 80 Reduction ReduceStringCharCodeAt(Node* node); |
69 Reduction ReduceStringFromCharCode(Node* node); | 81 Reduction ReduceStringFromCharCode(Node* node); |
70 Reduction ReduceArrayBufferViewAccessor(Node* node, | 82 Reduction ReduceArrayBufferViewAccessor(Node* node, |
71 InstanceType instance_type, | 83 InstanceType instance_type, |
72 FieldAccess const& access); | 84 FieldAccess const& access); |
73 | 85 |
74 Node* ToNumber(Node* value); | 86 Node* ToNumber(Node* value); |
75 Node* ToUint32(Node* value); | 87 Node* ToUint32(Node* value); |
76 | 88 |
| 89 Flags flags() const { return flags_; } |
77 Graph* graph() const; | 90 Graph* graph() const; |
| 91 Factory* factory() const; |
78 JSGraph* jsgraph() const { return jsgraph_; } | 92 JSGraph* jsgraph() const { return jsgraph_; } |
79 Isolate* isolate() const; | 93 Isolate* isolate() const; |
80 CommonOperatorBuilder* common() const; | 94 CommonOperatorBuilder* common() const; |
81 SimplifiedOperatorBuilder* simplified() const; | 95 SimplifiedOperatorBuilder* simplified() const; |
| 96 CompilationDependencies* dependencies() const { return dependencies_; } |
82 | 97 |
| 98 CompilationDependencies* const dependencies_; |
| 99 Flags const flags_; |
83 JSGraph* const jsgraph_; | 100 JSGraph* const jsgraph_; |
84 TypeCache const& type_cache_; | 101 TypeCache const& type_cache_; |
85 }; | 102 }; |
86 | 103 |
| 104 DEFINE_OPERATORS_FOR_FLAGS(JSBuiltinReducer::Flags) |
| 105 |
87 } // namespace compiler | 106 } // namespace compiler |
88 } // namespace internal | 107 } // namespace internal |
89 } // namespace v8 | 108 } // namespace v8 |
90 | 109 |
91 #endif // V8_COMPILER_JS_BUILTIN_REDUCER_H_ | 110 #endif // V8_COMPILER_JS_BUILTIN_REDUCER_H_ |
OLD | NEW |