| 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_REPRESENTATION_CHANGE_H_ | 5 #ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_ |
| 6 #define V8_COMPILER_REPRESENTATION_CHANGE_H_ | 6 #define V8_COMPILER_REPRESENTATION_CHANGE_H_ |
| 7 | 7 |
| 8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 RepresentationChanger(JSGraph* jsgraph, Isolate* isolate) | 79 RepresentationChanger(JSGraph* jsgraph, Isolate* isolate) |
| 80 : jsgraph_(jsgraph), | 80 : jsgraph_(jsgraph), |
| 81 isolate_(isolate), | 81 isolate_(isolate), |
| 82 testing_type_errors_(false), | 82 testing_type_errors_(false), |
| 83 type_error_(false) {} | 83 type_error_(false) {} |
| 84 | 84 |
| 85 // Changes representation from {output_type} to {use_rep}. The {truncation} | 85 // Changes representation from {output_type} to {use_rep}. The {truncation} |
| 86 // parameter is only used for sanity checking - if the changer cannot figure | 86 // parameter is only used for sanity checking - if the changer cannot figure |
| 87 // out signedness for the word32->float64 conversion, then we check that the | 87 // out signedness for the word32->float64 conversion, then we check that the |
| 88 // uses truncate to word32 (so they do not care about signedness). | 88 // uses truncate to word32 (so they do not care about signedness). |
| 89 Node* GetRepresentationFor(Node* node, MachineType output_type, | 89 Node* GetRepresentationFor(Node* node, MachineRepresentation output_rep, |
| 90 MachineRepresentation use_rep, | 90 Type* output_type, MachineRepresentation use_rep, |
| 91 Truncation truncation = Truncation::None()); | 91 Truncation truncation = Truncation::None()); |
| 92 const Operator* Int32OperatorFor(IrOpcode::Value opcode); | 92 const Operator* Int32OperatorFor(IrOpcode::Value opcode); |
| 93 const Operator* Uint32OperatorFor(IrOpcode::Value opcode); | 93 const Operator* Uint32OperatorFor(IrOpcode::Value opcode); |
| 94 const Operator* Float64OperatorFor(IrOpcode::Value opcode); | 94 const Operator* Float64OperatorFor(IrOpcode::Value opcode); |
| 95 MachineSemantic TypeFromUpperBound(Type* type); | |
| 96 | 95 |
| 97 MachineType TypeForBasePointer(const FieldAccess& access) { | 96 MachineType TypeForBasePointer(const FieldAccess& access) { |
| 98 return access.tag() != 0 ? MachineType::AnyTagged() | 97 return access.tag() != 0 ? MachineType::AnyTagged() |
| 99 : MachineType::Pointer(); | 98 : MachineType::Pointer(); |
| 100 } | 99 } |
| 101 | 100 |
| 102 MachineType TypeForBasePointer(const ElementAccess& access) { | 101 MachineType TypeForBasePointer(const ElementAccess& access) { |
| 103 return access.tag() != 0 ? MachineType::AnyTagged() | 102 return access.tag() != 0 ? MachineType::AnyTagged() |
| 104 : MachineType::Pointer(); | 103 : MachineType::Pointer(); |
| 105 } | 104 } |
| 106 | 105 |
| 107 private: | 106 private: |
| 108 JSGraph* jsgraph_; | 107 JSGraph* jsgraph_; |
| 109 Isolate* isolate_; | 108 Isolate* isolate_; |
| 110 | 109 |
| 111 friend class RepresentationChangerTester; // accesses the below fields. | 110 friend class RepresentationChangerTester; // accesses the below fields. |
| 112 | 111 |
| 113 bool testing_type_errors_; // If {true}, don't abort on a type error. | 112 bool testing_type_errors_; // If {true}, don't abort on a type error. |
| 114 bool type_error_; // Set when a type error is detected. | 113 bool type_error_; // Set when a type error is detected. |
| 115 | 114 |
| 116 Node* GetTaggedRepresentationFor(Node* node, MachineType output_type); | 115 Node* GetTaggedRepresentationFor(Node* node, MachineRepresentation output_rep, |
| 117 Node* GetFloat32RepresentationFor(Node* node, MachineType output_type, | 116 Type* output_type); |
| 118 Truncation truncation); | 117 Node* GetFloat32RepresentationFor(Node* node, |
| 119 Node* GetFloat64RepresentationFor(Node* node, MachineType output_type, | 118 MachineRepresentation output_rep, |
| 120 Truncation truncation); | 119 Type* output_type, Truncation truncation); |
| 121 Node* GetWord32RepresentationFor(Node* node, MachineType output_type); | 120 Node* GetFloat64RepresentationFor(Node* node, |
| 122 Node* GetBitRepresentationFor(Node* node, MachineType output_type); | 121 MachineRepresentation output_rep, |
| 123 Node* GetWord64RepresentationFor(Node* node, MachineType output_type); | 122 Type* output_type, Truncation truncation); |
| 124 Node* TypeError(Node* node, MachineType output_type, | 123 Node* GetWord32RepresentationFor(Node* node, MachineRepresentation output_rep, |
| 125 MachineRepresentation use); | 124 Type* output_type); |
| 125 Node* GetBitRepresentationFor(Node* node, MachineRepresentation output_rep, |
| 126 Type* output_type); |
| 127 Node* GetWord64RepresentationFor(Node* node, MachineRepresentation output_rep, |
| 128 Type* output_type); |
| 129 Node* TypeError(Node* node, MachineRepresentation output_rep, |
| 130 Type* output_type, MachineRepresentation use); |
| 126 Node* MakeTruncatedInt32Constant(double value); | 131 Node* MakeTruncatedInt32Constant(double value); |
| 127 Node* InsertChangeFloat32ToFloat64(Node* node); | 132 Node* InsertChangeFloat32ToFloat64(Node* node); |
| 128 Node* InsertChangeTaggedToFloat64(Node* node); | 133 Node* InsertChangeTaggedToFloat64(Node* node); |
| 129 | 134 |
| 130 JSGraph* jsgraph() const { return jsgraph_; } | 135 JSGraph* jsgraph() const { return jsgraph_; } |
| 131 Isolate* isolate() const { return isolate_; } | 136 Isolate* isolate() const { return isolate_; } |
| 132 Factory* factory() const { return isolate()->factory(); } | 137 Factory* factory() const { return isolate()->factory(); } |
| 133 SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); } | 138 SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); } |
| 134 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } | 139 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } |
| 135 }; | 140 }; |
| 136 | 141 |
| 137 } // namespace compiler | 142 } // namespace compiler |
| 138 } // namespace internal | 143 } // namespace internal |
| 139 } // namespace v8 | 144 } // namespace v8 |
| 140 | 145 |
| 141 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ | 146 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ |
| OLD | NEW |