blob: b64b33565de5c5f7455d441d849575cf9d202ff3 [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 {
Ben Murdoch097c5b22016-05-18 11:27:45 +010012
13// Forward declarations.
14class TypeCache;
15
Ben Murdochb8a8cc12014-11-26 15:28:44 +000016namespace compiler {
17
Emily Bernierd0a1eb72015-03-24 16:35:39 -040018// Forward declarations.
19class CommonOperatorBuilder;
20class JSGraph;
21class MachineOperatorBuilder;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000022class SimplifiedOperatorBuilder;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040023
24
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000025class JSBuiltinReducer final : public AdvancedReducer {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000026 public:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000027 explicit JSBuiltinReducer(Editor* editor, JSGraph* jsgraph);
28 ~JSBuiltinReducer() final {}
Ben Murdochb8a8cc12014-11-26 15:28:44 +000029
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000030 Reduction Reduce(Node* node) final;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000031
32 private:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000033 Reduction ReduceFunctionCall(Node* node);
Ben Murdochb8a8cc12014-11-26 15:28:44 +000034 Reduction ReduceMathMax(Node* node);
35 Reduction ReduceMathImul(Node* node);
Emily Bernierd0a1eb72015-03-24 16:35:39 -040036 Reduction ReduceMathFround(Node* node);
Ben Murdoch097c5b22016-05-18 11:27:45 +010037 Reduction ReduceMathRound(Node* node);
Emily Bernierd0a1eb72015-03-24 16:35:39 -040038
Emily Bernierd0a1eb72015-03-24 16:35:39 -040039 Graph* graph() const;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000040 JSGraph* jsgraph() const { return jsgraph_; }
41 Isolate* isolate() const;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040042 CommonOperatorBuilder* common() const;
43 MachineOperatorBuilder* machine() const;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000044 SimplifiedOperatorBuilder* simplified() const;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000045
Ben Murdoch097c5b22016-05-18 11:27:45 +010046 JSGraph* const jsgraph_;
47 TypeCache const& type_cache_;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000048};
49
50} // namespace compiler
51} // namespace internal
52} // namespace v8
53
54#endif // V8_COMPILER_JS_BUILTIN_REDUCER_H_