V8 Project
js-typed-lowering.h
Go to the documentation of this file.
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_TYPED_LOWERING_H_
6 #define V8_COMPILER_JS_TYPED_LOWERING_H_
7 
11 #include "src/compiler/node.h"
13 
14 namespace v8 {
15 namespace internal {
16 namespace compiler {
17 
18 // Lowers JS-level operators to simplified operators based on types.
19 class JSTypedLowering FINAL : public Reducer {
20  public:
21  explicit JSTypedLowering(JSGraph* jsgraph)
22  : jsgraph_(jsgraph), simplified_(jsgraph->zone()) {}
23  virtual ~JSTypedLowering();
24 
25  virtual Reduction Reduce(Node* node) OVERRIDE;
26 
27  JSGraph* jsgraph() { return jsgraph_; }
28  Graph* graph() { return jsgraph_->graph(); }
29  Zone* zone() { return jsgraph_->zone(); }
30 
31  private:
32  friend class JSBinopReduction;
33 
34  Reduction ReplaceEagerly(Node* old, Node* node);
35  Reduction ReplaceWith(Node* node) { return Reducer::Replace(node); }
36  Reduction ReduceJSAdd(Node* node);
37  Reduction ReduceJSComparison(Node* node);
38  Reduction ReduceJSLoadProperty(Node* node);
39  Reduction ReduceJSStoreProperty(Node* node);
40  Reduction ReduceJSEqual(Node* node, bool invert);
41  Reduction ReduceJSStrictEqual(Node* node, bool invert);
42  Reduction ReduceJSToNumberInput(Node* input);
43  Reduction ReduceJSToStringInput(Node* input);
44  Reduction ReduceJSToBooleanInput(Node* input);
45  Reduction ReduceNumberBinop(Node* node, const Operator* numberOp);
46  Reduction ReduceI32Binop(Node* node, bool left_signed, bool right_signed,
47  const Operator* intOp);
48  Reduction ReduceI32Shift(Node* node, bool left_signed,
49  const Operator* shift_op);
50 
51  JSOperatorBuilder* javascript() { return jsgraph_->javascript(); }
52  CommonOperatorBuilder* common() { return jsgraph_->common(); }
53  SimplifiedOperatorBuilder* simplified() { return &simplified_; }
54  MachineOperatorBuilder* machine() { return jsgraph_->machine(); }
55 
56  JSGraph* jsgraph_;
57  SimplifiedOperatorBuilder simplified_;
58 };
59 
60 } // namespace compiler
61 } // namespace internal
62 } // namespace v8
63 
64 #endif // V8_COMPILER_JS_TYPED_LOWERING_H_
Reduction ReduceJSAdd(Node *node)
Reduction ReduceI32Shift(Node *node, bool left_signed, const Operator *shift_op)
SimplifiedOperatorBuilder * simplified()
Reduction ReduceJSToStringInput(Node *input)
Reduction ReduceNumberBinop(Node *node, const Operator *numberOp)
CommonOperatorBuilder * common()
Reduction ReplaceEagerly(Node *old, Node *node)
Reduction ReduceJSToNumberInput(Node *input)
Reduction ReplaceWith(Node *node)
Reduction ReduceJSStoreProperty(Node *node)
Reduction ReduceJSEqual(Node *node, bool invert)
Reduction ReduceJSComparison(Node *node)
Reduction ReduceJSStrictEqual(Node *node, bool invert)
Reduction ReduceJSToBooleanInput(Node *input)
virtual Reduction Reduce(Node *node) OVERRIDE
JSOperatorBuilder * javascript()
MachineOperatorBuilder * machine()
Reduction ReduceI32Binop(Node *node, bool left_signed, bool right_signed, const Operator *intOp)
Reduction ReduceJSLoadProperty(Node *node)
static Reduction Replace(Node *node)
Definition: graph-reducer.h:47
#define OVERRIDE
#define FINAL
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20