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/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 Node* GetBitRepresentationFor(Node* node, RepTypeUnion output_type) { | 214 Node* GetBitRepresentationFor(Node* node, RepTypeUnion output_type) { |
215 // Eagerly fold representation changes for constants. | 215 // Eagerly fold representation changes for constants. |
216 switch (node->opcode()) { | 216 switch (node->opcode()) { |
217 case IrOpcode::kInt32Constant: { | 217 case IrOpcode::kInt32Constant: { |
218 int32_t value = ValueOf<int32_t>(node->op()); | 218 int32_t value = ValueOf<int32_t>(node->op()); |
219 if (value == 0 || value == 1) return node; | 219 if (value == 0 || value == 1) return node; |
220 return jsgraph()->OneConstant(); // value != 0 | 220 return jsgraph()->OneConstant(); // value != 0 |
221 } | 221 } |
222 case IrOpcode::kHeapConstant: { | 222 case IrOpcode::kHeapConstant: { |
223 Handle<Object> handle = ValueOf<Handle<Object> >(node->op()); | 223 Handle<Object> handle = ValueOf<Handle<Object> >(node->op()); |
224 ASSERT(*handle == isolate()->heap()->true_value() || | 224 DCHECK(*handle == isolate()->heap()->true_value() || |
225 *handle == isolate()->heap()->false_value()); | 225 *handle == isolate()->heap()->false_value()); |
226 return jsgraph()->Int32Constant( | 226 return jsgraph()->Int32Constant( |
227 *handle == isolate()->heap()->true_value() ? 1 : 0); | 227 *handle == isolate()->heap()->true_value() ? 1 : 0); |
228 } | 228 } |
229 default: | 229 default: |
230 break; | 230 break; |
231 } | 231 } |
232 // Select the correct X -> Bit operator. | 232 // Select the correct X -> Bit operator. |
233 Operator* op; | 233 Operator* op; |
234 if (output_type & rWord32) { | 234 if (output_type & rWord32) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 JSGraph* jsgraph() { return jsgraph_; } | 372 JSGraph* jsgraph() { return jsgraph_; } |
373 Isolate* isolate() { return isolate_; } | 373 Isolate* isolate() { return isolate_; } |
374 SimplifiedOperatorBuilder* simplified() { return simplified_; } | 374 SimplifiedOperatorBuilder* simplified() { return simplified_; } |
375 MachineOperatorBuilder* machine() { return machine_; } | 375 MachineOperatorBuilder* machine() { return machine_; } |
376 }; | 376 }; |
377 } | 377 } |
378 } | 378 } |
379 } // namespace v8::internal::compiler | 379 } // namespace v8::internal::compiler |
380 | 380 |
381 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ | 381 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ |
OLD | NEW |