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_LOWERING_H_ 6#define V8_COMPILER_SIMPLIFIED_LOWERING_H_ 7 8#include "src/compiler/js-graph.h" 9#include "src/compiler/machine-operator.h" 10#include "src/compiler/node.h" 11#include "src/compiler/simplified-operator.h" 12 13namespace v8 { 14namespace internal { 15 16// Forward declarations. 17class TypeCache; 18 19 20namespace compiler { 21 22// Forward declarations. 23class RepresentationChanger; 24class SourcePositionTable; 25 26class SimplifiedLowering final { 27 public: 28 SimplifiedLowering(JSGraph* jsgraph, Zone* zone, 29 SourcePositionTable* source_positions); 30 ~SimplifiedLowering() {} 31 32 void LowerAllNodes(); 33 34 // TODO(turbofan): The representation can be removed once the result of the 35 // representation analysis is stored in the node bounds. 36 void DoLoadBuffer(Node* node, MachineRepresentation rep, 37 RepresentationChanger* changer); 38 void DoStoreBuffer(Node* node); 39 void DoObjectIsNumber(Node* node); 40 void DoObjectIsSmi(Node* node); 41 void DoShift(Node* node, Operator const* op, Type* rhs_type); 42 void DoStringEqual(Node* node); 43 void DoStringLessThan(Node* node); 44 void DoStringLessThanOrEqual(Node* node); 45 46 private: 47 JSGraph* const jsgraph_; 48 Zone* const zone_; 49 TypeCache const& type_cache_; 50 51 // TODO(danno): SimplifiedLowering shouldn't know anything about the source 52 // positions table, but must for now since there currently is no other way to 53 // pass down source position information to nodes created during 54 // lowering. Once this phase becomes a vanilla reducer, it should get source 55 // position information via the SourcePositionWrapper like all other reducers. 56 SourcePositionTable* source_positions_; 57 58 Node* StringComparison(Node* node); 59 Node* Int32Div(Node* const node); 60 Node* Int32Mod(Node* const node); 61 Node* Uint32Div(Node* const node); 62 Node* Uint32Mod(Node* const node); 63 64 friend class RepresentationSelector; 65 66 Isolate* isolate() { return jsgraph_->isolate(); } 67 Zone* zone() { return jsgraph_->zone(); } 68 JSGraph* jsgraph() { return jsgraph_; } 69 Graph* graph() { return jsgraph()->graph(); } 70 CommonOperatorBuilder* common() { return jsgraph()->common(); } 71 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } 72}; 73 74} // namespace compiler 75} // namespace internal 76} // namespace v8 77 78#endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ 79