deps: update v8 to 4.3.61.21
[platform/upstream/nodejs.git] / deps / v8 / src / compiler / simplified-operator-reducer.h
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_SIMPLIFIED_OPERATOR_REDUCER_H_
6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_
7
8 #include "src/compiler/graph-reducer.h"
9 #include "src/compiler/simplified-operator.h"
10
11 namespace v8 {
12 namespace internal {
13
14 // Forward declarations.
15 class Factory;
16 class Heap;
17
18 namespace compiler {
19
20 // Forward declarations.
21 class JSGraph;
22 class MachineOperatorBuilder;
23
24 class SimplifiedOperatorReducer FINAL : public Reducer {
25  public:
26   explicit SimplifiedOperatorReducer(JSGraph* jsgraph);
27   ~SimplifiedOperatorReducer() FINAL;
28
29   Reduction Reduce(Node* node) FINAL;
30
31  private:
32   Reduction Change(Node* node, const Operator* op, Node* a);
33   Reduction ReplaceFloat64(double value);
34   Reduction ReplaceInt32(int32_t value);
35   Reduction ReplaceUint32(uint32_t value) {
36     return ReplaceInt32(bit_cast<int32_t>(value));
37   }
38   Reduction ReplaceNumber(double value);
39   Reduction ReplaceNumber(int32_t value);
40
41   Graph* graph() const;
42   Factory* factory() const;
43   JSGraph* jsgraph() const { return jsgraph_; }
44   MachineOperatorBuilder* machine() const;
45   SimplifiedOperatorBuilder* simplified() { return &simplified_; }
46
47   JSGraph* jsgraph_;
48   SimplifiedOperatorBuilder simplified_;
49
50   DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorReducer);
51 };
52
53 }  // namespace compiler
54 }  // namespace internal
55 }  // namespace v8
56
57 #endif  // V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_