Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef V8_COMPILER_JS_BUILTIN_REDUCER_H_ |
| 6 | #define V8_COMPILER_JS_BUILTIN_REDUCER_H_ |
| 7 | |
| 8 | #include "src/compiler/graph-reducer.h" |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 9 | |
| 10 | namespace v8 { |
| 11 | namespace internal { |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 12 | |
| 13 | // Forward declarations. |
| 14 | class TypeCache; |
| 15 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 16 | namespace compiler { |
| 17 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 18 | // Forward declarations. |
| 19 | class CommonOperatorBuilder; |
| 20 | class JSGraph; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 21 | class SimplifiedOperatorBuilder; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 22 | |
| 23 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 24 | class JSBuiltinReducer final : public AdvancedReducer { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 25 | public: |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 26 | explicit JSBuiltinReducer(Editor* editor, JSGraph* jsgraph); |
| 27 | ~JSBuiltinReducer() final {} |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 28 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 29 | Reduction Reduce(Node* node) final; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 30 | |
| 31 | private: |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 32 | Reduction ReduceMathAbs(Node* node); |
| 33 | Reduction ReduceMathAtan(Node* node); |
| 34 | Reduction ReduceMathAtan2(Node* node); |
| 35 | Reduction ReduceMathAtanh(Node* node); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 36 | Reduction ReduceMathCeil(Node* node); |
| 37 | Reduction ReduceMathClz32(Node* node); |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 38 | Reduction ReduceMathCos(Node* node); |
| 39 | Reduction ReduceMathExp(Node* node); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 40 | Reduction ReduceMathFloor(Node* node); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 41 | Reduction ReduceMathFround(Node* node); |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 42 | Reduction ReduceMathImul(Node* node); |
| 43 | Reduction ReduceMathLog(Node* node); |
| 44 | Reduction ReduceMathLog1p(Node* node); |
| 45 | Reduction ReduceMathLog10(Node* node); |
| 46 | Reduction ReduceMathLog2(Node* node); |
| 47 | Reduction ReduceMathMax(Node* node); |
| 48 | Reduction ReduceMathMin(Node* node); |
| 49 | Reduction ReduceMathCbrt(Node* node); |
| 50 | Reduction ReduceMathExpm1(Node* node); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 51 | Reduction ReduceMathRound(Node* node); |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 52 | Reduction ReduceMathSin(Node* node); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 53 | Reduction ReduceMathSqrt(Node* node); |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 54 | Reduction ReduceMathTan(Node* node); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 55 | Reduction ReduceMathTrunc(Node* node); |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 56 | Reduction ReduceStringFromCharCode(Node* node); |
| 57 | |
| 58 | Node* ToNumber(Node* value); |
| 59 | Node* ToUint32(Node* value); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 60 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 61 | Graph* graph() const; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 62 | JSGraph* jsgraph() const { return jsgraph_; } |
| 63 | Isolate* isolate() const; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 64 | CommonOperatorBuilder* common() const; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 65 | SimplifiedOperatorBuilder* simplified() const; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 66 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 67 | JSGraph* const jsgraph_; |
| 68 | TypeCache const& type_cache_; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | } // namespace compiler |
| 72 | } // namespace internal |
| 73 | } // namespace v8 |
| 74 | |
| 75 | #endif // V8_COMPILER_JS_BUILTIN_REDUCER_H_ |