Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: src/assembler.cc

Issue 363323003: More OStreamsUse OStreams more often. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased and polished. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/assembler.h ('k') | src/ast.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 case RelocInfo::CODE_AGE_SEQUENCE: 806 case RelocInfo::CODE_AGE_SEQUENCE:
807 return "code_age_sequence"; 807 return "code_age_sequence";
808 case RelocInfo::NUMBER_OF_MODES: 808 case RelocInfo::NUMBER_OF_MODES:
809 UNREACHABLE(); 809 UNREACHABLE();
810 return "number_of_modes"; 810 return "number_of_modes";
811 } 811 }
812 return "unknown relocation type"; 812 return "unknown relocation type";
813 } 813 }
814 814
815 815
816 void RelocInfo::Print(Isolate* isolate, FILE* out) { 816 void RelocInfo::Print(Isolate* isolate, OStream& os) { // NOLINT
817 PrintF(out, "%p %s", pc_, RelocModeName(rmode_)); 817 os << pc_ << " " << RelocModeName(rmode_);
818 if (IsComment(rmode_)) { 818 if (IsComment(rmode_)) {
819 PrintF(out, " (%s)", reinterpret_cast<char*>(data_)); 819 os << " (" << reinterpret_cast<char*>(data_) << ")";
820 } else if (rmode_ == EMBEDDED_OBJECT) { 820 } else if (rmode_ == EMBEDDED_OBJECT) {
821 PrintF(out, " ("); 821 os << " (" << Brief(target_object()) << ")";
822 target_object()->ShortPrint(out);
823 PrintF(out, ")");
824 } else if (rmode_ == EXTERNAL_REFERENCE) { 822 } else if (rmode_ == EXTERNAL_REFERENCE) {
825 ExternalReferenceEncoder ref_encoder(isolate); 823 ExternalReferenceEncoder ref_encoder(isolate);
826 PrintF(out, " (%s) (%p)", 824 os << " (" << ref_encoder.NameOfAddress(target_reference()) << ") ("
827 ref_encoder.NameOfAddress(target_reference()), 825 << target_reference() << ")";
828 target_reference());
829 } else if (IsCodeTarget(rmode_)) { 826 } else if (IsCodeTarget(rmode_)) {
830 Code* code = Code::GetCodeFromTargetAddress(target_address()); 827 Code* code = Code::GetCodeFromTargetAddress(target_address());
831 PrintF(out, " (%s) (%p)", Code::Kind2String(code->kind()), 828 os << " (" << Code::Kind2String(code->kind()) << ") (" << target_address()
832 target_address()); 829 << ")";
833 if (rmode_ == CODE_TARGET_WITH_ID) { 830 if (rmode_ == CODE_TARGET_WITH_ID) {
834 PrintF(out, " (id=%d)", static_cast<int>(data_)); 831 os << " (id=" << static_cast<int>(data_) << ")";
835 } 832 }
836 } else if (IsPosition(rmode_)) { 833 } else if (IsPosition(rmode_)) {
837 PrintF(out, " (%" V8_PTR_PREFIX "d)", data()); 834 os << " (" << data() << ")";
838 } else if (IsRuntimeEntry(rmode_) && 835 } else if (IsRuntimeEntry(rmode_) &&
839 isolate->deoptimizer_data() != NULL) { 836 isolate->deoptimizer_data() != NULL) {
840 // Depotimization bailouts are stored as runtime entries. 837 // Depotimization bailouts are stored as runtime entries.
841 int id = Deoptimizer::GetDeoptimizationId( 838 int id = Deoptimizer::GetDeoptimizationId(
842 isolate, target_address(), Deoptimizer::EAGER); 839 isolate, target_address(), Deoptimizer::EAGER);
843 if (id != Deoptimizer::kNotDeoptimizationEntry) { 840 if (id != Deoptimizer::kNotDeoptimizationEntry) {
844 PrintF(out, " (deoptimization bailout %d)", id); 841 os << " (deoptimization bailout " << id << ")";
845 } 842 }
846 } 843 }
847 844
848 PrintF(out, "\n"); 845 os << "\n";
849 } 846 }
850 #endif // ENABLE_DISASSEMBLER 847 #endif // ENABLE_DISASSEMBLER
851 848
852 849
853 #ifdef VERIFY_HEAP 850 #ifdef VERIFY_HEAP
854 void RelocInfo::Verify(Isolate* isolate) { 851 void RelocInfo::Verify(Isolate* isolate) {
855 switch (rmode_) { 852 switch (rmode_) {
856 case EMBEDDED_OBJECT: 853 case EMBEDDED_OBJECT:
857 Object::VerifyPointer(target_object()); 854 Object::VerifyPointer(target_object());
858 break; 855 break;
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 r2 = r2 - ad; 1650 r2 = r2 - ad;
1654 } 1651 }
1655 delta = ad - r2; 1652 delta = ad - r2;
1656 } while (q1 < delta || (q1 == delta && r1 == 0)); 1653 } while (q1 < delta || (q1 == delta && r1 == 0));
1657 int32_t mul = static_cast<int32_t>(q2 + 1); 1654 int32_t mul = static_cast<int32_t>(q2 + 1);
1658 multiplier_ = (d < 0) ? -mul : mul; 1655 multiplier_ = (d < 0) ? -mul : mul;
1659 shift_ = p - 32; 1656 shift_ = p - 32;
1660 } 1657 }
1661 1658
1662 } } // namespace v8::internal 1659 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698