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> |
| 9 |
8 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
9 #include "src/compiler/js-graph.h" | 11 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/machine-operator.h" | 12 #include "src/compiler/machine-operator.h" |
11 #include "src/compiler/node-properties-inl.h" | 13 #include "src/compiler/node-properties-inl.h" |
12 #include "src/compiler/simplified-operator.h" | 14 #include "src/compiler/simplified-operator.h" |
13 | 15 |
14 namespace v8 { | 16 namespace v8 { |
15 namespace internal { | 17 namespace internal { |
16 namespace compiler { | 18 namespace compiler { |
17 | 19 |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 394 |
393 friend class RepresentationChangerTester; // accesses the below fields. | 395 friend class RepresentationChangerTester; // accesses the below fields. |
394 | 396 |
395 bool testing_type_errors_; // If {true}, don't abort on a type error. | 397 bool testing_type_errors_; // If {true}, don't abort on a type error. |
396 bool type_error_; // Set when a type error is detected. | 398 bool type_error_; // Set when a type error is detected. |
397 | 399 |
398 Node* TypeError(Node* node, MachineTypeUnion output_type, | 400 Node* TypeError(Node* node, MachineTypeUnion output_type, |
399 MachineTypeUnion use) { | 401 MachineTypeUnion use) { |
400 type_error_ = true; | 402 type_error_ = true; |
401 if (!testing_type_errors_) { | 403 if (!testing_type_errors_) { |
402 OStringStream out_str; | 404 std::ostringstream out_str; |
403 out_str << static_cast<MachineType>(output_type); | 405 out_str << static_cast<MachineType>(output_type); |
404 | 406 |
405 OStringStream use_str; | 407 std::ostringstream use_str; |
406 use_str << static_cast<MachineType>(use); | 408 use_str << static_cast<MachineType>(use); |
407 | 409 |
408 V8_Fatal(__FILE__, __LINE__, | 410 V8_Fatal(__FILE__, __LINE__, |
409 "RepresentationChangerError: node #%d:%s of " | 411 "RepresentationChangerError: node #%d:%s of " |
410 "%s cannot be changed to %s", | 412 "%s cannot be changed to %s", |
411 node->id(), node->op()->mnemonic(), out_str.c_str(), | 413 node->id(), node->op()->mnemonic(), out_str.str().c_str(), |
412 use_str.c_str()); | 414 use_str.str().c_str()); |
413 } | 415 } |
414 return node; | 416 return node; |
415 } | 417 } |
416 | 418 |
417 Node* InsertChangeFloat32ToFloat64(Node* node) { | 419 Node* InsertChangeFloat32ToFloat64(Node* node) { |
418 return jsgraph()->graph()->NewNode(machine()->ChangeFloat32ToFloat64(), | 420 return jsgraph()->graph()->NewNode(machine()->ChangeFloat32ToFloat64(), |
419 node); | 421 node); |
420 } | 422 } |
421 | 423 |
422 JSGraph* jsgraph() { return jsgraph_; } | 424 JSGraph* jsgraph() { return jsgraph_; } |
423 Isolate* isolate() { return isolate_; } | 425 Isolate* isolate() { return isolate_; } |
424 SimplifiedOperatorBuilder* simplified() { return simplified_; } | 426 SimplifiedOperatorBuilder* simplified() { return simplified_; } |
425 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } | 427 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } |
426 }; | 428 }; |
427 | 429 |
428 } // namespace compiler | 430 } // namespace compiler |
429 } // namespace internal | 431 } // namespace internal |
430 } // namespace v8 | 432 } // namespace v8 |
431 | 433 |
432 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ | 434 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ |
OLD | NEW |