Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_COMPILER_SIMPLIFIED_LOWERING_H_ | 5 #ifndef V8_COMPILER_SIMPLIFIED_LOWERING_H_ |
| 6 #define V8_COMPILER_SIMPLIFIED_LOWERING_H_ | 6 #define V8_COMPILER_SIMPLIFIED_LOWERING_H_ |
| 7 | 7 |
| 8 #include "src/compiler/graph-reducer.h" | 8 #include "src/compiler/graph-reducer.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/lowering-builder.h" | 10 #include "src/compiler/lowering-builder.h" |
| 11 #include "src/compiler/machine-operator.h" | 11 #include "src/compiler/machine-operator.h" |
| 12 #include "src/compiler/node.h" | 12 #include "src/compiler/node.h" |
| 13 #include "src/compiler/simplified-operator.h" | 13 #include "src/compiler/simplified-operator.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 namespace compiler { | 17 namespace compiler { |
| 18 | 18 |
| 19 class SimplifiedLowering : public LoweringBuilder { | 19 class SimplifiedLowering : public LoweringBuilder { |
|
Benedikt Meurer
2014/08/01 04:35:44
Why don't we turn this into a Reducer?
| |
| 20 public: | 20 public: |
| 21 explicit SimplifiedLowering(JSGraph* jsgraph, | 21 explicit SimplifiedLowering(JSGraph* jsgraph, |
| 22 SourcePositionTable* source_positions) | 22 SourcePositionTable* source_positions) |
| 23 : LoweringBuilder(jsgraph->graph(), source_positions), | 23 : LoweringBuilder(jsgraph->graph(), source_positions), |
| 24 jsgraph_(jsgraph), | 24 jsgraph_(jsgraph), |
| 25 machine_(jsgraph->zone()) {} | 25 machine_(jsgraph->zone()) {} |
| 26 virtual ~SimplifiedLowering() {} | 26 virtual ~SimplifiedLowering() {} |
| 27 | 27 |
| 28 virtual void Lower(Node* node); | 28 virtual void Lower(Node* node); |
| 29 | 29 |
| 30 // TODO(titzer): These are exposed for direct testing. Use a friend class. | |
| 31 void DoChangeTaggedToUI32(Node* node, Node* effect, Node* control, | |
| 32 bool is_signed); | |
| 33 void DoChangeUI32ToTagged(Node* node, Node* effect, Node* control, | |
| 34 bool is_signed); | |
| 35 void DoChangeTaggedToFloat64(Node* node, Node* effect, Node* control); | |
| 36 void DoChangeFloat64ToTagged(Node* node, Node* effect, Node* control); | |
| 37 void DoChangeBoolToBit(Node* node, Node* effect, Node* control); | |
| 38 void DoChangeBitToBool(Node* node, Node* effect, Node* control); | |
| 39 void DoLoadField(Node* node, Node* effect, Node* control); | |
| 40 void DoStoreField(Node* node, Node* effect, Node* control); | |
| 41 void DoLoadElement(Node* node, Node* effect, Node* control); | |
| 42 void DoStoreElement(Node* node, Node* effect, Node* control); | |
| 43 | |
| 30 private: | 44 private: |
| 31 JSGraph* jsgraph_; | 45 JSGraph* jsgraph_; |
| 32 MachineOperatorBuilder machine_; | 46 MachineOperatorBuilder machine_; |
| 33 | 47 |
| 34 Node* DoChangeTaggedToInt32(Node* node, Node* effect, Node* control); | 48 Node* SmiTag(Node* node); |
| 35 Node* DoChangeTaggedToUint32(Node* node, Node* effect, Node* control); | 49 Node* IsTagged(Node* node); |
| 36 Node* DoChangeTaggedToFloat64(Node* node, Node* effect, Node* control); | 50 Node* Untag(Node* node); |
| 37 Node* DoChangeInt32ToTagged(Node* node, Node* effect, Node* control); | 51 Node* OffsetMinusTagConstant(int32_t offset); |
| 38 Node* DoChangeUint32ToTagged(Node* node, Node* effect, Node* control); | |
| 39 Node* DoChangeFloat64ToTagged(Node* node, Node* effect, Node* control); | |
| 40 Node* DoChangeBoolToBit(Node* node, Node* effect, Node* control); | |
| 41 Node* DoChangeBitToBool(Node* node, Node* effect, Node* control); | |
| 42 Node* DoLoadField(Node* node, Node* effect, Node* control); | |
| 43 Node* DoStoreField(Node* node, Node* effect, Node* control); | |
| 44 Node* DoLoadElement(Node* node, Node* effect, Node* control); | |
| 45 Node* DoStoreElement(Node* node, Node* effect, Node* control); | |
| 46 | 52 |
| 47 Node* ComputeIndex(const ElementAccess& access, Node* index); | 53 Node* ComputeIndex(const ElementAccess& access, Node* index); |
| 48 | 54 |
| 49 Zone* zone() { return jsgraph_->zone(); } | 55 Zone* zone() { return jsgraph_->zone(); } |
| 50 JSGraph* jsgraph() { return jsgraph_; } | 56 JSGraph* jsgraph() { return jsgraph_; } |
| 51 Graph* graph() { return jsgraph()->graph(); } | 57 Graph* graph() { return jsgraph()->graph(); } |
| 52 CommonOperatorBuilder* common() { return jsgraph()->common(); } | 58 CommonOperatorBuilder* common() { return jsgraph()->common(); } |
| 53 MachineOperatorBuilder* machine() { return &machine_; } | 59 MachineOperatorBuilder* machine() { return &machine_; } |
| 54 }; | 60 }; |
| 55 | 61 |
| 56 } // namespace compiler | 62 } // namespace compiler |
| 57 } // namespace internal | 63 } // namespace internal |
| 58 } // namespace v8 | 64 } // namespace v8 |
| 59 | 65 |
| 60 #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ | 66 #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ |
| OLD | NEW |