| 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/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| 11 #include "src/compiler/simplified-operator.h" | 11 #include "src/compiler/simplified-operator.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 namespace compiler { | 15 namespace compiler { |
| 16 | 16 |
| 17 class SimplifiedLowering { | 17 class SimplifiedLowering { |
| 18 public: | 18 public: |
| 19 explicit SimplifiedLowering(JSGraph* jsgraph) | 19 explicit SimplifiedLowering(JSGraph* jsgraph) |
| 20 : jsgraph_(jsgraph), machine_(jsgraph->zone()) {} | 20 : jsgraph_(jsgraph), machine_(jsgraph->zone()) {} |
| 21 virtual ~SimplifiedLowering() {} | 21 virtual ~SimplifiedLowering() {} |
| 22 | 22 |
| 23 void LowerAllNodes(); | 23 void LowerAllNodes(); |
| 24 | 24 |
| 25 // TODO(titzer): These are exposed for direct testing. Use a friend class. | 25 // TODO(titzer): These are exposed for direct testing. Use a friend class. |
| 26 void DoLoadField(Node* node); | 26 void DoLoadField(Node* node); |
| 27 void DoStoreField(Node* node); | 27 void DoStoreField(Node* node); |
| 28 void DoLoadElement(Node* node); | 28 void DoLoadElement(Node* node); |
| 29 void DoStoreElement(Node* node); | 29 void DoStoreElement(Node* node); |
| 30 void DoStringAdd(Node* node); |
| 30 | 31 |
| 31 private: | 32 private: |
| 32 JSGraph* jsgraph_; | 33 JSGraph* jsgraph_; |
| 33 MachineOperatorBuilder machine_; | 34 MachineOperatorBuilder machine_; |
| 34 | 35 |
| 35 Node* SmiTag(Node* node); | 36 Node* SmiTag(Node* node); |
| 36 Node* IsTagged(Node* node); | 37 Node* IsTagged(Node* node); |
| 37 Node* Untag(Node* node); | 38 Node* Untag(Node* node); |
| 38 Node* OffsetMinusTagConstant(int32_t offset); | 39 Node* OffsetMinusTagConstant(int32_t offset); |
| 39 Node* ComputeIndex(const ElementAccess& access, Node* index); | 40 Node* ComputeIndex(const ElementAccess& access, Node* index); |
| 40 | 41 |
| 41 friend class RepresentationSelector; | 42 friend class RepresentationSelector; |
| 42 | 43 |
| 43 Zone* zone() { return jsgraph_->zone(); } | 44 Zone* zone() { return jsgraph_->zone(); } |
| 44 JSGraph* jsgraph() { return jsgraph_; } | 45 JSGraph* jsgraph() { return jsgraph_; } |
| 45 Graph* graph() { return jsgraph()->graph(); } | 46 Graph* graph() { return jsgraph()->graph(); } |
| 46 CommonOperatorBuilder* common() { return jsgraph()->common(); } | 47 CommonOperatorBuilder* common() { return jsgraph()->common(); } |
| 47 MachineOperatorBuilder* machine() { return &machine_; } | 48 MachineOperatorBuilder* machine() { return &machine_; } |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 } // namespace compiler | 51 } // namespace compiler |
| 51 } // namespace internal | 52 } // namespace internal |
| 52 } // namespace v8 | 53 } // namespace v8 |
| 53 | 54 |
| 54 #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ | 55 #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ |
| OLD | NEW |