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 #include "src/compiler/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
7 #include "src/compiler/instruction.h" | 7 #include "src/compiler/instruction.h" |
8 #include "src/compiler/schedule.h" | 8 #include "src/compiler/schedule.h" |
9 #include "src/compiler/state-values-utils.h" | 9 #include "src/compiler/state-values-utils.h" |
10 | 10 |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 506 |
507 Constant::Constant(RelocatablePtrConstantInfo info) | 507 Constant::Constant(RelocatablePtrConstantInfo info) |
508 #ifdef V8_HOST_ARCH_32_BIT | 508 #ifdef V8_HOST_ARCH_32_BIT |
509 : type_(kInt32), value_(info.value()), rmode_(info.rmode()) { | 509 : type_(kInt32), value_(info.value()), rmode_(info.rmode()) { |
510 } | 510 } |
511 #else | 511 #else |
512 : type_(kInt64), value_(info.value()), rmode_(info.rmode()) { | 512 : type_(kInt64), value_(info.value()), rmode_(info.rmode()) { |
513 } | 513 } |
514 #endif | 514 #endif |
515 | 515 |
| 516 Handle<HeapObject> Constant::ToHeapObject() const { |
| 517 DCHECK_EQ(kHeapObject, type()); |
| 518 Handle<HeapObject> value( |
| 519 bit_cast<HeapObject**>(static_cast<intptr_t>(value_))); |
| 520 if (value->IsConsString()) { |
| 521 value = String::Flatten(Handle<String>::cast(value), TENURED); |
| 522 } |
| 523 return value; |
| 524 } |
| 525 |
516 std::ostream& operator<<(std::ostream& os, const Constant& constant) { | 526 std::ostream& operator<<(std::ostream& os, const Constant& constant) { |
517 switch (constant.type()) { | 527 switch (constant.type()) { |
518 case Constant::kInt32: | 528 case Constant::kInt32: |
519 return os << constant.ToInt32(); | 529 return os << constant.ToInt32(); |
520 case Constant::kInt64: | 530 case Constant::kInt64: |
521 return os << constant.ToInt64() << "l"; | 531 return os << constant.ToInt64() << "l"; |
522 case Constant::kFloat32: | 532 case Constant::kFloat32: |
523 return os << constant.ToFloat32() << "f"; | 533 return os << constant.ToFloat32() << "f"; |
524 case Constant::kFloat64: | 534 case Constant::kFloat64: |
525 return os << constant.ToFloat64(); | 535 return os << constant.ToFloat64(); |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 } | 1023 } |
1014 for (int i = 0; i < code.InstructionBlockCount(); i++) { | 1024 for (int i = 0; i < code.InstructionBlockCount(); i++) { |
1015 printable.sequence_->PrintBlock(printable.register_configuration_, i); | 1025 printable.sequence_->PrintBlock(printable.register_configuration_, i); |
1016 } | 1026 } |
1017 return os; | 1027 return os; |
1018 } | 1028 } |
1019 | 1029 |
1020 } // namespace compiler | 1030 } // namespace compiler |
1021 } // namespace internal | 1031 } // namespace internal |
1022 } // namespace v8 | 1032 } // namespace v8 |
OLD | NEW |