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 <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 287 } |
288 return jsgraph()->graph()->NewNode(op, node); | 288 return jsgraph()->graph()->NewNode(op, node); |
289 } | 289 } |
290 | 290 |
291 Node* GetBitRepresentationFor(Node* node, MachineTypeUnion output_type) { | 291 Node* GetBitRepresentationFor(Node* node, MachineTypeUnion output_type) { |
292 // Eagerly fold representation changes for constants. | 292 // Eagerly fold representation changes for constants. |
293 switch (node->opcode()) { | 293 switch (node->opcode()) { |
294 case IrOpcode::kInt32Constant: { | 294 case IrOpcode::kInt32Constant: { |
295 int32_t value = OpParameter<int32_t>(node); | 295 int32_t value = OpParameter<int32_t>(node); |
296 if (value == 0 || value == 1) return node; | 296 if (value == 0 || value == 1) return node; |
297 return jsgraph()->OneConstant(); // value != 0 | 297 return jsgraph()->Int32Constant(1); // value != 0 |
298 } | 298 } |
299 case IrOpcode::kHeapConstant: { | 299 case IrOpcode::kHeapConstant: { |
300 Handle<Object> handle = OpParameter<Unique<Object> >(node).handle(); | 300 Handle<Object> handle = OpParameter<Unique<Object> >(node).handle(); |
301 DCHECK(*handle == isolate()->heap()->true_value() || | 301 DCHECK(*handle == isolate()->heap()->true_value() || |
302 *handle == isolate()->heap()->false_value()); | 302 *handle == isolate()->heap()->false_value()); |
303 return jsgraph()->Int32Constant( | 303 return jsgraph()->Int32Constant( |
304 *handle == isolate()->heap()->true_value() ? 1 : 0); | 304 *handle == isolate()->heap()->true_value() ? 1 : 0); |
305 } | 305 } |
306 default: | 306 default: |
307 break; | 307 break; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 Isolate* isolate() { return isolate_; } | 461 Isolate* isolate() { return isolate_; } |
462 SimplifiedOperatorBuilder* simplified() { return simplified_; } | 462 SimplifiedOperatorBuilder* simplified() { return simplified_; } |
463 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } | 463 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } |
464 }; | 464 }; |
465 | 465 |
466 } // namespace compiler | 466 } // namespace compiler |
467 } // namespace internal | 467 } // namespace internal |
468 } // namespace v8 | 468 } // namespace v8 |
469 | 469 |
470 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ | 470 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ |
OLD | NEW |