blob: cfacdc1e8c387a3c3493553faac04e27276da41c [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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 Murdochb8a8cc12014-11-26 15:28:44 +00009
10namespace v8 {
11namespace internal {
12namespace compiler {
13
Emily Bernierd0a1eb72015-03-24 16:35:39 -040014// Forward declarations.
15class CommonOperatorBuilder;
16class JSGraph;
17class MachineOperatorBuilder;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000018class SimplifiedOperatorBuilder;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040019
20
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000021class JSBuiltinReducer final : public AdvancedReducer {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000022 public:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000023 explicit JSBuiltinReducer(Editor* editor, JSGraph* jsgraph);
24 ~JSBuiltinReducer() final {}
Ben Murdochb8a8cc12014-11-26 15:28:44 +000025
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000026 Reduction Reduce(Node* node) final;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000027
28 private:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000029 Reduction ReduceFunctionCall(Node* node);
Ben Murdochb8a8cc12014-11-26 15:28:44 +000030 Reduction ReduceMathMax(Node* node);
31 Reduction ReduceMathImul(Node* node);
Emily Bernierd0a1eb72015-03-24 16:35:39 -040032 Reduction ReduceMathFround(Node* node);
Emily Bernierd0a1eb72015-03-24 16:35:39 -040033
Emily Bernierd0a1eb72015-03-24 16:35:39 -040034 Graph* graph() const;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000035 JSGraph* jsgraph() const { return jsgraph_; }
36 Isolate* isolate() const;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040037 CommonOperatorBuilder* common() const;
38 MachineOperatorBuilder* machine() const;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000039 SimplifiedOperatorBuilder* simplified() const;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000040
41 JSGraph* jsgraph_;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000042};
43
44} // namespace compiler
45} // namespace internal
46} // namespace v8
47
48#endif // V8_COMPILER_JS_BUILTIN_REDUCER_H_