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 | |
526 std::ostream& operator<<(std::ostream& os, const Constant& constant) { | 516 std::ostream& operator<<(std::ostream& os, const Constant& constant) { |
527 switch (constant.type()) { | 517 switch (constant.type()) { |
528 case Constant::kInt32: | 518 case Constant::kInt32: |
529 return os << constant.ToInt32(); | 519 return os << constant.ToInt32(); |
530 case Constant::kInt64: | 520 case Constant::kInt64: |
531 return os << constant.ToInt64() << "l"; | 521 return os << constant.ToInt64() << "l"; |
532 case Constant::kFloat32: | 522 case Constant::kFloat32: |
533 return os << constant.ToFloat32() << "f"; | 523 return os << constant.ToFloat32() << "f"; |
534 case Constant::kFloat64: | 524 case Constant::kFloat64: |
535 return os << constant.ToFloat64(); | 525 return os << constant.ToFloat64(); |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 } | 1013 } |
1024 for (int i = 0; i < code.InstructionBlockCount(); i++) { | 1014 for (int i = 0; i < code.InstructionBlockCount(); i++) { |
1025 printable.sequence_->PrintBlock(printable.register_configuration_, i); | 1015 printable.sequence_->PrintBlock(printable.register_configuration_, i); |
1026 } | 1016 } |
1027 return os; | 1017 return os; |
1028 } | 1018 } |
1029 | 1019 |
1030 } // namespace compiler | 1020 } // namespace compiler |
1031 } // namespace internal | 1021 } // namespace internal |
1032 } // namespace v8 | 1022 } // namespace v8 |
OLD | NEW |