Replace OStream with std::ostream.

Review URL: https://codereview.chromium.org/618643002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24319 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
bmeurer@chromium.org 2014-09-30 10:29:32 +00:00
parent 49ffb141d9
commit 3eebdc3264
92 changed files with 738 additions and 1042 deletions

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <sstream>
#include "src/v8.h"
#include "src/arm/lithium-codegen-arm.h"
@ -316,9 +318,9 @@ void LAccessArgumentsAt::PrintDataTo(StringStream* stream) {
void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
OStringStream os;
std::ostringstream os;
os << hydrogen()->access() << " <- ";
stream->Add(os.c_str());
stream->Add(os.str().c_str());
value()->PrintTo(stream);
}

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <sstream>
#include "src/v8.h"
#include "src/arm64/lithium-codegen-arm64.h"
@ -282,9 +284,9 @@ void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
OStringStream os;
std::ostringstream os;
os << hydrogen()->access();
stream->Add(os.c_str());
stream->Add(os.str().c_str());
stream->Add(" <- ");
value()->PrintTo(stream);
}

View File

@ -794,8 +794,8 @@ const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {
}
void RelocInfo::Print(Isolate* isolate, OStream& os) { // NOLINT
os << pc_ << " " << RelocModeName(rmode_);
void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT
os << static_cast<const void*>(pc_) << " " << RelocModeName(rmode_);
if (IsComment(rmode_)) {
os << " (" << reinterpret_cast<char*>(data_) << ")";
} else if (rmode_ == EMBEDDED_OBJECT) {

View File

@ -578,7 +578,7 @@ class RelocInfo {
#ifdef ENABLE_DISASSEMBLER
// Printing
static const char* RelocModeName(Mode rmode);
void Print(Isolate* isolate, OStream& os); // NOLINT
void Print(Isolate* isolate, std::ostream& os); // NOLINT
#endif // ENABLE_DISASSEMBLER
#ifdef VERIFY_HEAP
void Verify(Isolate* isolate);

View File

@ -794,14 +794,14 @@ bool RegExpCapture::IsAnchoredAtEnd() {
// output formats are alike.
class RegExpUnparser FINAL : public RegExpVisitor {
public:
RegExpUnparser(OStream& os, Zone* zone) : os_(os), zone_(zone) {}
RegExpUnparser(std::ostream& os, Zone* zone) : os_(os), zone_(zone) {}
void VisitCharacterRange(CharacterRange that);
#define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, \
void* data) OVERRIDE;
FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE)
#undef MAKE_CASE
private:
OStream& os_;
std::ostream& os_;
Zone* zone_;
};
@ -944,7 +944,7 @@ void* RegExpUnparser::VisitEmpty(RegExpEmpty* that, void* data) {
}
OStream& RegExpTree::Print(OStream& os, Zone* zone) { // NOLINT
std::ostream& RegExpTree::Print(std::ostream& os, Zone* zone) { // NOLINT
RegExpUnparser unparser(os, zone);
Accept(&unparser, NULL);
return os;

View File

@ -115,7 +115,6 @@ class BreakableStatement;
class Expression;
class IterationStatement;
class MaterializedLiteral;
class OStream;
class Statement;
class TargetCollector;
class TypeFeedbackOracle;
@ -2613,7 +2612,7 @@ class RegExpTree : public ZoneObject {
// expression.
virtual Interval CaptureRegisters() { return Interval::Empty(); }
virtual void AppendToText(RegExpText* text, Zone* zone);
OStream& Print(OStream& os, Zone* zone); // NOLINT
std::ostream& Print(std::ostream& os, Zone* zone); // NOLINT
#define MAKE_ASTYPE(Name) \
virtual RegExp##Name* As##Name(); \
virtual bool Is##Name();

View File

@ -4,6 +4,8 @@
#include "src/basic-block-profiler.h"
#include <sstream>
namespace v8 {
namespace internal {
@ -14,22 +16,22 @@ BasicBlockProfiler::Data::Data(size_t n_blocks)
BasicBlockProfiler::Data::~Data() {}
static void InsertIntoString(OStringStream* os, std::string* string) {
string->insert(string->begin(), os->c_str(), &os->c_str()[os->size()]);
static void InsertIntoString(std::ostringstream* os, std::string* string) {
string->insert(0, os->str());
}
void BasicBlockProfiler::Data::SetCode(OStringStream* os) {
void BasicBlockProfiler::Data::SetCode(std::ostringstream* os) {
InsertIntoString(os, &code_);
}
void BasicBlockProfiler::Data::SetFunctionName(OStringStream* os) {
void BasicBlockProfiler::Data::SetFunctionName(std::ostringstream* os) {
InsertIntoString(os, &function_name_);
}
void BasicBlockProfiler::Data::SetSchedule(OStringStream* os) {
void BasicBlockProfiler::Data::SetSchedule(std::ostringstream* os) {
InsertIntoString(os, &schedule_);
}
@ -77,33 +79,33 @@ void BasicBlockProfiler::ResetCounts() {
}
OStream& operator<<(OStream& os, const BasicBlockProfiler& p) {
os << "---- Start Profiling Data ----" << endl;
std::ostream& operator<<(std::ostream& os, const BasicBlockProfiler& p) {
os << "---- Start Profiling Data ----" << std::endl;
typedef BasicBlockProfiler::DataList::const_iterator iterator;
for (iterator i = p.data_list_.begin(); i != p.data_list_.end(); ++i) {
os << **i;
}
os << "---- End Profiling Data ----" << endl;
os << "---- End Profiling Data ----" << std::endl;
return os;
}
OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& d) {
std::ostream& operator<<(std::ostream& os, const BasicBlockProfiler::Data& d) {
const char* name = "unknown function";
if (!d.function_name_.empty()) {
name = d.function_name_.c_str();
}
if (!d.schedule_.empty()) {
os << "schedule for " << name << endl;
os << d.schedule_.c_str() << endl;
os << "schedule for " << name << std::endl;
os << d.schedule_.c_str() << std::endl;
}
os << "block counts for " << name << ":" << endl;
os << "block counts for " << name << ":" << std::endl;
for (size_t i = 0; i < d.n_blocks_; ++i) {
os << "block " << d.block_ids_[i] << " : " << d.counts_[i] << endl;
os << "block " << d.block_ids_[i] << " : " << d.counts_[i] << std::endl;
}
os << endl;
os << std::endl;
if (!d.code_.empty()) {
os << d.code_.c_str() << endl;
os << d.code_.c_str() << std::endl;
}
return os;
}

View File

@ -5,7 +5,9 @@
#ifndef V8_BASIC_BLOCK_PROFILER_H_
#define V8_BASIC_BLOCK_PROFILER_H_
#include <iosfwd>
#include <list>
#include <string>
#include "src/v8.h"
@ -22,15 +24,16 @@ class BasicBlockProfiler {
size_t n_blocks() const { return n_blocks_; }
const uint32_t* counts() const { return &counts_[0]; }
void SetCode(OStringStream* os);
void SetFunctionName(OStringStream* os);
void SetSchedule(OStringStream* os);
void SetCode(std::ostringstream* os);
void SetFunctionName(std::ostringstream* os);
void SetSchedule(std::ostringstream* os);
void SetBlockId(size_t offset, size_t block_id);
uint32_t* GetCounterAddress(size_t offset);
private:
friend class BasicBlockProfiler;
friend OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& s);
friend std::ostream& operator<<(std::ostream& os,
const BasicBlockProfiler::Data& s);
explicit Data(size_t n_blocks);
~Data();
@ -57,15 +60,16 @@ class BasicBlockProfiler {
const DataList* data_list() { return &data_list_; }
private:
friend OStream& operator<<(OStream& os, const BasicBlockProfiler& s);
friend std::ostream& operator<<(std::ostream& os,
const BasicBlockProfiler& s);
DataList data_list_;
DISALLOW_COPY_AND_ASSIGN(BasicBlockProfiler);
};
OStream& operator<<(OStream& os, const BasicBlockProfiler& s);
OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& s);
std::ostream& operator<<(std::ostream& os, const BasicBlockProfiler& s);
std::ostream& operator<<(std::ostream& os, const BasicBlockProfiler::Data& s);
} // namespace internal
} // namespace v8

View File

@ -277,7 +277,7 @@ static Handle<Code> DoGenerateCode(Stub* stub) {
if (FLAG_profile_hydrogen_code_stub_compilation) {
OFStream os(stdout);
os << "[Lazy compilation of " << stub << " took "
<< timer.Elapsed().InMillisecondsF() << " ms]" << endl;
<< timer.Elapsed().InMillisecondsF() << " ms]" << std::endl;
}
return code;
}

View File

@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/v8.h"
#include "src/code-stubs.h"
#include <sstream>
#include "src/bootstrapper.h"
#include "src/code-stubs.h"
#include "src/cpu-profiler.h"
#include "src/factory.h"
#include "src/gdb-jit.h"
@ -75,9 +76,10 @@ bool CodeStub::FindCodeInCache(Code** code_out) {
void CodeStub::RecordCodeGeneration(Handle<Code> code) {
IC::RegisterWeakMapDependency(code);
OStringStream os;
std::ostringstream os;
os << *this;
PROFILE(isolate(), CodeCreateEvent(Logger::STUB_TAG, *code, os.c_str()));
PROFILE(isolate(),
CodeCreateEvent(Logger::STUB_TAG, *code, os.str().c_str()));
Counters* counters = isolate()->counters();
counters->total_stubs_code_size()->Increment(code->instruction_size());
}
@ -153,9 +155,9 @@ Handle<Code> CodeStub::GetCode() {
if (FLAG_print_code_stubs) {
CodeTracer::Scope trace_scope(isolate()->GetCodeTracer());
OFStream os(trace_scope.file());
OStringStream name;
std::ostringstream name;
name << *this;
new_object->Disassemble(name.c_str(), os);
new_object->Disassemble(name.str().c_str(), os);
os << "\n";
}
#endif
@ -198,12 +200,12 @@ const char* CodeStub::MajorName(CodeStub::Major major_key,
}
void CodeStub::PrintBaseName(OStream& os) const { // NOLINT
void CodeStub::PrintBaseName(std::ostream& os) const { // NOLINT
os << MajorName(MajorKey(), false);
}
void CodeStub::PrintName(OStream& os) const { // NOLINT
void CodeStub::PrintName(std::ostream& os) const { // NOLINT
PrintBaseName(os);
PrintState(os);
}
@ -279,7 +281,7 @@ void BinaryOpICStub::GenerateAheadOfTime(Isolate* isolate) {
}
void BinaryOpICStub::PrintState(OStream& os) const { // NOLINT
void BinaryOpICStub::PrintState(std::ostream& os) const { // NOLINT
os << state();
}
@ -300,7 +302,7 @@ void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) {
void BinaryOpICWithAllocationSiteStub::PrintState(
OStream& os) const { // NOLINT
std::ostream& os) const { // NOLINT
os << state();
}
@ -315,7 +317,7 @@ void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(
}
void StringAddStub::PrintBaseName(OStream& os) const { // NOLINT
void StringAddStub::PrintBaseName(std::ostream& os) const { // NOLINT
os << "StringAddStub";
if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) {
os << "_CheckBoth";
@ -463,17 +465,17 @@ void HydrogenCodeStub::TraceTransition(StateType from, StateType to) {
OFStream os(stdout);
os << "[";
PrintBaseName(os);
os << ": " << from << "=>" << to << "]" << endl;
os << ": " << from << "=>" << to << "]" << std::endl;
}
void CompareNilICStub::PrintBaseName(OStream& os) const { // NOLINT
void CompareNilICStub::PrintBaseName(std::ostream& os) const { // NOLINT
CodeStub::PrintBaseName(os);
os << ((nil_value() == kNullValue) ? "(NullValue)" : "(UndefinedValue)");
}
void CompareNilICStub::PrintState(OStream& os) const { // NOLINT
void CompareNilICStub::PrintState(std::ostream& os) const { // NOLINT
os << state();
}
@ -481,7 +483,7 @@ void CompareNilICStub::PrintState(OStream& os) const { // NOLINT
// TODO(svenpanne) Make this a real infix_ostream_iterator.
class SimpleListPrinter {
public:
explicit SimpleListPrinter(OStream& os) : os_(os), first_(true) {}
explicit SimpleListPrinter(std::ostream& os) : os_(os), first_(true) {}
void Add(const char* s) {
if (first_) {
@ -493,12 +495,12 @@ class SimpleListPrinter {
}
private:
OStream& os_;
std::ostream& os_;
bool first_;
};
OStream& operator<<(OStream& os, const CompareNilICStub::State& s) {
std::ostream& operator<<(std::ostream& os, const CompareNilICStub::State& s) {
os << "(";
SimpleListPrinter p(os);
if (s.IsEmpty()) p.Add("None");
@ -539,17 +541,17 @@ Type* CompareNilICStub::GetInputType(Zone* zone, Handle<Map> map) {
}
void CallIC_ArrayStub::PrintState(OStream& os) const { // NOLINT
void CallIC_ArrayStub::PrintState(std::ostream& os) const { // NOLINT
os << state() << " (Array)";
}
void CallICStub::PrintState(OStream& os) const { // NOLINT
void CallICStub::PrintState(std::ostream& os) const { // NOLINT
os << state();
}
void InstanceofStub::PrintName(OStream& os) const { // NOLINT
void InstanceofStub::PrintName(std::ostream& os) const { // NOLINT
os << "InstanceofStub";
if (HasArgsInRegisters()) os << "_REGS";
if (HasCallSiteInlineCheck()) os << "_INLINE";
@ -777,7 +779,7 @@ void ArgumentsAccessStub::Generate(MacroAssembler* masm) {
}
void ArgumentsAccessStub::PrintName(OStream& os) const { // NOLINT
void ArgumentsAccessStub::PrintName(std::ostream& os) const { // NOLINT
os << "ArgumentsAccessStub_";
switch (type()) {
case READ_ELEMENT:
@ -797,18 +799,18 @@ void ArgumentsAccessStub::PrintName(OStream& os) const { // NOLINT
}
void CallFunctionStub::PrintName(OStream& os) const { // NOLINT
void CallFunctionStub::PrintName(std::ostream& os) const { // NOLINT
os << "CallFunctionStub_Args" << argc();
}
void CallConstructStub::PrintName(OStream& os) const { // NOLINT
void CallConstructStub::PrintName(std::ostream& os) const { // NOLINT
os << "CallConstructStub";
if (RecordCallTarget()) os << "_Recording";
}
void ArrayConstructorStub::PrintName(OStream& os) const { // NOLINT
void ArrayConstructorStub::PrintName(std::ostream& os) const { // NOLINT
os << "ArrayConstructorStub";
switch (argument_count()) {
case ANY:
@ -828,8 +830,9 @@ void ArrayConstructorStub::PrintName(OStream& os) const { // NOLINT
}
OStream& ArrayConstructorStubBase::BasePrintName(OStream& os, // NOLINT
const char* name) const {
std::ostream& ArrayConstructorStubBase::BasePrintName(
std::ostream& os, // NOLINT
const char* name) const {
os << name << "_" << ElementsKindToString(elements_kind());
if (override_mode() == DISABLE_ALLOCATION_SITES) {
os << "_DISABLE_ALLOCATION_SITES";
@ -848,12 +851,12 @@ bool ToBooleanStub::UpdateStatus(Handle<Object> object) {
}
void ToBooleanStub::PrintState(OStream& os) const { // NOLINT
void ToBooleanStub::PrintState(std::ostream& os) const { // NOLINT
os << types();
}
OStream& operator<<(OStream& os, const ToBooleanStub::Types& s) {
std::ostream& operator<<(std::ostream& os, const ToBooleanStub::Types& s) {
os << "(";
SimpleListPrinter p(os);
if (s.IsEmpty()) p.Add("None");

View File

@ -204,7 +204,7 @@ class CodeStub BASE_EMBEDDED {
return Code::NORMAL;
}
friend OStream& operator<<(OStream& os, const CodeStub& s) {
friend std::ostream& operator<<(std::ostream& os, const CodeStub& s) {
s.PrintName(os);
return os;
}
@ -222,9 +222,9 @@ class CodeStub BASE_EMBEDDED {
// a fixed (non-moveable) code object.
virtual bool NeedsImmovableCode() { return false; }
virtual void PrintName(OStream& os) const; // NOLINT
virtual void PrintBaseName(OStream& os) const; // NOLINT
virtual void PrintState(OStream& os) const { ; } // NOLINT
virtual void PrintName(std::ostream& os) const; // NOLINT
virtual void PrintBaseName(std::ostream& os) const; // NOLINT
virtual void PrintState(std::ostream& os) const { ; } // NOLINT
// Computes the key based on major and minor.
uint32_t GetKey() {
@ -706,7 +706,7 @@ class InstanceofStub: public PlatformCodeStub {
return (flags() & kReturnTrueFalseObject) != 0;
}
virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
class FlagBits : public BitField<Flags, 0, 3> {};
@ -737,7 +737,7 @@ class ArrayConstructorStub: public PlatformCodeStub {
void GenerateDispatchToArrayStub(MacroAssembler* masm,
AllocationSiteOverrideMode mode);
virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {};
@ -823,7 +823,7 @@ class CallICStub: public PlatformCodeStub {
void GenerateMiss(MacroAssembler* masm);
private:
virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback);
DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub);
@ -840,7 +840,7 @@ class CallIC_ArrayStub: public CallICStub {
}
private:
virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
DEFINE_PLATFORM_CODE_STUB(CallIC_Array, CallICStub);
};
@ -1162,7 +1162,7 @@ class BinaryOpICStub : public HydrogenCodeStub {
return BinaryOpICState(isolate(), GetExtraICState());
}
virtual void PrintState(OStream& os) const FINAL OVERRIDE; // NOLINT
virtual void PrintState(std::ostream& os) const FINAL OVERRIDE; // NOLINT
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kLeft = 0;
@ -1207,7 +1207,7 @@ class BinaryOpICWithAllocationSiteStub FINAL : public PlatformCodeStub {
return static_cast<ExtraICState>(minor_key_);
}
virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
private:
BinaryOpICState state() const {
@ -1283,7 +1283,7 @@ class StringAddStub FINAL : public HydrogenCodeStub {
class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {};
class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {};
virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT
virtual void PrintBaseName(std::ostream& os) const OVERRIDE; // NOLINT
DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd);
DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub);
@ -1395,8 +1395,8 @@ class CompareNilICStub : public HydrogenCodeStub {
set_sub_minor_key(TypesBits::update(sub_minor_key(), 0));
}
virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT
virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
virtual void PrintBaseName(std::ostream& os) const OVERRIDE; // NOLINT
private:
CompareNilICStub(Isolate* isolate, NilValue nil,
@ -1423,7 +1423,7 @@ class CompareNilICStub : public HydrogenCodeStub {
State() : EnumSet<CompareNilType, byte>(0) { }
explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { }
};
friend OStream& operator<<(OStream& os, const State& s);
friend std::ostream& operator<<(std::ostream& os, const State& s);
State state() const { return State(TypesBits::decode(sub_minor_key())); }
@ -1437,7 +1437,7 @@ class CompareNilICStub : public HydrogenCodeStub {
};
OStream& operator<<(OStream& os, const CompareNilICStub::State& s);
std::ostream& operator<<(std::ostream& os, const CompareNilICStub::State& s);
class CEntryStub : public PlatformCodeStub {
@ -1485,7 +1485,7 @@ class JSEntryStub : public PlatformCodeStub {
private:
virtual void FinishCode(Handle<Code> code);
virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT
virtual void PrintName(std::ostream& os) const OVERRIDE { // NOLINT
os << (type() == StackFrame::ENTRY ? "JSEntryStub"
: "JSConstructEntryStub");
}
@ -1531,7 +1531,7 @@ class ArgumentsAccessStub: public PlatformCodeStub {
void GenerateNewSloppyFast(MacroAssembler* masm);
void GenerateNewSloppySlow(MacroAssembler* masm);
virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
class TypeBits : public BitField<Type, 0, 2> {};
@ -1585,7 +1585,7 @@ class CallFunctionStub: public PlatformCodeStub {
bool NeedsChecks() const { return flags() != WRAP_AND_CALL; }
virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
// Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
class FlagBits : public BitField<CallFunctionFlags, 0, 2> {};
@ -1615,7 +1615,7 @@ class CallConstructStub: public PlatformCodeStub {
return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0;
}
virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
class FlagBits : public BitField<CallConstructorFlags, 0, 1> {};
@ -2081,7 +2081,8 @@ class ArrayConstructorStubBase : public HydrogenCodeStub {
static const int kAllocationSite = 1;
protected:
OStream& BasePrintName(OStream& os, const char* name) const; // NOLINT
std::ostream& BasePrintName(std::ostream& os,
const char* name) const; // NOLINT
private:
// Ensure data fits within available bits.
@ -2105,7 +2106,7 @@ class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase {
}
private:
virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT
virtual void PrintName(std::ostream& os) const OVERRIDE { // NOLINT
BasePrintName(os, "ArrayNoArgumentConstructorStub");
}
@ -2125,7 +2126,7 @@ class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase {
}
private:
virtual void PrintName(OStream& os) const { // NOLINT
virtual void PrintName(std::ostream& os) const { // NOLINT
BasePrintName(os, "ArraySingleArgumentConstructorStub");
}
@ -2145,7 +2146,7 @@ class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase {
}
private:
virtual void PrintName(OStream& os) const { // NOLINT
virtual void PrintName(std::ostream& os) const { // NOLINT
BasePrintName(os, "ArrayNArgumentsConstructorStub");
}
@ -2290,7 +2291,7 @@ class ToBooleanStub: public HydrogenCodeStub {
ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); }
virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; }
virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
virtual bool SometimesSetsUpAFrame() { return false; }
@ -2322,7 +2323,7 @@ class ToBooleanStub: public HydrogenCodeStub {
};
OStream& operator<<(OStream& os, const ToBooleanStub::Types& t);
std::ostream& operator<<(std::ostream& os, const ToBooleanStub::Types& t);
class ElementsTransitionAndStoreStub : public HydrogenCodeStub {

View File

@ -1204,9 +1204,7 @@ struct MemoryAccess {
std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) {
OStringStream ost;
ost << memacc.type;
return os << ost.c_str();
return os << memacc.type;
}

View File

@ -996,9 +996,7 @@ struct MemoryAccess {
std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) {
OStringStream ost;
ost << memacc.type;
return os << ost.c_str();
return os << memacc.type;
}
} // namespace

View File

@ -3,6 +3,9 @@
// found in the LICENSE file.
#include "src/compiler/basic-block-instrumentor.h"
#include <sstream>
#include "src/compiler/common-operator.h"
#include "src/compiler/graph.h"
#include "src/compiler/machine-operator.h"
@ -52,13 +55,13 @@ BasicBlockProfiler::Data* BasicBlockInstrumentor::Instrument(
// Set the function name.
if (!info->shared_info().is_null() &&
info->shared_info()->name()->IsString()) {
OStringStream os;
std::ostringstream os;
String::cast(info->shared_info()->name())->PrintUC16(os);
data->SetFunctionName(&os);
}
// Capture the schedule string before instrumentation.
{
OStringStream os;
std::ostringstream os;
os << *schedule;
data->SetSchedule(&os);
}

View File

@ -20,14 +20,6 @@ namespace v8 {
namespace internal {
namespace compiler {
// TODO(bmeurer): Find a new home for these functions.
inline std::ostream& operator<<(std::ostream& os, const MachineType& type) {
OStringStream ost;
ost << type;
return os << ost.c_str();
}
class ChangeLoweringTest : public GraphTest {
public:
ChangeLoweringTest() : simplified_(zone()) {}

View File

@ -24,7 +24,9 @@ class ControlOperator : public Operator1<int> {
: Operator1<int>(opcode, properties, inputs, outputs, mnemonic,
controls) {}
virtual OStream& PrintParameter(OStream& os) const FINAL { return os; }
virtual std::ostream& PrintParameter(std::ostream& os) const FINAL {
return os;
}
};
} // namespace
@ -33,7 +35,7 @@ class ControlOperator : public Operator1<int> {
// Specialization for static parameters of type {ExternalReference}.
template <>
struct StaticParameterTraits<ExternalReference> {
static OStream& PrintTo(OStream& os, ExternalReference reference) {
static std::ostream& PrintTo(std::ostream& os, ExternalReference reference) {
os << reference.address();
// TODO(bmeurer): Move to operator<<(os, ExternalReference)
const Runtime::Function* function =
@ -234,7 +236,7 @@ const Operator* CommonOperatorBuilder::Call(const CallDescriptor* descriptor) {
static_cast<int>(descriptor->ReturnCount()), mnemonic,
descriptor) {}
virtual OStream& PrintParameter(OStream& os) const OVERRIDE {
virtual std::ostream& PrintParameter(std::ostream& os) const OVERRIDE {
return os << "[" << *parameter() << "]";
}
};

View File

@ -13,7 +13,6 @@ namespace internal {
// Forward declarations.
class ExternalReference;
class OStream;
namespace compiler {

View File

@ -24,9 +24,8 @@ inline std::ostream& operator<<(std::ostream& os, const Unique<T>& value) {
}
inline std::ostream& operator<<(std::ostream& os,
const ExternalReference& value) {
OStringStream ost;
compiler::StaticParameterTraits<ExternalReference>::PrintTo(ost, value);
return os << ost.c_str();
compiler::StaticParameterTraits<ExternalReference>::PrintTo(os, value);
return os;
}
namespace compiler {

View File

@ -4,6 +4,9 @@
#include "src/compiler/graph-visualizer.h"
#include <sstream>
#include <string>
#include "src/compiler/generic-algorithm.h"
#include "src/compiler/generic-node.h"
#include "src/compiler/generic-node-inl.h"
@ -24,13 +27,15 @@ namespace compiler {
class Escaped {
public:
explicit Escaped(const OStringStream& os, const char* escaped_chars = "<>|{}")
: str_(os.c_str()), escaped_chars_(escaped_chars) {}
explicit Escaped(const std::ostringstream& os,
const char* escaped_chars = "<>|{}")
: str_(os.str()), escaped_chars_(escaped_chars) {}
friend OStream& operator<<(OStream& os, const Escaped& e) {
for (const char* s = e.str_; *s != '\0'; ++s) {
if (e.needs_escape(*s)) os << "\\";
os << *s;
friend std::ostream& operator<<(std::ostream& os, const Escaped& e) {
for (std::string::const_iterator i = e.str_.begin(); i != e.str_.end();
++i) {
if (e.needs_escape(*i)) os << "\\";
os << *i;
}
return os;
}
@ -43,13 +48,14 @@ class Escaped {
return false;
}
const char* const str_;
const std::string str_;
const char* const escaped_chars_;
};
class JSONGraphNodeWriter : public NullNodeVisitor {
public:
JSONGraphNodeWriter(OStream& os, Zone* zone, const Graph* graph) // NOLINT
JSONGraphNodeWriter(std::ostream& os, Zone* zone,
const Graph* graph) // NOLINT
: os_(os),
graph_(graph),
first_node_(true) {}
@ -59,7 +65,7 @@ class JSONGraphNodeWriter : public NullNodeVisitor {
GenericGraphVisit::Control Pre(Node* node);
private:
OStream& os_;
std::ostream& os_;
const Graph* const graph_;
bool first_node_;
@ -73,7 +79,7 @@ GenericGraphVisit::Control JSONGraphNodeWriter::Pre(Node* node) {
} else {
os_ << ",";
}
OStringStream label;
std::ostringstream label;
label << *node->op();
os_ << "{\"id\":" << node->id() << ",\"label\":\"" << Escaped(label, "\"")
<< "\"";
@ -101,7 +107,8 @@ GenericGraphVisit::Control JSONGraphNodeWriter::Pre(Node* node) {
class JSONGraphEdgeWriter : public NullNodeVisitor {
public:
JSONGraphEdgeWriter(OStream& os, Zone* zone, const Graph* graph) // NOLINT
JSONGraphEdgeWriter(std::ostream& os, Zone* zone,
const Graph* graph) // NOLINT
: os_(os),
graph_(graph),
first_edge_(true) {}
@ -111,7 +118,7 @@ class JSONGraphEdgeWriter : public NullNodeVisitor {
GenericGraphVisit::Control PreEdge(Node* from, int index, Node* to);
private:
OStream& os_;
std::ostream& os_;
const Graph* const graph_;
bool first_edge_;
@ -146,7 +153,7 @@ GenericGraphVisit::Control JSONGraphEdgeWriter::PreEdge(Node* from, int index,
}
OStream& operator<<(OStream& os, const AsJSON& ad) {
std::ostream& operator<<(std::ostream& os, const AsJSON& ad) {
Zone tmp_zone(ad.graph.zone()->isolate());
os << "{\"nodes\":[";
JSONGraphNodeWriter(os, &tmp_zone, &ad.graph).Print();
@ -159,7 +166,7 @@ OStream& operator<<(OStream& os, const AsJSON& ad) {
class GraphVisualizer : public NullNodeVisitor {
public:
GraphVisualizer(OStream& os, Zone* zone, const Graph* graph); // NOLINT
GraphVisualizer(std::ostream& os, Zone* zone, const Graph* graph); // NOLINT
void Print();
@ -174,7 +181,7 @@ class GraphVisualizer : public NullNodeVisitor {
NodeSet all_nodes_;
NodeSet white_nodes_;
bool use_to_def_;
OStream& os_;
std::ostream& os_;
const Graph* const graph_;
DISALLOW_COPY_AND_ASSIGN(GraphVisualizer);
@ -258,7 +265,7 @@ void GraphVisualizer::AnnotateNode(Node* node) {
break;
}
OStringStream label;
std::ostringstream label;
label << *node->op();
os_ << " label=\"{{#" << node->id() << ":" << Escaped(label);
@ -291,9 +298,9 @@ void GraphVisualizer::AnnotateNode(Node* node) {
if (FLAG_trace_turbo_types && !NodeProperties::IsControl(node)) {
Bounds bounds = NodeProperties::GetBounds(node);
OStringStream upper;
std::ostringstream upper;
bounds.upper->PrintTo(upper);
OStringStream lower;
std::ostringstream lower;
bounds.lower->PrintTo(lower);
os_ << "|" << Escaped(upper) << "|" << Escaped(lower);
}
@ -367,7 +374,7 @@ void GraphVisualizer::Print() {
}
GraphVisualizer::GraphVisualizer(OStream& os, Zone* zone,
GraphVisualizer::GraphVisualizer(std::ostream& os, Zone* zone,
const Graph* graph) // NOLINT
: zone_(zone),
all_nodes_(NodeSet::key_compare(), NodeSet::allocator_type(zone)),
@ -377,7 +384,7 @@ GraphVisualizer::GraphVisualizer(OStream& os, Zone* zone,
graph_(graph) {}
OStream& operator<<(OStream& os, const AsDOT& ad) {
std::ostream& operator<<(std::ostream& os, const AsDOT& ad) {
Zone tmp_zone(ad.graph.zone()->isolate());
GraphVisualizer(os, &tmp_zone, &ad.graph).Print();
return os;

View File

@ -5,13 +5,10 @@
#ifndef V8_COMPILER_GRAPH_VISUALIZER_H_
#define V8_COMPILER_GRAPH_VISUALIZER_H_
#include "src/v8.h"
#include <iosfwd>
namespace v8 {
namespace internal {
class OStream;
namespace compiler {
class Graph;
@ -21,16 +18,18 @@ struct AsDOT {
const Graph& graph;
};
OStream& operator<<(OStream& os, const AsDOT& ad);
std::ostream& operator<<(std::ostream& os, const AsDOT& ad);
struct AsJSON {
explicit AsJSON(const Graph& g) : graph(g) {}
const Graph& graph;
};
OStream& operator<<(OStream& os, const AsJSON& ad);
}
}
} // namespace v8::internal::compiler
std::ostream& operator<<(std::ostream& os, const AsJSON& ad);
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_GRAPH_VISUALIZER_H_

View File

@ -158,9 +158,7 @@ struct MemoryAccess {
std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) {
OStringStream ost;
ost << memacc.type;
return os << ost.c_str();
return os << memacc.type;
}

View File

@ -5,6 +5,8 @@
#ifndef V8_COMPILER_INSTRUCTION_CODES_H_
#define V8_COMPILER_INSTRUCTION_CODES_H_
#include <iosfwd>
#if V8_TARGET_ARCH_ARM
#include "src/compiler/arm/instruction-codes-arm.h"
#elif V8_TARGET_ARCH_ARM64
@ -21,9 +23,6 @@
namespace v8 {
namespace internal {
class OStream;
namespace compiler {
// Target-specific opcodes that specify which assembly sequence to emit.
@ -46,7 +45,7 @@ enum ArchOpcode {
#undef COUNT_ARCH_OPCODE
};
OStream& operator<<(OStream& os, const ArchOpcode& ao);
std::ostream& operator<<(std::ostream& os, const ArchOpcode& ao);
// Addressing modes represent the "shape" of inputs to an instruction.
// Many instructions support multiple addressing modes. Addressing modes
@ -65,12 +64,12 @@ enum AddressingMode {
#undef COUNT_ADDRESSING_MODE
};
OStream& operator<<(OStream& os, const AddressingMode& am);
std::ostream& operator<<(std::ostream& os, const AddressingMode& am);
// The mode of the flags continuation (see below).
enum FlagsMode { kFlags_none = 0, kFlags_branch = 1, kFlags_set = 2 };
OStream& operator<<(OStream& os, const FlagsMode& fm);
std::ostream& operator<<(std::ostream& os, const FlagsMode& fm);
// The condition of flags continuation (see below).
enum FlagsCondition {
@ -94,7 +93,7 @@ enum FlagsCondition {
kNotOverflow
};
OStream& operator<<(OStream& os, const FlagsCondition& fc);
std::ostream& operator<<(std::ostream& os, const FlagsCondition& fc);
// The InstructionCode is an opaque, target-specific integer that encodes
// what code to emit for an instruction in the code generator. It is not

View File

@ -30,7 +30,8 @@ InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build(
Schedule* schedule = Export();
if (FLAG_trace_turbo) {
OFStream out(stdout);
out << "=== Schedule before instruction selection ===" << endl << *schedule;
out << "=== Schedule before instruction selection ===" << std::endl
<< *schedule;
}
EXPECT_NE(0, graph()->NodeCount());
CompilationInfo info(test_->isolate(), test_->zone());
@ -41,7 +42,7 @@ InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build(
selector.SelectInstructions();
if (FLAG_trace_turbo) {
OFStream out(stdout);
out << "=== Code sequence after instruction selection ===" << endl
out << "=== Code sequence after instruction selection ===" << std::endl
<< sequence;
}
Stream s;

View File

@ -11,7 +11,7 @@ namespace v8 {
namespace internal {
namespace compiler {
OStream& operator<<(OStream& os, const InstructionOperand& op) {
std::ostream& operator<<(std::ostream& os, const InstructionOperand& op) {
switch (op.kind()) {
case InstructionOperand::INVALID:
return os << "(0)";
@ -96,7 +96,7 @@ void InstructionOperand::TearDownCaches() {
}
OStream& operator<<(OStream& os, const MoveOperands& mo) {
std::ostream& operator<<(std::ostream& os, const MoveOperands& mo) {
os << *mo.destination();
if (!mo.source()->Equals(mo.destination())) os << " = " << *mo.source();
return os << ";";
@ -111,7 +111,7 @@ bool ParallelMove::IsRedundant() const {
}
OStream& operator<<(OStream& os, const ParallelMove& pm) {
std::ostream& operator<<(std::ostream& os, const ParallelMove& pm) {
bool first = true;
for (ZoneList<MoveOperands>::iterator move = pm.move_operands()->begin();
move != pm.move_operands()->end(); ++move) {
@ -153,7 +153,7 @@ void PointerMap::RecordUntagged(InstructionOperand* op, Zone* zone) {
}
OStream& operator<<(OStream& os, const PointerMap& pm) {
std::ostream& operator<<(std::ostream& os, const PointerMap& pm) {
os << "{";
for (ZoneList<InstructionOperand*>::iterator op =
pm.pointer_operands_.begin();
@ -165,7 +165,7 @@ OStream& operator<<(OStream& os, const PointerMap& pm) {
}
OStream& operator<<(OStream& os, const ArchOpcode& ao) {
std::ostream& operator<<(std::ostream& os, const ArchOpcode& ao) {
switch (ao) {
#define CASE(Name) \
case k##Name: \
@ -178,7 +178,7 @@ OStream& operator<<(OStream& os, const ArchOpcode& ao) {
}
OStream& operator<<(OStream& os, const AddressingMode& am) {
std::ostream& operator<<(std::ostream& os, const AddressingMode& am) {
switch (am) {
case kMode_None:
return os;
@ -193,7 +193,7 @@ OStream& operator<<(OStream& os, const AddressingMode& am) {
}
OStream& operator<<(OStream& os, const FlagsMode& fm) {
std::ostream& operator<<(std::ostream& os, const FlagsMode& fm) {
switch (fm) {
case kFlags_none:
return os;
@ -207,7 +207,7 @@ OStream& operator<<(OStream& os, const FlagsMode& fm) {
}
OStream& operator<<(OStream& os, const FlagsCondition& fc) {
std::ostream& operator<<(std::ostream& os, const FlagsCondition& fc) {
switch (fc) {
case kEqual:
return os << "equal";
@ -251,7 +251,7 @@ OStream& operator<<(OStream& os, const FlagsCondition& fc) {
}
OStream& operator<<(OStream& os, const Instruction& instr) {
std::ostream& operator<<(std::ostream& os, const Instruction& instr) {
if (instr.OutputCount() > 1) os << "(";
for (size_t i = 0; i < instr.OutputCount(); i++) {
if (i > 0) os << ", ";
@ -295,7 +295,7 @@ OStream& operator<<(OStream& os, const Instruction& instr) {
}
OStream& operator<<(OStream& os, const Constant& constant) {
std::ostream& operator<<(std::ostream& os, const Constant& constant) {
switch (constant.type()) {
case Constant::kInt32:
return os << constant.ToInt32();
@ -415,7 +415,7 @@ int InstructionSequence::GetFrameStateDescriptorCount() {
}
OStream& operator<<(OStream& os, const InstructionSequence& code) {
std::ostream& operator<<(std::ostream& os, const InstructionSequence& code) {
for (size_t i = 0; i < code.immediates_.size(); ++i) {
Constant constant = code.immediates_[i];
os << "IMM#" << i << ": " << constant << "\n";

View File

@ -6,6 +6,7 @@
#define V8_COMPILER_INSTRUCTION_H_
#include <deque>
#include <iosfwd>
#include <map>
#include <set>
@ -21,10 +22,6 @@
namespace v8 {
namespace internal {
// Forward declarations.
class OStream;
namespace compiler {
// Forward declarations.
@ -91,7 +88,7 @@ class InstructionOperand : public ZoneObject {
typedef ZoneVector<InstructionOperand*> InstructionOperandVector;
OStream& operator<<(OStream& os, const InstructionOperand& op);
std::ostream& operator<<(std::ostream& os, const InstructionOperand& op);
class UnallocatedOperand : public InstructionOperand {
public:
@ -310,7 +307,7 @@ class MoveOperands FINAL {
InstructionOperand* destination_;
};
OStream& operator<<(OStream& os, const MoveOperands& mo);
std::ostream& operator<<(std::ostream& os, const MoveOperands& mo);
template <InstructionOperand::Kind kOperandKind, int kNumCachedOperands>
class SubKindOperand FINAL : public InstructionOperand {
@ -363,7 +360,7 @@ class ParallelMove FINAL : public ZoneObject {
ZoneList<MoveOperands> move_operands_;
};
OStream& operator<<(OStream& os, const ParallelMove& pm);
std::ostream& operator<<(std::ostream& os, const ParallelMove& pm);
class PointerMap FINAL : public ZoneObject {
public:
@ -391,14 +388,14 @@ class PointerMap FINAL : public ZoneObject {
void RecordUntagged(InstructionOperand* op, Zone* zone);
private:
friend OStream& operator<<(OStream& os, const PointerMap& pm);
friend std::ostream& operator<<(std::ostream& os, const PointerMap& pm);
ZoneList<InstructionOperand*> pointer_operands_;
ZoneList<InstructionOperand*> untagged_operands_;
int instruction_position_;
};
OStream& operator<<(OStream& os, const PointerMap& pm);
std::ostream& operator<<(std::ostream& os, const PointerMap& pm);
// TODO(titzer): s/PointerMap/ReferenceMap/
class Instruction : public ZoneObject {
@ -538,7 +535,7 @@ class Instruction : public ZoneObject {
InstructionOperand* operands_[1];
};
OStream& operator<<(OStream& os, const Instruction& instr);
std::ostream& operator<<(std::ostream& os, const Instruction& instr);
// Represents moves inserted before an instruction due to register allocation.
// TODO(titzer): squash GapInstruction back into Instruction, since essentially
@ -589,7 +586,7 @@ class GapInstruction : public Instruction {
}
private:
friend OStream& operator<<(OStream& os, const Instruction& instr);
friend std::ostream& operator<<(std::ostream& os, const Instruction& instr);
ParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
};
@ -792,7 +789,7 @@ class FrameStateDescriptor : public ZoneObject {
MaybeHandle<JSFunction> jsfunction_;
};
OStream& operator<<(OStream& os, const Constant& constant);
std::ostream& operator<<(std::ostream& os, const Constant& constant);
typedef ZoneDeque<Constant> ConstantDeque;
typedef std::map<int, Constant, std::less<int>,
@ -923,7 +920,8 @@ class InstructionSequence FINAL {
int GetFrameStateDescriptorCount();
private:
friend OStream& operator<<(OStream& os, const InstructionSequence& code);
friend std::ostream& operator<<(std::ostream& os,
const InstructionSequence& code);
typedef std::set<int, std::less<int>, ZoneIntAllocator> VirtualRegisterSet;
@ -941,7 +939,7 @@ class InstructionSequence FINAL {
DeoptimizationVector deoptimization_entries_;
};
OStream& operator<<(OStream& os, const InstructionSequence& code);
std::ostream& operator<<(std::ostream& os, const InstructionSequence& code);
} // namespace compiler
} // namespace internal

View File

@ -200,7 +200,7 @@ class JSOperatorBuilder {
// Specialization for static parameters of type {ContextAccess}.
template <>
struct StaticParameterTraits<ContextAccess> {
static OStream& PrintTo(OStream& os, ContextAccess val) { // NOLINT
static std::ostream& PrintTo(std::ostream& os, ContextAccess val) { // NOLINT
return os << val.depth() << "," << val.index()
<< (val.immutable() ? ",imm" : "");
}
@ -216,7 +216,8 @@ struct StaticParameterTraits<ContextAccess> {
// Specialization for static parameters of type {Runtime::FunctionId}.
template <>
struct StaticParameterTraits<Runtime::FunctionId> {
static OStream& PrintTo(OStream& os, Runtime::FunctionId val) { // NOLINT
static std::ostream& PrintTo(std::ostream& os,
Runtime::FunctionId val) { // NOLINT
const Runtime::Function* f = Runtime::FunctionForId(val);
return os << (f->name ? f->name : "?Runtime?");
}

View File

@ -15,7 +15,7 @@ namespace internal {
namespace compiler {
OStream& operator<<(OStream& os, const CallDescriptor::Kind& k) {
std::ostream& operator<<(std::ostream& os, const CallDescriptor::Kind& k) {
switch (k) {
case CallDescriptor::kCallCodeObject:
os << "Code";
@ -31,7 +31,7 @@ OStream& operator<<(OStream& os, const CallDescriptor::Kind& k) {
}
OStream& operator<<(OStream& os, const CallDescriptor& d) {
std::ostream& operator<<(std::ostream& os, const CallDescriptor& d) {
// TODO(svenpanne) Output properties etc. and be less cryptic.
return os << d.kind() << ":" << d.debug_name() << ":r" << d.ReturnCount()
<< "j" << d.JSParameterCount() << "i" << d.InputCount() << "f"

View File

@ -143,8 +143,8 @@ class CallDescriptor FINAL : public ZoneObject {
DEFINE_OPERATORS_FOR_FLAGS(CallDescriptor::Flags)
OStream& operator<<(OStream& os, const CallDescriptor& d);
OStream& operator<<(OStream& os, const CallDescriptor::Kind& k);
std::ostream& operator<<(std::ostream& os, const CallDescriptor& d);
std::ostream& operator<<(std::ostream& os, const CallDescriptor::Kind& k);
// Defines the linkage for a compilation, including the calling conventions
// for incoming parameters and return value(s) as well as the outgoing calling

View File

@ -12,20 +12,6 @@ namespace compiler {
#if GTEST_HAS_COMBINE
// TODO(bmeurer): Find a new home for these.
inline std::ostream& operator<<(std::ostream& os, const MachineType& type) {
OStringStream ost;
ost << type;
return os << ost.c_str();
}
inline std::ostream& operator<<(std::ostream& os,
const WriteBarrierKind& write_barrier_kind) {
OStringStream ost;
ost << write_barrier_kind;
return os << ost.c_str();
}
template <typename T>
class MachineOperatorTestWithParam
: public ::testing::TestWithParam< ::testing::tuple<MachineType, T> > {

View File

@ -12,7 +12,8 @@ namespace v8 {
namespace internal {
namespace compiler {
OStream& operator<<(OStream& os, const WriteBarrierKind& write_barrier_kind) {
std::ostream& operator<<(std::ostream& os,
const WriteBarrierKind& write_barrier_kind) {
switch (write_barrier_kind) {
case kNoWriteBarrier:
return os << "NoWriteBarrier";
@ -24,7 +25,7 @@ OStream& operator<<(OStream& os, const WriteBarrierKind& write_barrier_kind) {
}
OStream& operator<<(OStream& os, const StoreRepresentation& rep) {
std::ostream& operator<<(std::ostream& os, const StoreRepresentation& rep) {
return os << "(" << rep.machine_type() << " : " << rep.write_barrier_kind()
<< ")";
}
@ -32,7 +33,8 @@ OStream& operator<<(OStream& os, const StoreRepresentation& rep) {
template <>
struct StaticParameterTraits<StoreRepresentation> {
static OStream& PrintTo(OStream& os, const StoreRepresentation& rep) {
static std::ostream& PrintTo(std::ostream& os,
const StoreRepresentation& rep) {
return os << rep;
}
static int HashCode(const StoreRepresentation& rep) {
@ -47,7 +49,8 @@ struct StaticParameterTraits<StoreRepresentation> {
template <>
struct StaticParameterTraits<LoadRepresentation> {
static OStream& PrintTo(OStream& os, LoadRepresentation type) { // NOLINT
static std::ostream& PrintTo(std::ostream& os,
LoadRepresentation type) { // NOLINT
return os << type;
}
static int HashCode(LoadRepresentation type) { return type; }

View File

@ -19,7 +19,8 @@ class Operator;
// Supported write barrier modes.
enum WriteBarrierKind { kNoWriteBarrier, kFullWriteBarrier };
OStream& operator<<(OStream& os, const WriteBarrierKind& write_barrier_kind);
std::ostream& operator<<(std::ostream& os,
const WriteBarrierKind& write_barrier_kind);
typedef MachineType LoadRepresentation;
@ -52,7 +53,7 @@ inline bool operator!=(const StoreRepresentation& rep1,
return !(rep1 == rep2);
}
OStream& operator<<(OStream& os, const StoreRepresentation& rep);
std::ostream& operator<<(std::ostream& os, const StoreRepresentation& rep);
// Interface for building machine-level operators. These operators are

View File

@ -17,7 +17,7 @@ namespace compiler {
}
OStream& operator<<(OStream& os, const MachineType& type) {
std::ostream& operator<<(std::ostream& os, const MachineType& type) {
bool before = false;
PRINT(kRepBit);
PRINT(kRepWord8);

View File

@ -5,15 +5,14 @@
#ifndef V8_COMPILER_MACHINE_TYPE_H_
#define V8_COMPILER_MACHINE_TYPE_H_
#include <iosfwd>
#include "src/base/bits.h"
#include "src/globals.h"
#include "src/zone.h"
namespace v8 {
namespace internal {
class OStream;
namespace compiler {
// Machine-level types and representations.
@ -54,7 +53,7 @@ enum MachineType {
kMachAnyTagged = kRepTagged | kTypeAny
};
OStream& operator<<(OStream& os, const MachineType& type);
std::ostream& operator<<(std::ostream& os, const MachineType& type);
typedef uint16_t MachineTypeUnion;

View File

@ -42,10 +42,12 @@ Node* Node::FindProjection(size_t projection_index) {
}
OStream& operator<<(OStream& os, const Operator& op) { return op.PrintTo(os); }
std::ostream& operator<<(std::ostream& os, const Operator& op) {
return op.PrintTo(os);
}
OStream& operator<<(OStream& os, const Node& n) {
std::ostream& operator<<(std::ostream& os, const Node& n) {
os << n.id() << ": " << *n.op();
if (n.op()->InputCount() != 0) {
os << "(";

View File

@ -61,7 +61,7 @@ class Node FINAL : public GenericNode<NodeData, Node> {
Node* FindProjection(size_t projection_index);
};
OStream& operator<<(OStream& os, const Node& n);
std::ostream& operator<<(std::ostream& os, const Node& n);
typedef GenericGraphVisit::NullNodeVisitor<NodeData, Node> NullNodeVisitor;

View File

@ -87,8 +87,8 @@ class Operator : public ZoneObject {
protected:
// Print the full operator into the given stream, including any
// static parameters. Useful for debugging and visualizing the IR.
virtual OStream& PrintTo(OStream& os) const = 0; // NOLINT
friend OStream& operator<<(OStream& os, const Operator& op);
virtual std::ostream& PrintTo(std::ostream& os) const = 0; // NOLINT
friend std::ostream& operator<<(std::ostream& os, const Operator& op);
private:
Opcode opcode_;
@ -100,7 +100,7 @@ class Operator : public ZoneObject {
DEFINE_OPERATORS_FOR_FLAGS(Operator::Properties)
OStream& operator<<(OStream& os, const Operator& op);
std::ostream& operator<<(std::ostream& os, const Operator& op);
// An implementation of Operator that has no static parameters. Such operators
// have just a name, an opcode, and a fixed number of inputs and outputs.
@ -119,7 +119,7 @@ class SimpleOperator : public Operator {
virtual int OutputCount() const FINAL { return output_count_; }
private:
virtual OStream& PrintTo(OStream& os) const FINAL { // NOLINT
virtual std::ostream& PrintTo(std::ostream& os) const FINAL { // NOLINT
return os << mnemonic();
}
@ -133,7 +133,7 @@ class SimpleOperator : public Operator {
// static parameters of Operator1 automatically.
template <typename T>
struct StaticParameterTraits {
static OStream& PrintTo(OStream& os, T val) { // NOLINT
static std::ostream& PrintTo(std::ostream& os, T val) { // NOLINT
return os << "??";
}
static int HashCode(T a) { return 0; }
@ -145,7 +145,7 @@ struct StaticParameterTraits {
// Specialization for static parameters of type {int}.
template <>
struct StaticParameterTraits<int> {
static OStream& PrintTo(OStream& os, int val) { // NOLINT
static std::ostream& PrintTo(std::ostream& os, int val) { // NOLINT
return os << val;
}
static int HashCode(int a) { return a; }
@ -155,7 +155,7 @@ struct StaticParameterTraits<int> {
// Specialization for static parameters of type {double}.
template <>
struct StaticParameterTraits<double> {
static OStream& PrintTo(OStream& os, double val) { // NOLINT
static std::ostream& PrintTo(std::ostream& os, double val) { // NOLINT
return os << val;
}
static int HashCode(double a) {
@ -169,7 +169,8 @@ struct StaticParameterTraits<double> {
// Specialization for static parameters of type {Unique<Object>}.
template <>
struct StaticParameterTraits<Unique<Object> > {
static OStream& PrintTo(OStream& os, Unique<Object> val) { // NOLINT
static std::ostream& PrintTo(std::ostream& os,
Unique<Object> val) { // NOLINT
return os << Brief(*val.handle());
}
static int HashCode(Unique<Object> a) {
@ -181,7 +182,7 @@ struct StaticParameterTraits<Unique<Object> > {
// Specialization for static parameters of type {Unique<Name>}.
template <>
struct StaticParameterTraits<Unique<Name> > {
static OStream& PrintTo(OStream& os, Unique<Name> val) { // NOLINT
static std::ostream& PrintTo(std::ostream& os, Unique<Name> val) { // NOLINT
return os << Brief(*val.handle());
}
static int HashCode(Unique<Name> a) { return static_cast<int>(a.Hashcode()); }
@ -193,7 +194,8 @@ struct StaticParameterTraits<Unique<Name> > {
// direct usage of Handles in constants.
template <>
struct StaticParameterTraits<Handle<Object> > {
static OStream& PrintTo(OStream& os, Handle<Object> val) { // NOLINT
static std::ostream& PrintTo(std::ostream& os,
Handle<Object> val) { // NOLINT
UNREACHABLE(); // Should use Unique<Object> instead
return os;
}
@ -233,12 +235,12 @@ class Operator1 : public Operator {
}
virtual int InputCount() const OVERRIDE { return input_count_; }
virtual int OutputCount() const OVERRIDE { return output_count_; }
virtual OStream& PrintParameter(OStream& os) const { // NOLINT
virtual std::ostream& PrintParameter(std::ostream& os) const { // NOLINT
return StaticParameterTraits<T>::PrintTo(os << "[", parameter_) << "]";
}
protected:
virtual OStream& PrintTo(OStream& os) const FINAL { // NOLINT
virtual std::ostream& PrintTo(std::ostream& os) const FINAL { // NOLINT
return PrintParameter(os << mnemonic());
}

View File

@ -4,6 +4,8 @@
#include "src/compiler/pipeline.h"
#include <sstream>
#include "src/base/platform/elapsed-timer.h"
#include "src/compiler/ast-graph-builder.h"
#include "src/compiler/basic-block-instrumentor.h"
@ -182,7 +184,7 @@ Handle<Code> Pipeline::GenerateCode() {
os << "---------------------------------------------------\n"
<< "Begin compiling method "
<< info()->function()->debug_name()->ToCString().get()
<< " using Turbofan" << endl;
<< " using Turbofan" << std::endl;
}
// Build the graph.
@ -337,7 +339,7 @@ Handle<Code> Pipeline::GenerateCode() {
os << "--------------------------------------------------\n"
<< "Finished compiling method "
<< info()->function()->debug_name()->ToCString().get()
<< " using Turbofan" << endl;
<< " using Turbofan" << std::endl;
}
return code;
@ -428,7 +430,7 @@ Handle<Code> Pipeline::GenerateCode(Linkage* linkage, Graph* graph,
Handle<Code> code = generator.GenerateCode();
if (profiler_data != NULL) {
#if ENABLE_DISASSEMBLER
OStringStream os;
std::ostringstream os;
code->Disassemble(NULL, os);
profiler_data->SetCode(&os);
#endif

View File

@ -5,6 +5,8 @@
#ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_
#define V8_COMPILER_REPRESENTATION_CHANGE_H_
#include <sstream>
#include "src/base/bits.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/machine-operator.h"
@ -399,17 +401,17 @@ class RepresentationChanger {
MachineTypeUnion use) {
type_error_ = true;
if (!testing_type_errors_) {
OStringStream out_str;
std::ostringstream out_str;
out_str << static_cast<MachineType>(output_type);
OStringStream use_str;
std::ostringstream use_str;
use_str << static_cast<MachineType>(use);
V8_Fatal(__FILE__, __LINE__,
"RepresentationChangerError: node #%d:%s of "
"%s cannot be changed to %s",
node->id(), node->op()->mnemonic(), out_str.c_str(),
use_str.c_str());
node->id(), node->op()->mnemonic(), out_str.str().c_str(),
use_str.str().c_str());
}
return node;
}

View File

@ -12,7 +12,6 @@ namespace v8 {
namespace internal {
namespace compiler {
BasicBlock::BasicBlock(Zone* zone, Id id)
: rpo_number_(-1),
dominator_(NULL),
@ -110,7 +109,7 @@ size_t BasicBlock::PredecessorIndexOf(BasicBlock* predecessor) {
}
OStream& operator<<(OStream& os, const BasicBlock::Control& c) {
std::ostream& operator<<(std::ostream& os, const BasicBlock::Control& c) {
switch (c) {
case BasicBlock::kNone:
return os << "none";
@ -128,7 +127,7 @@ OStream& operator<<(OStream& os, const BasicBlock::Control& c) {
}
OStream& operator<<(OStream& os, const BasicBlock::Id& id) {
std::ostream& operator<<(std::ostream& os, const BasicBlock::Id& id) {
return os << id.ToSize();
}
@ -267,7 +266,7 @@ void Schedule::SetBlockForNode(BasicBlock* block, Node* node) {
}
OStream& operator<<(OStream& os, const Schedule& s) {
std::ostream& operator<<(std::ostream& os, const Schedule& s) {
// TODO(svenpanne) Const-correct the RPO stuff/iterators.
BasicBlockVector* rpo = const_cast<Schedule*>(&s)->rpo_order();
for (BasicBlockVectorIter i = rpo->begin(); i != rpo->end(); ++i) {
@ -318,6 +317,7 @@ OStream& operator<<(OStream& os, const Schedule& s) {
}
return os;
}
} // namespace compiler
} // namespace internal
} // namespace v8

View File

@ -5,6 +5,7 @@
#ifndef V8_COMPILER_SCHEDULE_H_
#define V8_COMPILER_SCHEDULE_H_
#include <iosfwd>
#include <vector>
#include "src/v8.h"
@ -164,8 +165,8 @@ class BasicBlock FINAL : public ZoneObject {
DISALLOW_COPY_AND_ASSIGN(BasicBlock);
};
OStream& operator<<(OStream& os, const BasicBlock::Control& c);
OStream& operator<<(OStream& os, const BasicBlock::Id& id);
std::ostream& operator<<(std::ostream& os, const BasicBlock::Control& c);
std::ostream& operator<<(std::ostream& os, const BasicBlock::Id& id);
typedef ZoneVector<BasicBlock*> BasicBlockVector;
typedef BasicBlockVector::iterator BasicBlockVectorIter;
@ -240,9 +241,10 @@ class Schedule FINAL : public ZoneObject {
BasicBlock* end_;
};
OStream& operator<<(OStream& os, const Schedule& s);
}
}
} // namespace v8::internal::compiler
std::ostream& operator<<(std::ostream& os, const Schedule& s);
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_SCHEDULE_H_

View File

@ -11,14 +11,6 @@ namespace v8 {
namespace internal {
namespace compiler {
// TODO(bmeurer): Drop once we use std::ostream instead of our OStream.
inline std::ostream& operator<<(std::ostream& os, const ElementAccess& access) {
OStringStream ost;
ost << access;
return os << ost.c_str();
}
// -----------------------------------------------------------------------------
// Pure operators.

View File

@ -13,7 +13,7 @@ namespace v8 {
namespace internal {
namespace compiler {
OStream& operator<<(OStream& os, BaseTaggedness base_taggedness) {
std::ostream& operator<<(std::ostream& os, BaseTaggedness base_taggedness) {
switch (base_taggedness) {
case kUntaggedBase:
return os << "untagged base";
@ -37,7 +37,7 @@ bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs) {
}
OStream& operator<<(OStream& os, ElementAccess const& access) {
std::ostream& operator<<(std::ostream& os, ElementAccess const& access) {
os << "[" << access.base_is_tagged << ", " << access.header_size << ", ";
access.type->PrintTo(os);
os << ", " << access.machine_type << "]";
@ -64,7 +64,7 @@ const ElementAccess& ElementAccessOf(const Operator* op) {
// Specialization for static parameters of type {FieldAccess}.
template <>
struct StaticParameterTraits<FieldAccess> {
static OStream& PrintTo(OStream& os, const FieldAccess& val) {
static std::ostream& PrintTo(std::ostream& os, const FieldAccess& val) {
return os << val.offset;
}
static int HashCode(const FieldAccess& val) {
@ -81,7 +81,7 @@ struct StaticParameterTraits<FieldAccess> {
// Specialization for static parameters of type {ElementAccess}.
template <>
struct StaticParameterTraits<ElementAccess> {
static OStream& PrintTo(OStream& os, const ElementAccess& access) {
static std::ostream& PrintTo(std::ostream& os, const ElementAccess& access) {
return os << access;
}
static int HashCode(const ElementAccess& access) {

View File

@ -28,7 +28,7 @@ struct SimplifiedOperatorBuilderImpl;
enum BaseTaggedness { kUntaggedBase, kTaggedBase };
OStream& operator<<(OStream&, BaseTaggedness);
std::ostream& operator<<(std::ostream&, BaseTaggedness);
// An access descriptor for loads/stores of fixed structures like field
// accesses of heap objects. Accesses from either tagged or untagged base
@ -60,7 +60,7 @@ struct ElementAccess {
bool operator==(ElementAccess const& lhs, ElementAccess const& rhs);
bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs);
OStream& operator<<(OStream&, ElementAccess const&);
std::ostream& operator<<(std::ostream&, ElementAccess const&);
// If the accessed object is not a heap object, add this to the header_size.

View File

@ -117,9 +117,7 @@ struct MemoryAccess {
std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) {
OStringStream ost;
ost << memacc.type;
return os << ost.c_str();
return os << memacc.type;
}
@ -312,9 +310,7 @@ struct MultParam {
std::ostream& operator<<(std::ostream& os, const MultParam& m) {
OStringStream ost;
ost << m.value << "." << m.lea_expected << "." << m.addressing_mode;
return os << ost.c_str();
return os << m.value << "." << m.lea_expected << "." << m.addressing_mode;
}

View File

@ -719,7 +719,7 @@ int Deoptimizer::GetOutputInfo(DeoptimizationOutputData* data,
OFStream os(stderr);
os << "[couldn't find pc offset for node=" << id.ToInt() << "]\n"
<< "[method: " << shared->DebugName()->ToCString().get() << "]\n"
<< "[source:\n" << SourceCodeOf(shared) << "\n]" << endl;
<< "[source:\n" << SourceCodeOf(shared) << "\n]" << std::endl;
FATAL("unable to find pc offset during deoptimization");
return -1;

View File

@ -59,8 +59,8 @@ const char* V8NameConverter::NameInCode(byte* addr) const {
}
static void DumpBuffer(OStream* os, StringBuilder* out) {
(*os) << out->Finalize() << endl;
static void DumpBuffer(std::ostream* os, StringBuilder* out) {
(*os) << out->Finalize() << std::endl;
out->Reset();
}
@ -68,7 +68,7 @@ static void DumpBuffer(OStream* os, StringBuilder* out) {
static const int kOutBufferSize = 2048 + String::kMaxShortPrintLength;
static const int kRelocInfoPosition = 57;
static int DecodeIt(Isolate* isolate, OStream* os,
static int DecodeIt(Isolate* isolate, std::ostream* os,
const V8NameConverter& converter, byte* begin, byte* end) {
SealHandleScope shs(isolate);
DisallowHeapAllocation no_alloc;
@ -275,16 +275,16 @@ static int DecodeIt(Isolate* isolate, OStream* os,
}
int Disassembler::Decode(Isolate* isolate, OStream* os, byte* begin, byte* end,
Code* code) {
int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin,
byte* end, Code* code) {
V8NameConverter v8NameConverter(code);
return DecodeIt(isolate, os, v8NameConverter, begin, end);
}
#else // ENABLE_DISASSEMBLER
int Disassembler::Decode(Isolate* isolate, OStream* os, byte* begin, byte* end,
Code* code) {
int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin,
byte* end, Code* code) {
return 0;
}

View File

@ -16,7 +16,7 @@ class Disassembler : public AllStatic {
// code into os. Returns the number of bytes disassembled or 1 if no
// instruction could be decoded.
// the code object is used for name resolution and may be null.
static int Decode(Isolate* isolate, OStream* os, byte* begin, byte* end,
static int Decode(Isolate* isolate, std::ostream* os, byte* begin, byte* end,
Code* code = NULL);
};

View File

@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <ctype.h>
#include <stdlib.h>
#include <cctype>
#include <cstdlib>
#include <sstream>
#include "src/v8.h"
@ -181,7 +182,7 @@ static const char* Type2String(Flag::FlagType type) {
}
OStream& operator<<(OStream& os, const Flag& flag) { // NOLINT
std::ostream& operator<<(std::ostream& os, const Flag& flag) { // NOLINT
switch (flag.type()) {
case Flag::TYPE_BOOL:
os << (*flag.bool_variable() ? "true" : "false");
@ -231,21 +232,21 @@ List<const char*>* FlagList::argv() {
}
{
bool disabled = f->type() == Flag::TYPE_BOOL && !*f->bool_variable();
OStringStream os;
std::ostringstream os;
os << (disabled ? "--no" : "--") << f->name();
args->Add(StrDup(os.c_str()));
args->Add(StrDup(os.str().c_str()));
}
if (f->type() != Flag::TYPE_BOOL) {
OStringStream os;
std::ostringstream os;
os << *f;
args->Add(StrDup(os.c_str()));
args->Add(StrDup(os.str().c_str()));
}
}
}
if (args_flag != NULL) {
OStringStream os;
std::ostringstream os;
os << "--" << args_flag->name();
args->Add(StrDup(os.c_str()));
args->Add(StrDup(os.str().c_str()));
JSArguments jsargs = *args_flag->args_variable();
for (int j = 0; j < jsargs.argc; j++) {
args->Add(StrDup(jsargs[j]));

View File

@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/frames.h"
#include <sstream>
#include "src/v8.h"
#include "src/ast.h"
@ -1288,12 +1292,12 @@ void JavaScriptFrame::Print(StringStream* accumulator,
// Print details about the function.
if (FLAG_max_stack_trace_source_length != 0 && code != NULL) {
OStringStream os;
std::ostringstream os;
SharedFunctionInfo* shared = function->shared();
os << "--------- s o u r c e c o d e ---------\n"
<< SourceCodeOf(shared, FLAG_max_stack_trace_source_length)
<< "\n-----------------------------------------\n";
accumulator->Add(os.c_str());
accumulator->Add(os.str().c_str());
}
accumulator->Add("}\n\n");

View File

@ -1842,7 +1842,7 @@ extern "C" {
void __gdb_print_v8_object(Object* object) {
OFStream os(stdout);
object->Print(os);
os << flush;
os << std::flush;
}
#endif
}

View File

@ -39,7 +39,7 @@ void HDeadCodeEliminationPhase::PrintLive(HValue* ref, HValue* instr) {
} else {
os << "root ";
}
os << " -> " << *instr << "]" << endl;
os << " -> " << *instr << "]" << std::endl;
}

View File

@ -400,7 +400,7 @@ SideEffects SideEffectsTracker::ComputeDependsOn(HInstruction* instr) {
}
OStream& operator<<(OStream& os, const TrackedEffects& te) {
std::ostream& operator<<(std::ostream& os, const TrackedEffects& te) {
SideEffectsTracker* t = te.tracker;
const char* separator = "";
os << "[";
@ -450,7 +450,7 @@ bool SideEffectsTracker::ComputeGlobalVar(Unique<Cell> cell, int* index) {
if (FLAG_trace_gvn) {
OFStream os(stdout);
os << "Tracking global var [" << *cell.handle() << "] "
<< "(mapped to index " << num_global_vars_ << ")" << endl;
<< "(mapped to index " << num_global_vars_ << ")" << std::endl;
}
*index = num_global_vars_;
global_vars_[num_global_vars_++] = cell;
@ -472,7 +472,7 @@ bool SideEffectsTracker::ComputeInobjectField(HObjectAccess access,
if (FLAG_trace_gvn) {
OFStream os(stdout);
os << "Tracking inobject field access " << access << " (mapped to index "
<< num_inobject_fields_ << ")" << endl;
<< num_inobject_fields_ << ")" << std::endl;
}
*index = num_inobject_fields_;
inobject_fields_[num_inobject_fields_++] = access;
@ -567,7 +567,7 @@ void HGlobalValueNumberingPhase::LoopInvariantCodeMotion() {
if (FLAG_trace_gvn) {
OFStream os(stdout);
os << "Try loop invariant motion for " << *block << " changes "
<< Print(side_effects) << endl;
<< Print(side_effects) << std::endl;
}
HBasicBlock* last = block->loop_information()->GetLastBackEdge();
for (int j = block->block_id(); j <= last->block_id(); ++j) {
@ -586,7 +586,7 @@ void HGlobalValueNumberingPhase::ProcessLoopBlock(
if (FLAG_trace_gvn) {
OFStream os(stdout);
os << "Loop invariant code motion for " << *block << " depends on "
<< Print(loop_kills) << endl;
<< Print(loop_kills) << std::endl;
}
HInstruction* instr = block->first();
while (instr != NULL) {
@ -599,7 +599,7 @@ void HGlobalValueNumberingPhase::ProcessLoopBlock(
os << "Checking instruction i" << instr->id() << " ("
<< instr->Mnemonic() << ") changes " << Print(changes)
<< ", depends on " << Print(depends_on) << ". Loop changes "
<< Print(loop_kills) << endl;
<< Print(loop_kills) << std::endl;
}
bool can_hoist = !depends_on.ContainsAnyOf(loop_kills);
if (can_hoist && !graph()->use_optimistic_licm()) {
@ -836,7 +836,7 @@ void HGlobalValueNumberingPhase::AnalyzeGraph() {
if (FLAG_trace_gvn) {
OFStream os(stdout);
os << "Instruction i" << instr->id() << " changes " << Print(changes)
<< endl;
<< std::endl;
}
}
if (instr->CheckFlag(HValue::kUseGVN) &&

View File

@ -5,6 +5,8 @@
#ifndef V8_HYDROGEN_GVN_H_
#define V8_HYDROGEN_GVN_H_
#include <iosfwd>
#include "src/compiler.h"
#include "src/hydrogen.h"
#include "src/hydrogen-instructions.h"
@ -13,8 +15,6 @@
namespace v8 {
namespace internal {
class OStream;
// This class extends GVNFlagSet with additional "special" dynamic side effects,
// which can be used to represent side effects that cannot be expressed using
// the GVNFlags of an HInstruction. These special side effects are tracked by a
@ -70,7 +70,7 @@ class SideEffectsTracker FINAL BASE_EMBEDDED {
SideEffects ComputeDependsOn(HInstruction* instr);
private:
friend OStream& operator<<(OStream& os, const TrackedEffects& f);
friend std::ostream& operator<<(std::ostream& os, const TrackedEffects& f);
bool ComputeGlobalVar(Unique<Cell> cell, int* index);
bool ComputeInobjectField(HObjectAccess access, int* index);
@ -107,7 +107,7 @@ struct TrackedEffects {
};
OStream& operator<<(OStream& os, const TrackedEffects& f);
std::ostream& operator<<(std::ostream& os, const TrackedEffects& f);
// Perform common subexpression elimination and loop-invariant code motion.

View File

@ -528,10 +528,12 @@ void HValue::SetBlock(HBasicBlock* block) {
}
OStream& operator<<(OStream& os, const HValue& v) { return v.PrintTo(os); }
std::ostream& operator<<(std::ostream& os, const HValue& v) {
return v.PrintTo(os);
}
OStream& operator<<(OStream& os, const TypeOf& t) {
std::ostream& operator<<(std::ostream& os, const TypeOf& t) {
if (t.value->representation().IsTagged() &&
!t.value->type().Equals(HType::Tagged()))
return os;
@ -539,7 +541,7 @@ OStream& operator<<(OStream& os, const TypeOf& t) {
}
OStream& operator<<(OStream& os, const ChangesOf& c) {
std::ostream& operator<<(std::ostream& os, const ChangesOf& c) {
GVNFlagSet changes_flags = c.value->ChangesFlags();
if (changes_flags.IsEmpty()) return os;
os << " changes[";
@ -618,7 +620,7 @@ void HValue::ComputeInitialRange(Zone* zone) {
}
OStream& operator<<(OStream& os, const HSourcePosition& p) {
std::ostream& operator<<(std::ostream& os, const HSourcePosition& p) {
if (p.IsUnknown()) {
return os << "<?>";
} else if (FLAG_hydrogen_track_positions) {
@ -629,7 +631,7 @@ OStream& operator<<(OStream& os, const HSourcePosition& p) {
}
OStream& HInstruction::PrintTo(OStream& os) const { // NOLINT
std::ostream& HInstruction::PrintTo(std::ostream& os) const { // NOLINT
os << Mnemonic() << " ";
PrintDataTo(os) << ChangesOf(this) << TypeOf(this);
if (CheckFlag(HValue::kHasNoObservableSideEffects)) os << " [noOSE]";
@ -638,7 +640,7 @@ OStream& HInstruction::PrintTo(OStream& os) const { // NOLINT
}
OStream& HInstruction::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HInstruction::PrintDataTo(std::ostream& os) const { // NOLINT
for (int i = 0; i < OperandCount(); ++i) {
if (i > 0) os << " ";
os << NameOf(OperandAt(i));
@ -912,27 +914,28 @@ bool HInstruction::CanDeoptimize() {
}
OStream& operator<<(OStream& os, const NameOf& v) {
std::ostream& operator<<(std::ostream& os, const NameOf& v) {
return os << v.value->representation().Mnemonic() << v.value->id();
}
OStream& HDummyUse::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HDummyUse::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(value());
}
OStream& HEnvironmentMarker::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HEnvironmentMarker::PrintDataTo(
std::ostream& os) const { // NOLINT
return os << (kind() == BIND ? "bind" : "lookup") << " var[" << index()
<< "]";
}
OStream& HUnaryCall::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HUnaryCall::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(value()) << " #" << argument_count();
}
OStream& HCallJSFunction::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCallJSFunction::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(function()) << " #" << argument_count();
}
@ -959,7 +962,7 @@ HCallJSFunction* HCallJSFunction::New(
}
OStream& HBinaryCall::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HBinaryCall::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(first()) << " " << NameOf(second()) << " #"
<< argument_count();
}
@ -1015,7 +1018,7 @@ void HBoundsCheck::ApplyIndexChange() {
}
OStream& HBoundsCheck::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HBoundsCheck::PrintDataTo(std::ostream& os) const { // NOLINT
os << NameOf(index()) << " " << NameOf(length());
if (base() != NULL && (offset() != 0 || scale() != 0)) {
os << " base: ((";
@ -1070,15 +1073,16 @@ Range* HBoundsCheck::InferRange(Zone* zone) {
}
OStream& HBoundsCheckBaseIndexInformation::PrintDataTo(
OStream& os) const { // NOLINT
std::ostream& HBoundsCheckBaseIndexInformation::PrintDataTo(
std::ostream& os) const { // NOLINT
// TODO(svenpanne) This 2nd base_index() looks wrong...
return os << "base: " << NameOf(base_index())
<< ", check: " << NameOf(base_index());
}
OStream& HCallWithDescriptor::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCallWithDescriptor::PrintDataTo(
std::ostream& os) const { // NOLINT
for (int i = 0; i < OperandCount(); i++) {
os << NameOf(OperandAt(i)) << " ";
}
@ -1086,42 +1090,46 @@ OStream& HCallWithDescriptor::PrintDataTo(OStream& os) const { // NOLINT
}
OStream& HCallNewArray::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCallNewArray::PrintDataTo(std::ostream& os) const { // NOLINT
os << ElementsKindToString(elements_kind()) << " ";
return HBinaryCall::PrintDataTo(os);
}
OStream& HCallRuntime::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCallRuntime::PrintDataTo(std::ostream& os) const { // NOLINT
os << name()->ToCString().get() << " ";
if (save_doubles() == kSaveFPRegs) os << "[save doubles] ";
return os << "#" << argument_count();
}
OStream& HClassOfTestAndBranch::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HClassOfTestAndBranch::PrintDataTo(
std::ostream& os) const { // NOLINT
return os << "class_of_test(" << NameOf(value()) << ", \""
<< class_name()->ToCString().get() << "\")";
}
OStream& HWrapReceiver::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HWrapReceiver::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(receiver()) << " " << NameOf(function());
}
OStream& HAccessArgumentsAt::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HAccessArgumentsAt::PrintDataTo(
std::ostream& os) const { // NOLINT
return os << NameOf(arguments()) << "[" << NameOf(index()) << "], length "
<< NameOf(length());
}
OStream& HAllocateBlockContext::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HAllocateBlockContext::PrintDataTo(
std::ostream& os) const { // NOLINT
return os << NameOf(context()) << " " << NameOf(function());
}
OStream& HControlInstruction::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HControlInstruction::PrintDataTo(
std::ostream& os) const { // NOLINT
os << " goto (";
bool first_block = true;
for (HSuccessorIterator it(this); !it.Done(); it.Advance()) {
@ -1133,13 +1141,14 @@ OStream& HControlInstruction::PrintDataTo(OStream& os) const { // NOLINT
}
OStream& HUnaryControlInstruction::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HUnaryControlInstruction::PrintDataTo(
std::ostream& os) const { // NOLINT
os << NameOf(value());
return HControlInstruction::PrintDataTo(os);
}
OStream& HReturn::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HReturn::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(value()) << " (pop " << NameOf(parameter_count())
<< " values)";
}
@ -1185,13 +1194,13 @@ bool HBranch::KnownSuccessorBlock(HBasicBlock** block) {
}
OStream& HBranch::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HBranch::PrintDataTo(std::ostream& os) const { // NOLINT
return HUnaryControlInstruction::PrintDataTo(os) << " "
<< expected_input_types();
}
OStream& HCompareMap::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCompareMap::PrintDataTo(std::ostream& os) const { // NOLINT
os << NameOf(value()) << " (" << *map().handle() << ")";
HControlInstruction::PrintDataTo(os);
if (known_successor_index() == 0) {
@ -1255,17 +1264,19 @@ Range* HUnaryMathOperation::InferRange(Zone* zone) {
}
OStream& HUnaryMathOperation::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HUnaryMathOperation::PrintDataTo(
std::ostream& os) const { // NOLINT
return os << OpName() << " " << NameOf(value());
}
OStream& HUnaryOperation::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HUnaryOperation::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(value());
}
OStream& HHasInstanceTypeAndBranch::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HHasInstanceTypeAndBranch::PrintDataTo(
std::ostream& os) const { // NOLINT
os << NameOf(value());
switch (from_) {
case FIRST_JS_RECEIVER_TYPE:
@ -1287,7 +1298,8 @@ OStream& HHasInstanceTypeAndBranch::PrintDataTo(OStream& os) const { // NOLINT
}
OStream& HTypeofIsAndBranch::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HTypeofIsAndBranch::PrintDataTo(
std::ostream& os) const { // NOLINT
os << NameOf(value()) << " == " << type_literal()->ToCString().get();
return HControlInstruction::PrintDataTo(os);
}
@ -1340,7 +1352,7 @@ bool HTypeofIsAndBranch::KnownSuccessorBlock(HBasicBlock** block) {
}
OStream& HCheckMapValue::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCheckMapValue::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(value()) << " " << NameOf(map());
}
@ -1356,18 +1368,19 @@ HValue* HCheckMapValue::Canonicalize() {
}
OStream& HForInPrepareMap::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HForInPrepareMap::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(enumerable());
}
OStream& HForInCacheArray::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HForInCacheArray::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(enumerable()) << " " << NameOf(map()) << "[" << idx_
<< "]";
}
OStream& HLoadFieldByIndex::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HLoadFieldByIndex::PrintDataTo(
std::ostream& os) const { // NOLINT
return os << NameOf(object()) << " " << NameOf(index());
}
@ -1504,7 +1517,7 @@ HValue* HWrapReceiver::Canonicalize() {
}
OStream& HTypeof::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HTypeof::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(value());
}
@ -1520,12 +1533,13 @@ HInstruction* HForceRepresentation::New(Zone* zone, HValue* context,
}
OStream& HForceRepresentation::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HForceRepresentation::PrintDataTo(
std::ostream& os) const { // NOLINT
return os << representation().Mnemonic() << " " << NameOf(value());
}
OStream& HChange::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HChange::PrintDataTo(std::ostream& os) const { // NOLINT
HUnaryOperation::PrintDataTo(os);
os << " " << from().Mnemonic() << " to " << to().Mnemonic();
@ -1637,7 +1651,7 @@ void HCheckInstanceType::GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag) {
}
OStream& HCheckMaps::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCheckMaps::PrintDataTo(std::ostream& os) const { // NOLINT
os << NameOf(value()) << " [" << *maps()->at(0).handle();
for (int i = 1; i < maps()->size(); ++i) {
os << "," << *maps()->at(i).handle();
@ -1668,7 +1682,7 @@ HValue* HCheckMaps::Canonicalize() {
}
OStream& HCheckValue::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCheckValue::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(value()) << " " << Brief(*object().handle());
}
@ -1691,20 +1705,21 @@ const char* HCheckInstanceType::GetCheckName() const {
}
OStream& HCheckInstanceType::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCheckInstanceType::PrintDataTo(
std::ostream& os) const { // NOLINT
os << GetCheckName() << " ";
return HUnaryOperation::PrintDataTo(os);
}
OStream& HCallStub::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCallStub::PrintDataTo(std::ostream& os) const { // NOLINT
os << CodeStub::MajorName(major_key_, false) << " ";
return HUnaryCall::PrintDataTo(os);
}
OStream& HTailCallThroughMegamorphicCache::PrintDataTo(
OStream& os) const { // NOLINT
std::ostream& HTailCallThroughMegamorphicCache::PrintDataTo(
std::ostream& os) const { // NOLINT
for (int i = 0; i < OperandCount(); i++) {
os << NameOf(OperandAt(i)) << " ";
}
@ -1712,7 +1727,7 @@ OStream& HTailCallThroughMegamorphicCache::PrintDataTo(
}
OStream& HUnknownOSRValue::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HUnknownOSRValue::PrintDataTo(std::ostream& os) const { // NOLINT
const char* type = "expression";
if (environment_->is_local_index(index_)) type = "local";
if (environment_->is_special_index(index_)) type = "special";
@ -1721,7 +1736,7 @@ OStream& HUnknownOSRValue::PrintDataTo(OStream& os) const { // NOLINT
}
OStream& HInstanceOf::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HInstanceOf::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(left()) << " " << NameOf(right()) << " "
<< NameOf(context());
}
@ -2439,7 +2454,7 @@ void HPushArguments::AddInput(HValue* value) {
}
OStream& HPhi::PrintTo(OStream& os) const { // NOLINT
std::ostream& HPhi::PrintTo(std::ostream& os) const { // NOLINT
os << "[";
for (int i = 0; i < OperandCount(); ++i) {
os << " " << NameOf(OperandAt(i)) << " ";
@ -2571,7 +2586,7 @@ void HSimulate::MergeWith(ZoneList<HSimulate*>* list) {
}
OStream& HSimulate::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HSimulate::PrintDataTo(std::ostream& os) const { // NOLINT
os << "id=" << ast_id().ToInt();
if (pop_count_ > 0) os << " pop " << pop_count_;
if (values_.length() > 0) {
@ -2633,7 +2648,7 @@ void HCapturedObject::ReplayEnvironment(HEnvironment* env) {
}
OStream& HCapturedObject::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCapturedObject::PrintDataTo(std::ostream& os) const { // NOLINT
os << "#" << capture_id() << " ";
return HDematerializedObject::PrintDataTo(os);
}
@ -2646,7 +2661,7 @@ void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target,
}
OStream& HEnterInlined::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HEnterInlined::PrintDataTo(std::ostream& os) const { // NOLINT
return os << function()->debug_name()->ToCString().get()
<< ", id=" << function()->id().ToInt();
}
@ -2936,7 +2951,7 @@ Maybe<HConstant*> HConstant::CopyToTruncatedNumber(Zone* zone) {
}
OStream& HConstant::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HConstant::PrintDataTo(std::ostream& os) const { // NOLINT
if (has_int32_value_) {
os << int32_value_ << " ";
} else if (has_double_value_) {
@ -2955,7 +2970,7 @@ OStream& HConstant::PrintDataTo(OStream& os) const { // NOLINT
}
OStream& HBinaryOperation::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HBinaryOperation::PrintDataTo(std::ostream& os) const { // NOLINT
os << NameOf(left()) << " " << NameOf(right());
if (CheckFlag(kCanOverflow)) os << " !";
if (CheckFlag(kBailoutOnMinusZero)) os << " -0?";
@ -3182,25 +3197,28 @@ Range* HLoadKeyed::InferRange(Zone* zone) {
}
OStream& HCompareGeneric::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCompareGeneric::PrintDataTo(std::ostream& os) const { // NOLINT
os << Token::Name(token()) << " ";
return HBinaryOperation::PrintDataTo(os);
}
OStream& HStringCompareAndBranch::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HStringCompareAndBranch::PrintDataTo(
std::ostream& os) const { // NOLINT
os << Token::Name(token()) << " ";
return HControlInstruction::PrintDataTo(os);
}
OStream& HCompareNumericAndBranch::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCompareNumericAndBranch::PrintDataTo(
std::ostream& os) const { // NOLINT
os << Token::Name(token()) << " " << NameOf(left()) << " " << NameOf(right());
return HControlInstruction::PrintDataTo(os);
}
OStream& HCompareObjectEqAndBranch::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HCompareObjectEqAndBranch::PrintDataTo(
std::ostream& os) const { // NOLINT
os << NameOf(left()) << " " << NameOf(right());
return HControlInstruction::PrintDataTo(os);
}
@ -3340,7 +3358,7 @@ void HCompareMinusZeroAndBranch::InferRepresentation(
}
OStream& HGoto::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HGoto::PrintDataTo(std::ostream& os) const { // NOLINT
return os << *SuccessorAt(0);
}
@ -3384,12 +3402,12 @@ void HCompareNumericAndBranch::InferRepresentation(
}
OStream& HParameter::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HParameter::PrintDataTo(std::ostream& os) const { // NOLINT
return os << index();
}
OStream& HLoadNamedField::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HLoadNamedField::PrintDataTo(std::ostream& os) const { // NOLINT
os << NameOf(object()) << access_;
if (maps() != NULL) {
@ -3405,13 +3423,14 @@ OStream& HLoadNamedField::PrintDataTo(OStream& os) const { // NOLINT
}
OStream& HLoadNamedGeneric::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HLoadNamedGeneric::PrintDataTo(
std::ostream& os) const { // NOLINT
Handle<String> n = Handle<String>::cast(name());
return os << NameOf(object()) << "." << n->ToCString().get();
}
OStream& HLoadKeyed::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HLoadKeyed::PrintDataTo(std::ostream& os) const { // NOLINT
if (!is_external()) {
os << NameOf(elements());
} else {
@ -3499,7 +3518,8 @@ bool HLoadKeyed::RequiresHoleCheck() const {
}
OStream& HLoadKeyedGeneric::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HLoadKeyedGeneric::PrintDataTo(
std::ostream& os) const { // NOLINT
return os << NameOf(object()) << "[" << NameOf(key()) << "]";
}
@ -3541,14 +3561,15 @@ HValue* HLoadKeyedGeneric::Canonicalize() {
}
OStream& HStoreNamedGeneric::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HStoreNamedGeneric::PrintDataTo(
std::ostream& os) const { // NOLINT
Handle<String> n = Handle<String>::cast(name());
return os << NameOf(object()) << "." << n->ToCString().get() << " = "
<< NameOf(value());
}
OStream& HStoreNamedField::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HStoreNamedField::PrintDataTo(std::ostream& os) const { // NOLINT
os << NameOf(object()) << access_ << " = " << NameOf(value());
if (NeedsWriteBarrier()) os << " (write-barrier)";
if (has_transition()) os << " (transition map " << *transition_map() << ")";
@ -3556,7 +3577,7 @@ OStream& HStoreNamedField::PrintDataTo(OStream& os) const { // NOLINT
}
OStream& HStoreKeyed::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HStoreKeyed::PrintDataTo(std::ostream& os) const { // NOLINT
if (!is_external()) {
os << NameOf(elements());
} else {
@ -3571,13 +3592,15 @@ OStream& HStoreKeyed::PrintDataTo(OStream& os) const { // NOLINT
}
OStream& HStoreKeyedGeneric::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HStoreKeyedGeneric::PrintDataTo(
std::ostream& os) const { // NOLINT
return os << NameOf(object()) << "[" << NameOf(key())
<< "] = " << NameOf(value());
}
OStream& HTransitionElementsKind::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HTransitionElementsKind::PrintDataTo(
std::ostream& os) const { // NOLINT
os << NameOf(object());
ElementsKind from_kind = original_map().handle()->elements_kind();
ElementsKind to_kind = transitioned_map().handle()->elements_kind();
@ -3590,7 +3613,7 @@ OStream& HTransitionElementsKind::PrintDataTo(OStream& os) const { // NOLINT
}
OStream& HLoadGlobalCell::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HLoadGlobalCell::PrintDataTo(std::ostream& os) const { // NOLINT
os << "[" << *cell().handle() << "]";
if (details_.IsConfigurable()) os << " (configurable)";
if (details_.IsReadOnly()) os << " (read-only)";
@ -3608,18 +3631,20 @@ bool HLoadGlobalCell::RequiresHoleCheck() const {
}
OStream& HLoadGlobalGeneric::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HLoadGlobalGeneric::PrintDataTo(
std::ostream& os) const { // NOLINT
return os << name()->ToCString().get() << " ";
}
OStream& HInnerAllocatedObject::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HInnerAllocatedObject::PrintDataTo(
std::ostream& os) const { // NOLINT
os << NameOf(base_object()) << " offset ";
return offset()->PrintTo(os);
}
OStream& HStoreGlobalCell::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HStoreGlobalCell::PrintDataTo(std::ostream& os) const { // NOLINT
os << "[" << *cell().handle() << "] = " << NameOf(value());
if (details_.IsConfigurable()) os << " (configurable)";
if (details_.IsReadOnly()) os << " (read-only)";
@ -3627,12 +3652,13 @@ OStream& HStoreGlobalCell::PrintDataTo(OStream& os) const { // NOLINT
}
OStream& HLoadContextSlot::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HLoadContextSlot::PrintDataTo(std::ostream& os) const { // NOLINT
return os << NameOf(value()) << "[" << slot_index() << "]";
}
OStream& HStoreContextSlot::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HStoreContextSlot::PrintDataTo(
std::ostream& os) const { // NOLINT
return os << NameOf(context()) << "[" << slot_index()
<< "] = " << NameOf(value());
}
@ -3987,7 +4013,7 @@ void HAllocate::ClearNextMapWord(int offset) {
}
OStream& HAllocate::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HAllocate::PrintDataTo(std::ostream& os) const { // NOLINT
os << NameOf(size()) << " (";
if (IsNewSpaceAllocation()) os << "N";
if (IsOldPointerSpaceAllocation()) os << "P";
@ -4096,7 +4122,7 @@ HInstruction* HStringAdd::New(Zone* zone,
}
OStream& HStringAdd::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HStringAdd::PrintDataTo(std::ostream& os) const { // NOLINT
if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) {
os << "_CheckBoth";
} else if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_LEFT) {
@ -4431,7 +4457,7 @@ HInstruction* HSeqStringGetChar::New(Zone* zone,
#undef H_CONSTANT_DOUBLE
OStream& HBitwise::PrintDataTo(OStream& os) const { // NOLINT
std::ostream& HBitwise::PrintDataTo(std::ostream& os) const { // NOLINT
os << Token::Name(op_) << " ";
return HBitwiseBinaryOperation::PrintDataTo(os);
}
@ -4746,7 +4772,7 @@ void HObjectAccess::SetGVNFlags(HValue *instr, PropertyAccessType access_type) {
}
OStream& operator<<(OStream& os, const HObjectAccess& access) {
std::ostream& operator<<(std::ostream& os, const HObjectAccess& access) {
os << ".";
switch (access.portion()) {

View File

@ -5,6 +5,8 @@
#ifndef V8_HYDROGEN_INSTRUCTIONS_H_
#define V8_HYDROGEN_INSTRUCTIONS_H_
#include <iosfwd>
#include "src/v8.h"
#include "src/allocation.h"
@ -35,7 +37,6 @@ class HStoreNamedField;
class HValue;
class LInstruction;
class LChunkBuilder;
class OStream;
#define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \
V(ArithmeticBinaryOperation) \
@ -467,7 +468,7 @@ class HSourcePosition {
};
OStream& operator<<(OStream& os, const HSourcePosition& p);
std::ostream& operator<<(std::ostream& os, const HSourcePosition& p);
class HValue : public ZoneObject {
@ -770,7 +771,7 @@ class HValue : public ZoneObject {
virtual void FinalizeUniqueness() { }
// Printing support.
virtual OStream& PrintTo(OStream& os) const = 0; // NOLINT
virtual std::ostream& PrintTo(std::ostream& os) const = 0; // NOLINT
const char* Mnemonic() const;
@ -887,7 +888,7 @@ class HValue : public ZoneObject {
result.Remove(kOsrEntries);
return result;
}
friend OStream& operator<<(OStream& os, const ChangesOf& v);
friend std::ostream& operator<<(std::ostream& os, const ChangesOf& v);
// A flag mask of all side effects that can make observable changes in
// an executing program (i.e. are not safe to repeat, move or remove);
@ -948,10 +949,10 @@ struct ChangesOf {
};
OStream& operator<<(OStream& os, const HValue& v);
OStream& operator<<(OStream& os, const NameOf& v);
OStream& operator<<(OStream& os, const TypeOf& v);
OStream& operator<<(OStream& os, const ChangesOf& v);
std::ostream& operator<<(std::ostream& os, const HValue& v);
std::ostream& operator<<(std::ostream& os, const NameOf& v);
std::ostream& operator<<(std::ostream& os, const TypeOf& v);
std::ostream& operator<<(std::ostream& os, const ChangesOf& v);
#define DECLARE_INSTRUCTION_FACTORY_P0(I) \
@ -1147,8 +1148,8 @@ class HInstruction : public HValue {
HInstruction* next() const { return next_; }
HInstruction* previous() const { return previous_; }
virtual OStream& PrintTo(OStream& os) const OVERRIDE; // NOLINT
virtual OStream& PrintDataTo(OStream& os) const; // NOLINT
virtual std::ostream& PrintTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const; // NOLINT
bool IsLinked() const { return block() != NULL; }
void Unlink();
@ -1258,7 +1259,7 @@ class HControlInstruction : public HInstruction {
virtual int SuccessorCount() const = 0;
virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0;
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual bool KnownSuccessorBlock(HBasicBlock** block) {
*block = NULL;
@ -1348,7 +1349,7 @@ class HDummyUse FINAL : public HTemplateInstruction<1> {
return Representation::None();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(DummyUse);
};
@ -1382,7 +1383,7 @@ class HGoto FINAL : public HTemplateControlInstruction<1, 0> {
return Representation::None();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(Goto)
};
@ -1435,7 +1436,7 @@ class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> {
SetSuccessorAt(1, false_target);
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
HValue* value() const { return OperandAt(0); }
};
@ -1457,7 +1458,7 @@ class HBranch FINAL : public HUnaryControlInstruction {
virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE;
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
ToBooleanStub::Types expected_input_types() const {
return expected_input_types_;
@ -1494,7 +1495,7 @@ class HCompareMap FINAL : public HUnaryControlInstruction {
return false;
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
static const int kNoKnownSuccessorIndex = -1;
int known_successor_index() const { return known_successor_index_; }
@ -1568,7 +1569,7 @@ class HReturn FINAL : public HTemplateControlInstruction<0, 3> {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
HValue* value() const { return OperandAt(0); }
HValue* context() const { return OperandAt(1); }
@ -1611,7 +1612,7 @@ class HUnaryOperation : public HTemplateInstruction<1> {
}
HValue* value() const { return OperandAt(0); }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
};
@ -1641,7 +1642,7 @@ class HForceRepresentation FINAL : public HTemplateInstruction<1> {
return representation(); // Same as the output representation.
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation)
@ -1697,7 +1698,7 @@ class HChange FINAL : public HUnaryOperation {
virtual Range* InferRange(Zone* zone) OVERRIDE;
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(Change)
@ -1816,7 +1817,7 @@ class HSimulate FINAL : public HInstruction {
done_with_replay_(false) {}
~HSimulate() {}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
bool HasAstId() const { return !ast_id_.IsNone(); }
BailoutId ast_id() const { return ast_id_; }
@ -1922,7 +1923,7 @@ class HEnvironmentMarker FINAL : public HTemplateInstruction<1> {
return Representation::None();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
#ifdef DEBUG
void set_closure(Handle<JSFunction> closure) {
@ -2015,7 +2016,7 @@ class HEnterInlined FINAL : public HTemplateInstruction<0> {
void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone);
ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
Handle<JSFunction> closure() const { return closure_; }
HConstant* closure_context() const { return closure_context_; }
@ -2249,7 +2250,7 @@ class HUnaryCall : public HCall<1> {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
HValue* value() const { return OperandAt(0); }
};
@ -2263,7 +2264,7 @@ class HBinaryCall : public HCall<2> {
SetOperandAt(1, second);
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(
int index) FINAL OVERRIDE {
@ -2285,7 +2286,7 @@ class HCallJSFunction FINAL : public HCall<1> {
HValue* function() const { return OperandAt(0); }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(
int index) FINAL OVERRIDE {
@ -2368,7 +2369,7 @@ class HCallWithDescriptor FINAL : public HInstruction {
return OperandAt(0);
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
private:
// The argument count includes the receiver.
@ -2501,7 +2502,7 @@ class HCallNewArray FINAL : public HBinaryCall {
HValue* context() { return first(); }
HValue* constructor() { return second(); }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
ElementsKind elements_kind() const { return elements_kind_; }
@ -2524,7 +2525,7 @@ class HCallRuntime FINAL : public HCall<1> {
const Runtime::Function*,
int);
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
HValue* context() { return OperandAt(0); }
const Runtime::Function* function() const { return c_function_; }
@ -2591,7 +2592,7 @@ class HUnaryMathOperation FINAL : public HTemplateInstruction<2> {
HValue* context() const { return OperandAt(0); }
HValue* value() const { return OperandAt(1); }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
if (index == 0) {
@ -2761,7 +2762,7 @@ class HCheckMaps FINAL : public HTemplateInstruction<2> {
return HType::HeapObject();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
HValue* value() const { return OperandAt(0); }
HValue* typecheck() const { return OperandAt(1); }
@ -2869,7 +2870,7 @@ class HCheckValue FINAL : public HUnaryOperation {
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual HValue* Canonicalize() OVERRIDE;
@ -2915,7 +2916,7 @@ class HCheckInstanceType FINAL : public HUnaryOperation {
DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check);
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
return Representation::Tagged();
@ -3308,7 +3309,7 @@ class HPhi FINAL : public HValue {
induction_variable_data_ = InductionVariableData::ExaminePhi(this);
}
virtual OStream& PrintTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintTo(std::ostream& os) const OVERRIDE; // NOLINT
#ifdef DEBUG
virtual void Verify() OVERRIDE;
@ -3460,7 +3461,7 @@ class HCapturedObject FINAL : public HDematerializedObject {
// Replay effects of this instruction on the given environment.
void ReplayEnvironment(HEnvironment* env);
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
@ -3574,7 +3575,7 @@ class HConstant FINAL : public HTemplateInstruction<0> {
}
virtual bool EmitAtUses() OVERRIDE;
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
HConstant* CopyToRepresentation(Representation r, Zone* zone) const;
Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone);
Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone);
@ -3838,7 +3839,7 @@ class HBinaryOperation : public HTemplateInstruction<3> {
virtual bool IsCommutative() const { return false; }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
if (index == 0) return Representation::Tagged();
@ -3886,7 +3887,7 @@ class HWrapReceiver FINAL : public HTemplateInstruction<2> {
virtual HValue* Canonicalize() OVERRIDE;
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
bool known_function() const { return known_function_; }
DECLARE_CONCRETE_INSTRUCTION(WrapReceiver)
@ -3995,7 +3996,7 @@ class HAccessArgumentsAt FINAL : public HTemplateInstruction<3> {
public:
DECLARE_INSTRUCTION_FACTORY_P3(HAccessArgumentsAt, HValue*, HValue*, HValue*);
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
// The arguments elements is considered tagged.
@ -4059,7 +4060,7 @@ class HBoundsCheck FINAL : public HTemplateInstruction<2> {
return representation();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual void InferRepresentation(
HInferRepresentationPhase* h_infer) OVERRIDE;
@ -4130,7 +4131,7 @@ class HBoundsCheckBaseIndexInformation FINAL
return representation();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual int RedefinedOperandIndex() OVERRIDE { return 0; }
virtual bool IsPurelyInformativeDefinition() OVERRIDE { return true; }
@ -4256,7 +4257,7 @@ class HCompareGeneric FINAL : public HBinaryOperation {
}
Token::Value token() const { return token_; }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(CompareGeneric)
@ -4306,7 +4307,7 @@ class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> {
virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE;
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
void SetOperandPositions(Zone* zone,
HSourcePosition left_pos,
@ -4402,7 +4403,7 @@ class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> {
HValue* left() const { return OperandAt(0); }
HValue* right() const { return OperandAt(1); }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
return Representation::Tagged();
@ -4546,7 +4547,7 @@ class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> {
HValue* right() { return OperandAt(2); }
Token::Value token() const { return token_; }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
return Representation::Tagged();
@ -4600,7 +4601,7 @@ class HHasInstanceTypeAndBranch FINAL : public HUnaryControlInstruction {
InstanceType from() { return from_; }
InstanceType to() { return to_; }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
return Representation::Tagged();
@ -4672,7 +4673,7 @@ class HClassOfTestAndBranch FINAL : public HUnaryControlInstruction {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
Handle<String> class_name() const { return class_name_; }
@ -4690,7 +4691,7 @@ class HTypeofIsAndBranch FINAL : public HUnaryControlInstruction {
DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>);
Handle<String> type_literal() const { return type_literal_.handle(); }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch)
@ -4721,7 +4722,7 @@ class HInstanceOf FINAL : public HBinaryOperation {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(InstanceOf)
@ -5080,7 +5081,7 @@ class HBitwise FINAL : public HBitwiseBinaryOperation {
virtual HValue* Canonicalize() OVERRIDE;
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(Bitwise)
@ -5303,7 +5304,7 @@ class HParameter FINAL : public HTemplateInstruction<0> {
unsigned index() const { return index_; }
ParameterKind kind() const { return kind_; }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
return Representation::None();
@ -5339,7 +5340,7 @@ class HCallStub FINAL : public HUnaryCall {
HValue* context() { return value(); }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(CallStub)
@ -5367,7 +5368,7 @@ class HTailCallThroughMegamorphicCache FINAL : public HTemplateInstruction<3> {
HValue* name() const { return OperandAt(2); }
Code::Flags flags() const { return flags_; }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(TailCallThroughMegamorphicCache)
@ -5388,7 +5389,7 @@ class HUnknownOSRValue FINAL : public HTemplateInstruction<0> {
public:
DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int);
virtual OStream& PrintDataTo(OStream& os) const; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
return Representation::None();
@ -5428,7 +5429,7 @@ class HLoadGlobalCell FINAL : public HTemplateInstruction<0> {
Unique<Cell> cell() const { return cell_; }
bool RequiresHoleCheck() const;
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual intptr_t Hashcode() OVERRIDE {
return cell_.Hashcode();
@ -5485,7 +5486,7 @@ class HLoadGlobalGeneric FINAL : public HTemplateInstruction<2> {
slot_ = slot;
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
return Representation::Tagged();
@ -5595,7 +5596,7 @@ class HAllocate FINAL : public HTemplateInstruction<2> {
virtual bool HandleSideEffectDominator(GVNFlag side_effect,
HValue* dominator) OVERRIDE;
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(Allocate)
@ -5742,7 +5743,7 @@ class HInnerAllocatedObject FINAL : public HTemplateInstruction<2> {
return index == 0 ? Representation::Tagged() : Representation::Integer32();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject)
@ -5840,7 +5841,7 @@ class HStoreGlobalCell FINAL : public HUnaryOperation {
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell)
@ -5896,7 +5897,7 @@ class HLoadContextSlot FINAL : public HUnaryOperation {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot)
@ -5953,7 +5954,7 @@ class HStoreContextSlot FINAL : public HTemplateInstruction<2> {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot)
@ -6336,7 +6337,8 @@ class HObjectAccess FINAL {
friend class HLoadNamedField;
friend class HStoreNamedField;
friend class SideEffectsTracker;
friend OStream& operator<<(OStream& os, const HObjectAccess& access);
friend std::ostream& operator<<(std::ostream& os,
const HObjectAccess& access);
inline Portion portion() const {
return PortionField::decode(value_);
@ -6344,7 +6346,7 @@ class HObjectAccess FINAL {
};
OStream& operator<<(OStream& os, const HObjectAccess& access);
std::ostream& operator<<(std::ostream& os, const HObjectAccess& access);
class HLoadNamedField FINAL : public HTemplateInstruction<2> {
@ -6379,7 +6381,7 @@ class HLoadNamedField FINAL : public HTemplateInstruction<2> {
return Representation::Tagged();
}
virtual Range* InferRange(Zone* zone) OVERRIDE;
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
bool CanBeReplacedWith(HValue* other) const {
if (!CheckFlag(HValue::kCantBeReplaced)) return false;
@ -6491,7 +6493,7 @@ class HLoadNamedGeneric FINAL : public HTemplateInstruction<2> {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric)
@ -6622,7 +6624,7 @@ class HLoadKeyed FINAL
return RequiredInputRepresentation(index);
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
bool UsesMustHandleHole() const;
bool AllUsesCanTreatHoleAsNaN() const;
@ -6765,7 +6767,7 @@ class HLoadKeyedGeneric FINAL : public HTemplateInstruction<3> {
slot_ = slot;
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
// tagged[tagged]
@ -6848,7 +6850,7 @@ class HStoreNamedField FINAL : public HTemplateInstruction<3> {
dominator_ = dominator;
return false;
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
HValue* object() const { return OperandAt(0); }
HValue* value() const { return OperandAt(1); }
@ -6958,7 +6960,7 @@ class HStoreNamedGeneric FINAL : public HTemplateInstruction<3> {
Handle<String> name() const { return name_; }
StrictMode strict_mode() const { return strict_mode_; }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
return Representation::Tagged();
@ -7104,7 +7106,7 @@ class HStoreKeyed FINAL
bool NeedsCanonicalization();
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(StoreKeyed)
@ -7177,7 +7179,7 @@ class HStoreKeyedGeneric FINAL : public HTemplateInstruction<4> {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric)
@ -7221,7 +7223,7 @@ class HTransitionElementsKind FINAL : public HTemplateInstruction<2> {
ElementsKind from_kind() const { return from_kind_; }
ElementsKind to_kind() const { return to_kind_; }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind)
@ -7279,7 +7281,7 @@ class HStringAdd FINAL : public HBinaryOperation {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(StringAdd)
@ -7519,7 +7521,7 @@ class HTypeof FINAL : public HTemplateInstruction<2> {
HValue* context() const { return OperandAt(0); }
HValue* value() const { return OperandAt(1); }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
return Representation::Tagged();
@ -7703,7 +7705,7 @@ class HCheckMapValue FINAL : public HTemplateInstruction<2> {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual HType CalculateInferredType() OVERRIDE {
if (value()->type().IsHeapObject()) return value()->type();
@ -7748,7 +7750,7 @@ class HForInPrepareMap FINAL : public HTemplateInstruction<2> {
HValue* context() const { return OperandAt(0); }
HValue* enumerable() const { return OperandAt(1); }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual HType CalculateInferredType() OVERRIDE {
return HType::Tagged();
@ -7787,7 +7789,7 @@ class HForInCacheArray FINAL : public HTemplateInstruction<2> {
index_cache_ = index_cache;
}
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual HType CalculateInferredType() OVERRIDE {
return HType::Tagged();
@ -7832,7 +7834,7 @@ class HLoadFieldByIndex FINAL : public HTemplateInstruction<2> {
HValue* object() const { return OperandAt(0); }
HValue* index() const { return OperandAt(1); }
virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
virtual HType CalculateInferredType() OVERRIDE {
return HType::Tagged();
@ -7877,7 +7879,7 @@ class HAllocateBlockContext: public HTemplateInstruction<2> {
return Representation::Tagged();
}
virtual OStream& PrintDataTo(OStream& os) const; // NOLINT
virtual std::ostream& PrintDataTo(std::ostream& os) const; // NOLINT
DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext)

View File

@ -56,7 +56,7 @@ HType HType::FromValue(Handle<Object> value) {
}
OStream& operator<<(OStream& os, const HType& t) {
std::ostream& operator<<(std::ostream& os, const HType& t) {
// Note: The c1visualizer syntax for locals allows only a sequence of the
// following characters: A-Za-z0-9_-|:
switch (t.kind_) {

View File

@ -6,6 +6,7 @@
#define HYDROGEN_TYPES_H_
#include <climits>
#include <iosfwd>
#include "src/base/macros.h"
@ -15,7 +16,6 @@ namespace internal {
// Forward declarations.
template <typename T> class Handle;
class Object;
class OStream;
#define HTYPE_LIST(V) \
V(Any, 0x0) /* 0000 0000 0000 0000 */ \
@ -65,7 +65,7 @@ class HType FINAL {
static HType FromType(typename T::TypeHandle type) WARN_UNUSED_RESULT;
static HType FromValue(Handle<Object> value) WARN_UNUSED_RESULT;
friend OStream& operator<<(OStream& os, const HType& t);
friend std::ostream& operator<<(std::ostream& os, const HType& t);
private:
enum Kind {
@ -84,7 +84,7 @@ class HType FINAL {
};
OStream& operator<<(OStream& os, const HType& t);
std::ostream& operator<<(std::ostream& os, const HType& t);
} } // namespace v8::internal
#endif // HYDROGEN_TYPES_H_

View File

@ -5,6 +5,7 @@
#include "src/hydrogen.h"
#include <algorithm>
#include <sstream>
#include "src/v8.h"
@ -3431,7 +3432,7 @@ void HBasicBlock::FinishExit(HControlInstruction* instruction,
}
OStream& operator<<(OStream& os, const HBasicBlock& b) {
std::ostream& operator<<(std::ostream& os, const HBasicBlock& b) {
return os << "B" << b.block_id();
}
@ -3542,7 +3543,7 @@ int HGraph::TraceInlinedFunction(
OFStream os(tracing_scope.file());
os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{"
<< info()->optimization_id() << "," << id << "} AS " << inline_id
<< " AT " << position << endl;
<< " AT " << position << std::endl;
}
return inline_id;
@ -12190,7 +12191,7 @@ HEnvironment* HEnvironment::CopyForInlining(
}
OStream& operator<<(OStream& os, const HEnvironment& env) {
std::ostream& operator<<(std::ostream& os, const HEnvironment& env) {
for (int i = 0; i < env.length(); i++) {
if (i == 0) os << "parameters\n";
if (i == env.parameter_count()) os << "specials\n";
@ -12322,9 +12323,9 @@ void HTracer::Trace(const char* name, HGraph* graph, LChunk* chunk) {
for (int j = 0; j < total; ++j) {
HPhi* phi = current->phis()->at(j);
PrintIndent();
OStringStream os;
std::ostringstream os;
os << phi->merged_index() << " " << NameOf(phi) << " " << *phi << "\n";
trace_.Add(os.c_str());
trace_.Add(os.str().c_str());
}
}
@ -12334,7 +12335,7 @@ void HTracer::Trace(const char* name, HGraph* graph, LChunk* chunk) {
HInstruction* instruction = it.Current();
int uses = instruction->UseCount();
PrintIndent();
OStringStream os;
std::ostringstream os;
os << "0 " << uses << " " << NameOf(instruction) << " " << *instruction;
if (FLAG_hydrogen_track_positions &&
instruction->has_position() &&
@ -12345,7 +12346,7 @@ void HTracer::Trace(const char* name, HGraph* graph, LChunk* chunk) {
os << pos.position();
}
os << " <|@\n";
trace_.Add(os.c_str());
trace_.Add(os.str().c_str());
}
}
@ -12363,9 +12364,9 @@ void HTracer::Trace(const char* name, HGraph* graph, LChunk* chunk) {
trace_.Add("%d ",
LifetimePosition::FromInstructionIndex(i).Value());
linstr->PrintTo(&trace_);
OStringStream os;
std::ostringstream os;
os << " [hir:" << NameOf(linstr->hydrogen_value()) << "] <|@\n";
trace_.Add(os.c_str());
trace_.Add(os.str().c_str());
}
}
}

View File

@ -215,7 +215,7 @@ class HBasicBlock FINAL : public ZoneObject {
};
OStream& operator<<(OStream& os, const HBasicBlock& b);
std::ostream& operator<<(std::ostream& os, const HBasicBlock& b);
class HPredecessorIterator FINAL BASE_EMBEDDED {
@ -743,7 +743,7 @@ class HEnvironment FINAL : public ZoneObject {
};
OStream& operator<<(OStream& os, const HEnvironment& env);
std::ostream& operator<<(std::ostream& os, const HEnvironment& env);
class HOptimizedGraphBuilder;

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <sstream>
#include "src/v8.h"
#if V8_TARGET_ARCH_IA32
@ -365,9 +367,9 @@ LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) {
void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
OStringStream os;
std::ostringstream os;
os << hydrogen()->access() << " <- ";
stream->Add(os.c_str());
stream->Add(os.str().c_str());
value()->PrintTo(stream);
}

View File

@ -28,7 +28,7 @@ ExtraICState CallICState::GetExtraICState() const {
}
OStream& operator<<(OStream& os, const CallICState& s) {
std::ostream& operator<<(std::ostream& os, const CallICState& s) {
return os << "(args(" << s.arg_count() << "), "
<< (s.call_type() == CallICState::METHOD ? "METHOD" : "FUNCTION")
<< ", ";
@ -308,7 +308,7 @@ Type* BinaryOpICState::GetResultType(Zone* zone) const {
}
OStream& operator<<(OStream& os, const BinaryOpICState& s) {
std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s) {
os << "(" << Token::Name(s.op_);
if (s.mode_ == OVERWRITE_LEFT)
os << "_ReuseLeft";

View File

@ -51,7 +51,7 @@ class CallICState FINAL BASE_EMBEDDED {
};
OStream& operator<<(OStream& os, const CallICState& s);
std::ostream& operator<<(std::ostream& os, const CallICState& s);
// Mode to overwrite BinaryExpression values.
@ -139,7 +139,7 @@ class BinaryOpICState FINAL BASE_EMBEDDED {
Isolate* isolate() const { return isolate_; }
private:
friend OStream& operator<<(OStream& os, const BinaryOpICState& s);
friend std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s);
enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC };
@ -173,7 +173,7 @@ class BinaryOpICState FINAL BASE_EMBEDDED {
};
OStream& operator<<(OStream& os, const BinaryOpICState& s);
std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s);
class CompareICState {

View File

@ -2244,7 +2244,7 @@ MaybeHandle<Object> BinaryOpIC::Transition(
if (!allocation_site.is_null()) {
os << " using allocation site " << static_cast<void*>(*allocation_site);
}
os << "]" << endl;
os << "]" << std::endl;
}
// Patch the inlined smi code as necessary.

View File

@ -4386,7 +4386,7 @@ void BackReferenceNode::Emit(RegExpCompiler* compiler, Trace* trace) {
class DotPrinter: public NodeVisitor {
public:
DotPrinter(OStream& os, bool ignore_case) // NOLINT
DotPrinter(std::ostream& os, bool ignore_case) // NOLINT
: os_(os),
ignore_case_(ignore_case) {}
void PrintNode(const char* label, RegExpNode* node);
@ -4398,7 +4398,7 @@ class DotPrinter: public NodeVisitor {
FOR_EACH_NODE_TYPE(DECLARE_VISIT)
#undef DECLARE_VISIT
private:
OStream& os_;
std::ostream& os_;
bool ignore_case_;
};
@ -4420,7 +4420,7 @@ void DotPrinter::PrintNode(const char* label, RegExpNode* node) {
}
os_ << "\"];\n";
Visit(node);
os_ << "}" << endl;
os_ << "}" << std::endl;
}
@ -4439,7 +4439,7 @@ void DotPrinter::PrintOnFailure(RegExpNode* from, RegExpNode* on_failure) {
class TableEntryBodyPrinter {
public:
TableEntryBodyPrinter(OStream& os, ChoiceNode* choice) // NOLINT
TableEntryBodyPrinter(std::ostream& os, ChoiceNode* choice) // NOLINT
: os_(os),
choice_(choice) {}
void Call(uc16 from, DispatchTable::Entry entry) {
@ -4453,14 +4453,14 @@ class TableEntryBodyPrinter {
}
private:
ChoiceNode* choice() { return choice_; }
OStream& os_;
std::ostream& os_;
ChoiceNode* choice_;
};
class TableEntryHeaderPrinter {
public:
explicit TableEntryHeaderPrinter(OStream& os) // NOLINT
explicit TableEntryHeaderPrinter(std::ostream& os) // NOLINT
: first_(true),
os_(os) {}
void Call(uc16 from, DispatchTable::Entry entry) {
@ -4484,13 +4484,13 @@ class TableEntryHeaderPrinter {
private:
bool first_;
OStream& os_;
std::ostream& os_;
};
class AttributePrinter {
public:
explicit AttributePrinter(OStream& os) // NOLINT
explicit AttributePrinter(std::ostream& os) // NOLINT
: os_(os),
first_(true) {}
void PrintSeparator() {
@ -4512,7 +4512,7 @@ class AttributePrinter {
}
private:
OStream& os_;
std::ostream& os_;
bool first_;
};
@ -4681,10 +4681,10 @@ void DotPrinter::VisitAction(ActionNode* that) {
class DispatchTableDumper {
public:
explicit DispatchTableDumper(OStream& os) : os_(os) {}
explicit DispatchTableDumper(std::ostream& os) : os_(os) {}
void Call(uc16 key, DispatchTable::Entry entry);
private:
OStream& os_;
std::ostream& os_;
};

View File

@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/v8.h"
#include "src/lithium-codegen.h"
#include <sstream>
#include "src/v8.h"
#if V8_TARGET_ARCH_IA32
#include "src/ia32/lithium-ia32.h" // NOLINT
#include "src/ia32/lithium-codegen-ia32.h" // NOLINT
@ -148,11 +150,11 @@ void LCodeGenBase::Comment(const char* format, ...) {
void LCodeGenBase::DeoptComment(const Deoptimizer::Reason& reason) {
OStringStream os;
std::ostringstream os;
os << ";;; deoptimize at " << HSourcePosition(reason.raw_position) << " "
<< reason.mnemonic;
if (reason.detail != NULL) os << ": " << reason.detail;
Comment("%s", os.c_str());
Comment("%s", os.str().c_str());
}

View File

@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdarg.h>
#include "src/log.h"
#include <cstdarg>
#include <sstream>
#include "src/v8.h"
@ -13,7 +16,6 @@
#include "src/cpu-profiler.h"
#include "src/deoptimizer.h"
#include "src/global-handles.h"
#include "src/log.h"
#include "src/log-utils.h"
#include "src/macro-assembler.h"
#include "src/perf-jit.h"
@ -1785,13 +1787,13 @@ void Logger::LogAccessorCallbacks() {
}
static void AddIsolateIdIfNeeded(OStream& os, // NOLINT
static void AddIsolateIdIfNeeded(std::ostream& os, // NOLINT
Isolate* isolate) {
if (FLAG_logfile_per_isolate) os << "isolate-" << isolate << "-";
}
static void PrepareLogFileName(OStream& os, // NOLINT
static void PrepareLogFileName(std::ostream& os, // NOLINT
Isolate* isolate, const char* file_name) {
AddIsolateIdIfNeeded(os, isolate);
for (const char* p = file_name; *p; p++) {
@ -1836,9 +1838,9 @@ bool Logger::SetUp(Isolate* isolate) {
FLAG_log_snapshot_positions = true;
}
OStringStream log_file_name;
std::ostringstream log_file_name;
PrepareLogFileName(log_file_name, isolate, FLAG_logfile);
log_->Initialize(log_file_name.c_str());
log_->Initialize(log_file_name.str().c_str());
if (FLAG_perf_basic_prof) {
@ -1852,7 +1854,7 @@ bool Logger::SetUp(Isolate* isolate) {
}
if (FLAG_ll_prof) {
ll_logger_ = new LowLevelLogger(log_file_name.c_str());
ll_logger_ = new LowLevelLogger(log_file_name.str().c_str());
addCodeEventListener(ll_logger_);
}

View File

@ -323,7 +323,7 @@ void LAccessArgumentsAt::PrintDataTo(StringStream* stream) {
void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
OStringStream os;
std::ostringstream os;
os << hydrogen()->access() << " <- ";
stream->Add(os.c_str());
value()->PrintTo(stream);

View File

@ -323,7 +323,7 @@ void LAccessArgumentsAt::PrintDataTo(StringStream* stream) {
void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
OStringStream os;
std::ostringstream os;
os << hydrogen()->access() << " <- ";
stream->Add(os.c_str());
value()->PrintTo(stream);

View File

@ -18,11 +18,11 @@ namespace internal {
void Object::Print() {
OFStream os(stdout);
this->Print(os);
os << flush;
os << std::flush;
}
void Object::Print(OStream& os) { // NOLINT
void Object::Print(std::ostream& os) { // NOLINT
if (IsSmi()) {
Smi::cast(this)->SmiPrint(os);
} else {
@ -31,12 +31,12 @@ void Object::Print(OStream& os) { // NOLINT
}
void HeapObject::PrintHeader(OStream& os, const char* id) { // NOLINT
void HeapObject::PrintHeader(std::ostream& os, const char* id) { // NOLINT
os << "" << reinterpret_cast<void*>(this) << ": [" << id << "]\n";
}
void HeapObject::HeapObjectPrint(OStream& os) { // NOLINT
void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
InstanceType instance_type = map()->instance_type();
HandleScope scope(GetIsolate());
@ -193,19 +193,19 @@ void HeapObject::HeapObjectPrint(OStream& os) { // NOLINT
}
void ByteArray::ByteArrayPrint(OStream& os) { // NOLINT
void ByteArray::ByteArrayPrint(std::ostream& os) { // NOLINT
os << "byte array, data starts at " << GetDataStartAddress();
}
void FreeSpace::FreeSpacePrint(OStream& os) { // NOLINT
void FreeSpace::FreeSpacePrint(std::ostream& os) { // NOLINT
os << "free space, size " << Size();
}
#define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \
void External##Type##Array::External##Type##ArrayPrint(OStream& os) { \
os << "external " #type " array"; \
#define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \
void External##Type##Array::External##Type##ArrayPrint(std::ostream& os) { \
os << "external " #type " array"; \
}
TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER)
@ -214,12 +214,13 @@ TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER)
template <class Traits>
void FixedTypedArray<Traits>::FixedTypedArrayPrint(OStream& os) { // NOLINT
void FixedTypedArray<Traits>::FixedTypedArrayPrint(
std::ostream& os) { // NOLINT
os << "fixed " << Traits::Designator();
}
void JSObject::PrintProperties(OStream& os) { // NOLINT
void JSObject::PrintProperties(std::ostream& os) { // NOLINT
if (HasFastProperties()) {
DescriptorArray* descs = map()->instance_descriptors();
for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) {
@ -251,7 +252,7 @@ void JSObject::PrintProperties(OStream& os) { // NOLINT
template <class T>
static void DoPrintElements(OStream& os, Object* object) { // NOLINT
static void DoPrintElements(std::ostream& os, Object* object) { // NOLINT
T* p = T::cast(object);
for (int i = 0; i < p->length(); i++) {
os << " " << i << ": " << p->get_scalar(i) << "\n";
@ -259,7 +260,7 @@ static void DoPrintElements(OStream& os, Object* object) { // NOLINT
}
void JSObject::PrintElements(OStream& os) { // NOLINT
void JSObject::PrintElements(std::ostream& os) { // NOLINT
// Don't call GetElementsKind, its validation code can cause the printer to
// fail when debugging.
switch (map()->elements_kind()) {
@ -341,7 +342,7 @@ void JSObject::PrintElements(OStream& os) { // NOLINT
}
void JSObject::PrintTransitions(OStream& os) { // NOLINT
void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
if (!map()->HasTransitionArray()) return;
TransitionArray* transitions = map()->transitions();
for (int i = 0; i < transitions->number_of_transitions(); i++) {
@ -379,7 +380,7 @@ void JSObject::PrintTransitions(OStream& os) { // NOLINT
}
void JSObject::JSObjectPrint(OStream& os) { // NOLINT
void JSObject::JSObjectPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSObject");
// Don't call GetElementsKind, its validation code can cause the printer to
// fail when debugging.
@ -395,7 +396,7 @@ void JSObject::JSObjectPrint(OStream& os) { // NOLINT
}
void JSModule::JSModulePrint(OStream& os) { // NOLINT
void JSModule::JSModulePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSModule");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n"
<< " - context = ";
@ -419,7 +420,7 @@ static const char* TypeToString(InstanceType type) {
}
void Symbol::SymbolPrint(OStream& os) { // NOLINT
void Symbol::SymbolPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Symbol");
os << " - hash: " << Hash();
os << "\n - name: " << Brief(name());
@ -429,7 +430,7 @@ void Symbol::SymbolPrint(OStream& os) { // NOLINT
}
void Map::MapPrint(OStream& os) { // NOLINT
void Map::MapPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Map");
os << " - type: " << TypeToString(instance_type()) << "\n";
os << " - instance size: " << instance_size() << "\n";
@ -464,20 +465,21 @@ void Map::MapPrint(OStream& os) { // NOLINT
}
void CodeCache::CodeCachePrint(OStream& os) { // NOLINT
void CodeCache::CodeCachePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "CodeCache");
os << "\n - default_cache: " << Brief(default_cache());
os << "\n - normal_type_cache: " << Brief(normal_type_cache());
}
void PolymorphicCodeCache::PolymorphicCodeCachePrint(OStream& os) { // NOLINT
void PolymorphicCodeCache::PolymorphicCodeCachePrint(
std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "PolymorphicCodeCache");
os << "\n - cache: " << Brief(cache());
}
void TypeFeedbackInfo::TypeFeedbackInfoPrint(OStream& os) { // NOLINT
void TypeFeedbackInfo::TypeFeedbackInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "TypeFeedbackInfo");
os << " - ic_total_count: " << ic_total_count()
<< ", ic_with_type_info_count: " << ic_with_type_info_count()
@ -485,13 +487,14 @@ void TypeFeedbackInfo::TypeFeedbackInfoPrint(OStream& os) { // NOLINT
}
void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(OStream& os) { // NOLINT
void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(
std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "AliasedArgumentsEntry");
os << "\n - aliased_context_slot: " << aliased_context_slot();
}
void FixedArray::FixedArrayPrint(OStream& os) { // NOLINT
void FixedArray::FixedArrayPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "FixedArray");
os << " - length: " << length();
for (int i = 0; i < length(); i++) {
@ -501,7 +504,7 @@ void FixedArray::FixedArrayPrint(OStream& os) { // NOLINT
}
void FixedDoubleArray::FixedDoubleArrayPrint(OStream& os) { // NOLINT
void FixedDoubleArray::FixedDoubleArrayPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "FixedDoubleArray");
os << " - length: " << length();
for (int i = 0; i < length(); i++) {
@ -516,7 +519,7 @@ void FixedDoubleArray::FixedDoubleArrayPrint(OStream& os) { // NOLINT
}
void ConstantPoolArray::ConstantPoolArrayPrint(OStream& os) { // NOLINT
void ConstantPoolArray::ConstantPoolArrayPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "ConstantPoolArray");
os << " - length: " << length();
for (int i = 0; i <= last_index(INT32, SMALL_SECTION); i++) {
@ -553,13 +556,13 @@ void ConstantPoolArray::ConstantPoolArrayPrint(OStream& os) { // NOLINT
}
void JSValue::JSValuePrint(OStream& os) { // NOLINT
void JSValue::JSValuePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "ValueObject");
value()->Print(os);
}
void JSMessageObject::JSMessageObjectPrint(OStream& os) { // NOLINT
void JSMessageObject::JSMessageObjectPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSMessageObject");
os << " - type: " << Brief(type());
os << "\n - arguments: " << Brief(arguments());
@ -571,7 +574,7 @@ void JSMessageObject::JSMessageObjectPrint(OStream& os) { // NOLINT
}
void String::StringPrint(OStream& os) { // NOLINT
void String::StringPrint(std::ostream& os) { // NOLINT
if (StringShape(this).IsInternalized()) {
os << "#";
} else if (StringShape(this).IsCons()) {
@ -598,7 +601,7 @@ void String::StringPrint(OStream& os) { // NOLINT
}
void Name::NamePrint(OStream& os) { // NOLINT
void Name::NamePrint(std::ostream& os) { // NOLINT
if (IsString())
String::cast(this)->StringPrint(os);
else
@ -626,7 +629,7 @@ static const char* const weekdays[] = {
};
void JSDate::JSDatePrint(OStream& os) { // NOLINT
void JSDate::JSDatePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSDate");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - value = ";
@ -650,7 +653,7 @@ void JSDate::JSDatePrint(OStream& os) { // NOLINT
}
void JSProxy::JSProxyPrint(OStream& os) { // NOLINT
void JSProxy::JSProxyPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSProxy");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - handler = ";
@ -661,7 +664,7 @@ void JSProxy::JSProxyPrint(OStream& os) { // NOLINT
}
void JSFunctionProxy::JSFunctionProxyPrint(OStream& os) { // NOLINT
void JSFunctionProxy::JSFunctionProxyPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSFunctionProxy");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - handler = ";
@ -674,7 +677,7 @@ void JSFunctionProxy::JSFunctionProxyPrint(OStream& os) { // NOLINT
}
void JSSet::JSSetPrint(OStream& os) { // NOLINT
void JSSet::JSSetPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSSet");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - table = " << Brief(table());
@ -682,7 +685,7 @@ void JSSet::JSSetPrint(OStream& os) { // NOLINT
}
void JSMap::JSMapPrint(OStream& os) { // NOLINT
void JSMap::JSMapPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSMap");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - table = " << Brief(table());
@ -691,8 +694,9 @@ void JSMap::JSMapPrint(OStream& os) { // NOLINT
template <class Derived, class TableType>
void OrderedHashTableIterator<
Derived, TableType>::OrderedHashTableIteratorPrint(OStream& os) { // NOLINT
void
OrderedHashTableIterator<Derived, TableType>::OrderedHashTableIteratorPrint(
std::ostream& os) { // NOLINT
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - table = " << Brief(table());
os << "\n - index = " << Brief(index());
@ -703,27 +707,27 @@ void OrderedHashTableIterator<
template void OrderedHashTableIterator<
JSSetIterator,
OrderedHashSet>::OrderedHashTableIteratorPrint(OStream& os); // NOLINT
OrderedHashSet>::OrderedHashTableIteratorPrint(std::ostream& os); // NOLINT
template void OrderedHashTableIterator<
JSMapIterator,
OrderedHashMap>::OrderedHashTableIteratorPrint(OStream& os); // NOLINT
OrderedHashMap>::OrderedHashTableIteratorPrint(std::ostream& os); // NOLINT
void JSSetIterator::JSSetIteratorPrint(OStream& os) { // NOLINT
void JSSetIterator::JSSetIteratorPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSSetIterator");
OrderedHashTableIteratorPrint(os);
}
void JSMapIterator::JSMapIteratorPrint(OStream& os) { // NOLINT
void JSMapIterator::JSMapIteratorPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSMapIterator");
OrderedHashTableIteratorPrint(os);
}
void JSWeakMap::JSWeakMapPrint(OStream& os) { // NOLINT
void JSWeakMap::JSWeakMapPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSWeakMap");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - table = " << Brief(table());
@ -731,7 +735,7 @@ void JSWeakMap::JSWeakMapPrint(OStream& os) { // NOLINT
}
void JSWeakSet::JSWeakSetPrint(OStream& os) { // NOLINT
void JSWeakSet::JSWeakSetPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSWeakSet");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - table = " << Brief(table());
@ -739,7 +743,7 @@ void JSWeakSet::JSWeakSetPrint(OStream& os) { // NOLINT
}
void JSArrayBuffer::JSArrayBufferPrint(OStream& os) { // NOLINT
void JSArrayBuffer::JSArrayBufferPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSArrayBuffer");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - backing_store = " << backing_store() << "\n";
@ -748,7 +752,7 @@ void JSArrayBuffer::JSArrayBufferPrint(OStream& os) { // NOLINT
}
void JSTypedArray::JSTypedArrayPrint(OStream& os) { // NOLINT
void JSTypedArray::JSTypedArrayPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSTypedArray");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - buffer = " << Brief(buffer());
@ -760,7 +764,7 @@ void JSTypedArray::JSTypedArrayPrint(OStream& os) { // NOLINT
}
void JSDataView::JSDataViewPrint(OStream& os) { // NOLINT
void JSDataView::JSDataViewPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSDataView");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - buffer =" << Brief(buffer());
@ -770,7 +774,7 @@ void JSDataView::JSDataViewPrint(OStream& os) { // NOLINT
}
void JSFunction::JSFunctionPrint(OStream& os) { // NOLINT
void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Function");
os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
os << " - initial_map = ";
@ -791,7 +795,7 @@ void JSFunction::JSFunctionPrint(OStream& os) { // NOLINT
}
void SharedFunctionInfo::SharedFunctionInfoPrint(OStream& os) { // NOLINT
void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "SharedFunctionInfo");
os << " - name: " << Brief(name());
os << "\n - expected_nof_properties: " << expected_nof_properties();
@ -826,7 +830,7 @@ void SharedFunctionInfo::SharedFunctionInfoPrint(OStream& os) { // NOLINT
}
void JSGlobalProxy::JSGlobalProxyPrint(OStream& os) { // NOLINT
void JSGlobalProxy::JSGlobalProxyPrint(std::ostream& os) { // NOLINT
os << "global_proxy ";
JSObjectPrint(os);
os << "native context : " << Brief(native_context());
@ -834,7 +838,7 @@ void JSGlobalProxy::JSGlobalProxyPrint(OStream& os) { // NOLINT
}
void JSGlobalObject::JSGlobalObjectPrint(OStream& os) { // NOLINT
void JSGlobalObject::JSGlobalObjectPrint(std::ostream& os) { // NOLINT
os << "global ";
JSObjectPrint(os);
os << "native context : " << Brief(native_context());
@ -842,23 +846,23 @@ void JSGlobalObject::JSGlobalObjectPrint(OStream& os) { // NOLINT
}
void JSBuiltinsObject::JSBuiltinsObjectPrint(OStream& os) { // NOLINT
void JSBuiltinsObject::JSBuiltinsObjectPrint(std::ostream& os) { // NOLINT
os << "builtins ";
JSObjectPrint(os);
}
void Cell::CellPrint(OStream& os) { // NOLINT
void Cell::CellPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Cell");
}
void PropertyCell::PropertyCellPrint(OStream& os) { // NOLINT
void PropertyCell::PropertyCellPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "PropertyCell");
}
void Code::CodePrint(OStream& os) { // NOLINT
void Code::CodePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Code");
#ifdef ENABLE_DISASSEMBLER
if (FLAG_use_verbose_printer) {
@ -868,13 +872,13 @@ void Code::CodePrint(OStream& os) { // NOLINT
}
void Foreign::ForeignPrint(OStream& os) { // NOLINT
void Foreign::ForeignPrint(std::ostream& os) { // NOLINT
os << "foreign address : " << foreign_address();
}
void ExecutableAccessorInfo::ExecutableAccessorInfoPrint(
OStream& os) { // NOLINT
std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "ExecutableAccessorInfo");
os << "\n - name: " << Brief(name());
os << "\n - flag: " << Brief(flag());
@ -885,7 +889,8 @@ void ExecutableAccessorInfo::ExecutableAccessorInfoPrint(
}
void DeclaredAccessorInfo::DeclaredAccessorInfoPrint(OStream& os) { // NOLINT
void DeclaredAccessorInfo::DeclaredAccessorInfoPrint(
std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "DeclaredAccessorInfo");
os << "\n - name: " << Brief(name());
os << "\n - flag: " << Brief(flag());
@ -895,21 +900,21 @@ void DeclaredAccessorInfo::DeclaredAccessorInfoPrint(OStream& os) { // NOLINT
void DeclaredAccessorDescriptor::DeclaredAccessorDescriptorPrint(
OStream& os) { // NOLINT
std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "DeclaredAccessorDescriptor");
os << "\n - internal field: " << Brief(serialized_data());
os << "\n";
}
void Box::BoxPrint(OStream& os) { // NOLINT
void Box::BoxPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Box");
os << "\n - value: " << Brief(value());
os << "\n";
}
void AccessorPair::AccessorPairPrint(OStream& os) { // NOLINT
void AccessorPair::AccessorPairPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "AccessorPair");
os << "\n - getter: " << Brief(getter());
os << "\n - setter: " << Brief(setter());
@ -917,7 +922,7 @@ void AccessorPair::AccessorPairPrint(OStream& os) { // NOLINT
}
void AccessCheckInfo::AccessCheckInfoPrint(OStream& os) { // NOLINT
void AccessCheckInfo::AccessCheckInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "AccessCheckInfo");
os << "\n - named_callback: " << Brief(named_callback());
os << "\n - indexed_callback: " << Brief(indexed_callback());
@ -926,7 +931,7 @@ void AccessCheckInfo::AccessCheckInfoPrint(OStream& os) { // NOLINT
}
void InterceptorInfo::InterceptorInfoPrint(OStream& os) { // NOLINT
void InterceptorInfo::InterceptorInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "InterceptorInfo");
os << "\n - getter: " << Brief(getter());
os << "\n - setter: " << Brief(setter());
@ -938,7 +943,7 @@ void InterceptorInfo::InterceptorInfoPrint(OStream& os) { // NOLINT
}
void CallHandlerInfo::CallHandlerInfoPrint(OStream& os) { // NOLINT
void CallHandlerInfo::CallHandlerInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "CallHandlerInfo");
os << "\n - callback: " << Brief(callback());
os << "\n - data: " << Brief(data());
@ -946,7 +951,8 @@ void CallHandlerInfo::CallHandlerInfoPrint(OStream& os) { // NOLINT
}
void FunctionTemplateInfo::FunctionTemplateInfoPrint(OStream& os) { // NOLINT
void FunctionTemplateInfo::FunctionTemplateInfoPrint(
std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "FunctionTemplateInfo");
os << "\n - class name: " << Brief(class_name());
os << "\n - tag: " << Brief(tag());
@ -968,7 +974,7 @@ void FunctionTemplateInfo::FunctionTemplateInfoPrint(OStream& os) { // NOLINT
}
void ObjectTemplateInfo::ObjectTemplateInfoPrint(OStream& os) { // NOLINT
void ObjectTemplateInfo::ObjectTemplateInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "ObjectTemplateInfo");
os << " - tag: " << Brief(tag());
os << "\n - property_list: " << Brief(property_list());
@ -979,7 +985,7 @@ void ObjectTemplateInfo::ObjectTemplateInfoPrint(OStream& os) { // NOLINT
}
void SignatureInfo::SignatureInfoPrint(OStream& os) { // NOLINT
void SignatureInfo::SignatureInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "SignatureInfo");
os << "\n - receiver: " << Brief(receiver());
os << "\n - args: " << Brief(args());
@ -987,14 +993,14 @@ void SignatureInfo::SignatureInfoPrint(OStream& os) { // NOLINT
}
void TypeSwitchInfo::TypeSwitchInfoPrint(OStream& os) { // NOLINT
void TypeSwitchInfo::TypeSwitchInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "TypeSwitchInfo");
os << "\n - types: " << Brief(types());
os << "\n";
}
void AllocationSite::AllocationSitePrint(OStream& os) { // NOLINT
void AllocationSite::AllocationSitePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "AllocationSite");
os << " - weak_next: " << Brief(weak_next());
os << "\n - dependent code: " << Brief(dependent_code());
@ -1018,7 +1024,7 @@ void AllocationSite::AllocationSitePrint(OStream& os) { // NOLINT
}
void AllocationMemento::AllocationMementoPrint(OStream& os) { // NOLINT
void AllocationMemento::AllocationMementoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "AllocationMemento");
os << " - allocation site: ";
if (IsValid()) {
@ -1029,7 +1035,7 @@ void AllocationMemento::AllocationMementoPrint(OStream& os) { // NOLINT
}
void Script::ScriptPrint(OStream& os) { // NOLINT
void Script::ScriptPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Script");
os << "\n - source: " << Brief(source());
os << "\n - name: " << Brief(name());
@ -1048,7 +1054,7 @@ void Script::ScriptPrint(OStream& os) { // NOLINT
}
void DebugInfo::DebugInfoPrint(OStream& os) { // NOLINT
void DebugInfo::DebugInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "DebugInfo");
os << "\n - shared: " << Brief(shared());
os << "\n - original_code: " << Brief(original_code());
@ -1058,7 +1064,7 @@ void DebugInfo::DebugInfoPrint(OStream& os) { // NOLINT
}
void BreakPointInfo::BreakPointInfoPrint(OStream& os) { // NOLINT
void BreakPointInfo::BreakPointInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "BreakPointInfo");
os << "\n - code_position: " << code_position()->value();
os << "\n - source_position: " << source_position()->value();
@ -1068,7 +1074,7 @@ void BreakPointInfo::BreakPointInfoPrint(OStream& os) { // NOLINT
}
void DescriptorArray::PrintDescriptors(OStream& os) { // NOLINT
void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT
os << "Descriptor array " << number_of_descriptors() << "\n";
for (int i = 0; i < number_of_descriptors(); i++) {
Descriptor desc;
@ -1079,7 +1085,7 @@ void DescriptorArray::PrintDescriptors(OStream& os) { // NOLINT
}
void TransitionArray::PrintTransitions(OStream& os) { // NOLINT
void TransitionArray::PrintTransitions(std::ostream& os) { // NOLINT
os << "Transition array %d\n", number_of_transitions();
for (int i = 0; i < number_of_transitions(); i++) {
os << " " << i << ": ";

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <sstream>
#include "src/v8.h"
#include "src/accessors.h"
@ -909,13 +911,13 @@ void Object::ShortPrint(FILE* out) {
void Object::ShortPrint(StringStream* accumulator) {
OStringStream os;
std::ostringstream os;
os << Brief(this);
accumulator->Add(os.c_str());
accumulator->Add(os.str().c_str());
}
OStream& operator<<(OStream& os, const Brief& v) {
std::ostream& operator<<(std::ostream& os, const Brief& v) {
if (v.value->IsSmi()) {
Smi::cast(v.value)->SmiPrint(os);
} else {
@ -927,7 +929,7 @@ OStream& operator<<(OStream& os, const Brief& v) {
}
void Smi::SmiPrint(OStream& os) const { // NOLINT
void Smi::SmiPrint(std::ostream& os) const { // NOLINT
os << value();
}
@ -1172,7 +1174,7 @@ void String::StringShortPrint(StringStream* accumulator) {
}
void String::PrintUC16(OStream& os, int start, int end) { // NOLINT
void String::PrintUC16(std::ostream& os, int start, int end) { // NOLINT
if (end < 0) end = length();
ConsStringIteratorOp op;
StringCharacterStream stream(this, &op, start);
@ -1371,7 +1373,7 @@ void JSObject::PrintInstanceMigration(FILE* file,
}
void HeapObject::HeapObjectShortPrint(OStream& os) { // NOLINT
void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
Heap* heap = GetHeap();
if (!heap->Contains(this)) {
os << "!!!INVALID POINTER!!!";
@ -1668,7 +1670,7 @@ bool HeapNumber::HeapNumberBooleanValue() {
}
void HeapNumber::HeapNumberPrint(OStream& os) { // NOLINT
void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT
os << value();
}
@ -9810,7 +9812,7 @@ int SharedFunctionInfo::CalculateInObjectProperties() {
// Output the source code without any allocation in the heap.
OStream& operator<<(OStream& os, const SourceCodeOf& v) {
std::ostream& operator<<(std::ostream& os, const SourceCodeOf& v) {
const SharedFunctionInfo* s = v.value;
// For some native functions there is no source.
if (!s->HasSourceCode()) return os << "<No Source>";
@ -10630,7 +10632,7 @@ const char* Code::Kind2String(Kind kind) {
#ifdef ENABLE_DISASSEMBLER
void DeoptimizationInputData::DeoptimizationInputDataPrint(
OStream& os) { // NOLINT
std::ostream& os) { // NOLINT
disasm::NameConverter converter;
int deopt_count = DeoptCount();
os << "Deoptimization Input Data (deopt points = " << deopt_count << ")\n";
@ -10791,7 +10793,7 @@ void DeoptimizationInputData::DeoptimizationInputDataPrint(
void DeoptimizationOutputData::DeoptimizationOutputDataPrint(
OStream& os) { // NOLINT
std::ostream& os) { // NOLINT
os << "Deoptimization Output Data (deopt points = " << this->DeoptPoints()
<< ")\n";
if (this->DeoptPoints() == 0) return;
@ -10839,7 +10841,7 @@ const char* Code::StubType2String(StubType type) {
}
void Code::PrintExtraICState(OStream& os, // NOLINT
void Code::PrintExtraICState(std::ostream& os, // NOLINT
Kind kind, ExtraICState extra) {
os << "extra_ic_state = ";
if ((kind == STORE_IC || kind == KEYED_STORE_IC) && (extra == STRICT)) {
@ -10850,7 +10852,7 @@ void Code::PrintExtraICState(OStream& os, // NOLINT
}
void Code::Disassemble(const char* name, OStream& os) { // NOLINT
void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT
os << "kind = " << Kind2String(kind()) << "\n";
if (IsCodeStubOrIC()) {
const char* n = CodeStub::MajorName(CodeStub::GetMajorKey(this), true);
@ -13056,7 +13058,7 @@ bool JSObject::ShouldConvertToFastDoubleElements(
// we keep it here instead to satisfy certain compilers.
#ifdef OBJECT_PRINT
template <typename Derived, typename Shape, typename Key>
void Dictionary<Derived, Shape, Key>::Print(OStream& os) { // NOLINT
void Dictionary<Derived, Shape, Key>::Print(std::ostream& os) { // NOLINT
int capacity = DerivedHashTable::Capacity();
for (int i = 0; i < capacity; i++) {
Object* k = DerivedHashTable::KeyAt(i);

View File

@ -5,6 +5,8 @@
#ifndef V8_OBJECTS_H_
#define V8_OBJECTS_H_
#include <iosfwd>
#include "src/allocation.h"
#include "src/assert-scope.h"
#include "src/bailout-reason.h"
@ -148,8 +150,6 @@
namespace v8 {
namespace internal {
class OStream;
enum KeyedAccessStoreMode {
STANDARD_STORE,
STORE_TRANSITION_SMI_TO_OBJECT,
@ -869,7 +869,7 @@ template <class C> inline bool Is(Object* obj);
#endif
#ifdef OBJECT_PRINT
#define DECLARE_PRINTER(Name) void Name##Print(OStream& os); // NOLINT
#define DECLARE_PRINTER(Name) void Name##Print(std::ostream& os); // NOLINT
#else
#define DECLARE_PRINTER(Name)
#endif
@ -1222,7 +1222,7 @@ class Object {
void Print();
// Prints this object with details.
void Print(OStream& os); // NOLINT
void Print(std::ostream& os); // NOLINT
#endif
private:
@ -1242,7 +1242,7 @@ struct Brief {
};
OStream& operator<<(OStream& os, const Brief& v);
std::ostream& operator<<(std::ostream& os, const Brief& v);
// Smi represents integer Numbers that can be stored in 31 bits.
@ -1267,7 +1267,7 @@ class Smi: public Object {
DECLARE_CAST(Smi)
// Dispatched behavior.
void SmiPrint(OStream& os) const; // NOLINT
void SmiPrint(std::ostream& os) const; // NOLINT
DECLARE_VERIFIER(Smi)
static const int kMinValue =
@ -1410,9 +1410,9 @@ class HeapObject: public Object {
const DisallowHeapAllocation& promise);
// Dispatched behavior.
void HeapObjectShortPrint(OStream& os); // NOLINT
void HeapObjectShortPrint(std::ostream& os); // NOLINT
#ifdef OBJECT_PRINT
void PrintHeader(OStream& os, const char* id); // NOLINT
void PrintHeader(std::ostream& os, const char* id); // NOLINT
#endif
DECLARE_PRINTER(HeapObject)
DECLARE_VERIFIER(HeapObject)
@ -1499,7 +1499,7 @@ class HeapNumber: public HeapObject {
// Dispatched behavior.
bool HeapNumberBooleanValue();
void HeapNumberPrint(OStream& os); // NOLINT
void HeapNumberPrint(std::ostream& os); // NOLINT
DECLARE_VERIFIER(HeapNumber)
inline int get_exponent();
@ -2116,9 +2116,9 @@ class JSObject: public JSReceiver {
DECLARE_PRINTER(JSObject)
DECLARE_VERIFIER(JSObject)
#ifdef OBJECT_PRINT
void PrintProperties(OStream& os); // NOLINT
void PrintElements(OStream& os); // NOLINT
void PrintTransitions(OStream& os); // NOLINT
void PrintProperties(std::ostream& os); // NOLINT
void PrintElements(std::ostream& os); // NOLINT
void PrintTransitions(std::ostream& os); // NOLINT
#endif
static void PrintElementsTransition(
@ -3038,7 +3038,7 @@ class DescriptorArray: public FixedArray {
#ifdef OBJECT_PRINT
// Print all the descriptors.
void PrintDescriptors(OStream& os); // NOLINT
void PrintDescriptors(std::ostream& os); // NOLINT
#endif
#ifdef DEBUG
@ -3562,7 +3562,7 @@ class Dictionary: public HashTable<Derived, Shape, Key> {
static Handle<Derived> EnsureCapacity(Handle<Derived> obj, int n, Key key);
#ifdef OBJECT_PRINT
void Print(OStream& os); // NOLINT
void Print(std::ostream& os); // NOLINT
#endif
// Returns the key (slow).
Object* SlowReverseLookup(Object* value);
@ -4864,7 +4864,7 @@ class DeoptimizationInputData: public FixedArray {
DECLARE_CAST(DeoptimizationInputData)
#ifdef ENABLE_DISASSEMBLER
void DeoptimizationInputDataPrint(OStream& os); // NOLINT
void DeoptimizationInputDataPrint(std::ostream& os); // NOLINT
#endif
private:
@ -4909,7 +4909,7 @@ class DeoptimizationOutputData: public FixedArray {
DECLARE_CAST(DeoptimizationOutputData)
#if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
void DeoptimizationOutputDataPrint(OStream& os); // NOLINT
void DeoptimizationOutputDataPrint(std::ostream& os); // NOLINT
#endif
};
@ -4975,9 +4975,9 @@ class Code: public HeapObject {
// Printing
static const char* ICState2String(InlineCacheState state);
static const char* StubType2String(StubType type);
static void PrintExtraICState(OStream& os, // NOLINT
static void PrintExtraICState(std::ostream& os, // NOLINT
Kind kind, ExtraICState extra);
void Disassemble(const char* name, OStream& os); // NOLINT
void Disassemble(const char* name, std::ostream& os); // NOLINT
#endif // ENABLE_DISASSEMBLER
// [instruction_size]: Size of the native instructions
@ -7075,7 +7075,7 @@ struct SourceCodeOf {
};
OStream& operator<<(OStream& os, const SourceCodeOf& v);
std::ostream& operator<<(std::ostream& os, const SourceCodeOf& v);
class JSGeneratorObject: public JSObject {
@ -8788,7 +8788,7 @@ class String: public Name {
// Dispatched behavior.
void StringShortPrint(StringStream* accumulator);
void PrintUC16(OStream& os, int start = 0, int end = -1); // NOLINT
void PrintUC16(std::ostream& os, int start = 0, int end = -1); // NOLINT
#ifdef OBJECT_PRINT
char* ToAsciiArray();
#endif
@ -9713,7 +9713,7 @@ class OrderedHashTableIterator: public JSObject {
DECL_ACCESSORS(kind, Object)
#ifdef OBJECT_PRINT
void OrderedHashTableIteratorPrint(OStream& os); // NOLINT
void OrderedHashTableIteratorPrint(std::ostream& os); // NOLINT
#endif
static const int kTableOffset = JSObject::kHeaderSize;

View File

@ -4,11 +4,6 @@
#include "src/ostreams.h"
#include <algorithm>
#include <cmath>
#include "src/base/platform/platform.h" // For isinf/isnan with MSVC
#if V8_OS_WIN
#define snprintf sprintf_s
#endif
@ -16,174 +11,52 @@
namespace v8 {
namespace internal {
// Be lazy and delegate the value=>char conversion to snprintf.
template<class T>
OStream& OStream::print(const char* format, T x) {
char buf[32];
int n = snprintf(buf, sizeof(buf), format, x);
return (n < 0) ? *this : write(buf, n);
OFStreamBase::OFStreamBase(FILE* f) : f_(f) {}
OFStreamBase::~OFStreamBase() {}
OFStreamBase::int_type OFStreamBase::sync() { return 0; }
OFStreamBase::int_type OFStreamBase::overflow(int_type c) {
return (c != EOF) ? std::fputc(c, f_) : c;
}
OStream& OStream::operator<<(short x) { // NOLINT(runtime/int)
return print(hex_ ? "%hx" : "%hd", x);
}
OFStream::OFStream(FILE* f) : OFStreamBase(f), std::ostream(this) {}
OStream& OStream::operator<<(unsigned short x) { // NOLINT(runtime/int)
return print(hex_ ? "%hx" : "%hu", x);
}
OFStream::~OFStream() {}
OStream& OStream::operator<<(int x) {
return print(hex_ ? "%x" : "%d", x);
}
OStream& OStream::operator<<(unsigned int x) {
return print(hex_ ? "%x" : "%u", x);
}
OStream& OStream::operator<<(long x) { // NOLINT(runtime/int)
return print(hex_ ? "%lx" : "%ld", x);
}
OStream& OStream::operator<<(unsigned long x) { // NOLINT(runtime/int)
return print(hex_ ? "%lx" : "%lu", x);
}
OStream& OStream::operator<<(long long x) { // NOLINT(runtime/int)
return print(hex_ ? "%llx" : "%lld", x);
}
OStream& OStream::operator<<(unsigned long long x) { // NOLINT(runtime/int)
return print(hex_ ? "%llx" : "%llu", x);
}
OStream& OStream::operator<<(double x) {
if (std::isinf(x)) return *this << (x < 0 ? "-inf" : "inf");
if (std::isnan(x)) return *this << "nan";
return print("%g", x);
}
OStream& OStream::operator<<(void* x) {
return print("%p", x);
}
OStream& OStream::operator<<(char x) {
return put(x);
}
OStream& OStream::operator<<(signed char x) {
return put(x);
}
OStream& OStream::operator<<(unsigned char x) {
return put(x);
}
OStream& OStream::dec() {
hex_ = false;
return *this;
}
OStream& OStream::hex() {
hex_ = true;
return *this;
}
OStream& flush(OStream& os) { // NOLINT(runtime/references)
return os.flush();
}
OStream& endl(OStream& os) { // NOLINT(runtime/references)
return flush(os.put('\n'));
}
OStream& hex(OStream& os) { // NOLINT(runtime/references)
return os.hex();
}
OStream& dec(OStream& os) { // NOLINT(runtime/references)
return os.dec();
}
OStringStream& OStringStream::write(const char* s, size_t n) {
size_t new_size = size_ + n;
if (new_size < size_) return *this; // Overflow => no-op.
reserve(new_size + 1);
memcpy(data_ + size_, s, n);
size_ = new_size;
data_[size_] = '\0';
return *this;
}
OStringStream& OStringStream::flush() {
return *this;
}
void OStringStream::reserve(size_t requested_capacity) {
if (requested_capacity <= capacity_) return;
size_t new_capacity = // Handle possible overflow by not doubling.
std::max(std::max(capacity_ * 2, capacity_), requested_capacity);
char * new_data = allocate(new_capacity);
memcpy(new_data, data_, size_);
deallocate(data_, capacity_);
capacity_ = new_capacity;
data_ = new_data;
}
OFStream& OFStream::write(const char* s, size_t n) {
if (f_) fwrite(s, n, 1, f_);
return *this;
}
OFStream& OFStream::flush() {
if (f_) fflush(f_);
return *this;
}
namespace {
// Locale-independent predicates.
static bool IsPrint(uint16_t c) { return 0x20 <= c && c <= 0x7e; }
static bool IsSpace(uint16_t c) { return (0x9 <= c && c <= 0xd) || c == 0x20; }
static bool IsOK(uint16_t c) { return (IsPrint(c) || IsSpace(c)) && c != '\\'; }
bool IsPrint(uint16_t c) { return 0x20 <= c && c <= 0x7e; }
bool IsSpace(uint16_t c) { return (0x9 <= c && c <= 0xd) || c == 0x20; }
bool IsOK(uint16_t c) { return (IsPrint(c) || IsSpace(c)) && c != '\\'; }
static OStream& PrintUC16(OStream& os, uint16_t c, bool (*pred)(uint16_t)) {
std::ostream& PrintUC16(std::ostream& os, uint16_t c, bool (*pred)(uint16_t)) {
char buf[10];
const char* format = pred(c) ? "%c" : (c <= 0xff) ? "\\x%02x" : "\\u%04x";
snprintf(buf, sizeof(buf), format, c);
return os << buf;
}
} // namespace
OStream& operator<<(OStream& os, const AsReversiblyEscapedUC16& c) {
std::ostream& operator<<(std::ostream& os, const AsReversiblyEscapedUC16& c) {
return PrintUC16(os, c.value, IsOK);
}
OStream& operator<<(OStream& os, const AsUC16& c) {
std::ostream& operator<<(std::ostream& os, const AsUC16& c) {
return PrintUC16(os, c.value, IsPrint);
}
} } // namespace v8::internal
} // namespace internal
} // namespace v8

View File

@ -5,9 +5,11 @@
#ifndef V8_OSTREAMS_H_
#define V8_OSTREAMS_H_
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <cstddef>
#include <cstdio>
#include <cstring>
#include <ostream> // NOLINT
#include <streambuf>
#include "include/v8config.h"
#include "src/base/macros.h"
@ -15,104 +17,28 @@
namespace v8 {
namespace internal {
// An abstract base class for output streams with a cut-down standard interface.
class OStream {
public:
OStream() : hex_(false) { }
virtual ~OStream() { }
class OFStreamBase : public std::streambuf {
protected:
explicit OFStreamBase(FILE* f);
virtual ~OFStreamBase();
// For manipulators like 'os << endl' or 'os << flush', etc.
OStream& operator<<(OStream& (*manipulator)(OStream& os)) {
return manipulator(*this);
}
// Numeric conversions.
OStream& operator<<(short x); // NOLINT(runtime/int)
OStream& operator<<(unsigned short x); // NOLINT(runtime/int)
OStream& operator<<(int x);
OStream& operator<<(unsigned int x);
OStream& operator<<(long x); // NOLINT(runtime/int)
OStream& operator<<(unsigned long x); // NOLINT(runtime/int)
OStream& operator<<(long long x); // NOLINT(runtime/int)
OStream& operator<<(unsigned long long x); // NOLINT(runtime/int)
OStream& operator<<(double x);
OStream& operator<<(void* x);
// Character output.
OStream& operator<<(char x);
OStream& operator<<(signed char x);
OStream& operator<<(unsigned char x);
OStream& operator<<(const char* s) { return write(s, strlen(s)); }
OStream& put(char c) { return write(&c, 1); }
// Primitive format flag handling, can be extended if needed.
OStream& dec();
OStream& hex();
virtual OStream& write(const char* s, size_t n) = 0;
virtual OStream& flush() = 0;
private:
template<class T> OStream& print(const char* format, T x);
bool hex_;
DISALLOW_COPY_AND_ASSIGN(OStream);
};
// Some manipulators.
OStream& flush(OStream& os); // NOLINT(runtime/references)
OStream& endl(OStream& os); // NOLINT(runtime/references)
OStream& dec(OStream& os); // NOLINT(runtime/references)
OStream& hex(OStream& os); // NOLINT(runtime/references)
// An output stream writing to a character buffer.
class OStringStream: public OStream {
public:
OStringStream() : size_(0), capacity_(32), data_(allocate(capacity_)) {
data_[0] = '\0';
}
~OStringStream() { deallocate(data_, capacity_); }
size_t size() const { return size_; }
size_t capacity() const { return capacity_; }
const char* data() const { return data_; }
// Internally, our character data is always 0-terminated.
const char* c_str() const { return data(); }
virtual OStringStream& write(const char* s, size_t n) OVERRIDE;
virtual OStringStream& flush() OVERRIDE;
private:
// Primitive allocator interface, can be extracted if needed.
static char* allocate (size_t n) { return new char[n]; }
static void deallocate (char* s, size_t n) { delete[] s; }
void reserve(size_t requested_capacity);
size_t size_;
size_t capacity_;
char* data_;
DISALLOW_COPY_AND_ASSIGN(OStringStream);
};
// An output stream writing to a file.
class OFStream: public OStream {
public:
explicit OFStream(FILE* f) : f_(f) { }
virtual ~OFStream() { }
virtual OFStream& write(const char* s, size_t n) OVERRIDE;
virtual OFStream& flush() OVERRIDE;
virtual int_type sync() FINAL;
virtual int_type overflow(int_type c) FINAL;
private:
FILE* const f_;
DISALLOW_COPY_AND_ASSIGN(OFStreamBase);
};
// An output stream writing to a file.
class OFStream FINAL : private virtual OFStreamBase, public std::ostream {
public:
explicit OFStream(FILE* f);
~OFStream();
private:
DISALLOW_COPY_AND_ASSIGN(OFStream);
};
@ -133,11 +59,13 @@ struct AsReversiblyEscapedUC16 {
// Writes the given character to the output escaping everything outside of
// printable/space ASCII range. Additionally escapes '\' making escaping
// reversible.
OStream& operator<<(OStream& os, const AsReversiblyEscapedUC16& c);
std::ostream& operator<<(std::ostream& os, const AsReversiblyEscapedUC16& c);
// Writes the given character to the output escaping everything outside
// of printable ASCII range.
OStream& operator<<(OStream& os, const AsUC16& c);
} } // namespace v8::internal
std::ostream& operator<<(std::ostream& os, const AsUC16& c);
} // namespace internal
} // namespace v8
#endif // V8_OSTREAMS_H_

View File

@ -20,7 +20,7 @@ void LookupResult::Iterate(ObjectVisitor* visitor) {
}
OStream& operator<<(OStream& os, const LookupResult& r) {
std::ostream& operator<<(std::ostream& os, const LookupResult& r) {
if (!r.IsFound()) return os << "Not Found\n";
os << "LookupResult:\n";
@ -31,7 +31,7 @@ OStream& operator<<(OStream& os, const LookupResult& r) {
}
OStream& operator<<(OStream& os, const Descriptor& d) {
std::ostream& operator<<(std::ostream& os, const Descriptor& d) {
return os << "Descriptor " << Brief(*d.GetKey()) << " @ "
<< Brief(*d.GetValue());
}

View File

@ -5,6 +5,8 @@
#ifndef V8_PROPERTY_H_
#define V8_PROPERTY_H_
#include <iosfwd>
#include "src/factory.h"
#include "src/field-index.h"
#include "src/field-index-inl.h"
@ -14,8 +16,6 @@
namespace v8 {
namespace internal {
class OStream;
// Abstraction for elements in instance-descriptor arrays.
//
// Each descriptor has a key, property attributes, property type,
@ -70,7 +70,7 @@ class Descriptor BASE_EMBEDDED {
};
OStream& operator<<(OStream& os, const Descriptor& d);
std::ostream& operator<<(std::ostream& os, const Descriptor& d);
class FieldDescriptor FINAL : public Descriptor {
@ -249,7 +249,7 @@ class LookupResult FINAL BASE_EMBEDDED {
};
OStream& operator<<(OStream& os, const LookupResult& r);
std::ostream& operator<<(std::ostream& os, const LookupResult& r);
} } // namespace v8::internal
#endif // V8_PROPERTY_H_

View File

@ -2487,7 +2487,7 @@ RUNTIME_FUNCTION(Runtime_DebugDisassembleFunction) {
}
OFStream os(stdout);
func->code()->Print(os);
os << endl;
os << std::endl;
#endif // DEBUG
return isolate->heap()->undefined_value();
}
@ -2504,7 +2504,7 @@ RUNTIME_FUNCTION(Runtime_DebugDisassembleConstructor) {
}
OFStream os(stdout);
func->shared()->construct_stub()->Print(os);
os << endl;
os << std::endl;
#endif // DEBUG
return isolate->heap()->undefined_value();
}

View File

@ -215,7 +215,7 @@ RUNTIME_FUNCTION(Runtime_DebugPrint) {
// ShortPrint is available in release mode. Print is not.
os << Brief(args[0]);
#endif
os << endl;
os << std::endl;
return args[0]; // return TOS
}

View File

@ -61,7 +61,8 @@ SafepointEntry SafepointTable::FindEntry(Address pc) const {
}
void SafepointTable::PrintEntry(unsigned index, OStream& os) const { // NOLINT
void SafepointTable::PrintEntry(unsigned index,
std::ostream& os) const { // NOLINT
disasm::NameConverter converter;
SafepointEntry entry = GetEntry(index);
uint8_t* bits = entry.bits();
@ -86,7 +87,7 @@ void SafepointTable::PrintEntry(unsigned index, OStream& os) const { // NOLINT
}
void SafepointTable::PrintBits(OStream& os, // NOLINT
void SafepointTable::PrintBits(std::ostream& os, // NOLINT
uint8_t byte, int digits) {
DCHECK(digits >= 0 && digits <= kBitsPerByte);
for (int i = 0; i < digits; i++) {

View File

@ -104,7 +104,7 @@ class SafepointTable BASE_EMBEDDED {
// Returns the entry for the given pc.
SafepointEntry FindEntry(Address pc) const;
void PrintEntry(unsigned index, OStream& os) const; // NOLINT
void PrintEntry(unsigned index, std::ostream& os) const; // NOLINT
private:
static const uint8_t kNoRegisters = 0xFF;
@ -127,7 +127,7 @@ class SafepointTable BASE_EMBEDDED {
return GetPcOffsetLocation(index) + kPcSize;
}
static void PrintBits(OStream& os, // NOLINT
static void PrintBits(std::ostream& os, // NOLINT
uint8_t byte, int digits);
DisallowHeapAllocation no_allocation_;

View File

@ -140,7 +140,7 @@ class TransitionArray: public FixedArray {
#ifdef OBJECT_PRINT
// Print all the transitions.
void PrintTransitions(OStream& os); // NOLINT
void PrintTransitions(std::ostream& os); // NOLINT
#endif
#ifdef DEBUG

View File

@ -995,7 +995,7 @@ const char* TypeImpl<Config>::BitsetType::Name(bitset bits) {
template <class Config>
void TypeImpl<Config>::BitsetType::Print(OStream& os, // NOLINT
void TypeImpl<Config>::BitsetType::Print(std::ostream& os, // NOLINT
bitset bits) {
DisallowHeapAllocation no_allocation;
const char* name = Name(bits);
@ -1031,7 +1031,7 @@ void TypeImpl<Config>::BitsetType::Print(OStream& os, // NOLINT
template <class Config>
void TypeImpl<Config>::PrintTo(OStream& os, PrintDimension dim) { // NOLINT
void TypeImpl<Config>::PrintTo(std::ostream& os, PrintDimension dim) {
DisallowHeapAllocation no_allocation;
if (dim != REPRESENTATION_DIM) {
if (this->IsBitset()) {
@ -1089,13 +1089,13 @@ template <class Config>
void TypeImpl<Config>::Print() {
OFStream os(stdout);
PrintTo(os);
os << endl;
os << std::endl;
}
template <class Config>
void TypeImpl<Config>::BitsetType::Print(bitset bits) {
OFStream os(stdout);
Print(os, bits);
os << endl;
os << std::endl;
}
#endif

View File

@ -478,7 +478,7 @@ class TypeImpl : public Config::Base {
enum PrintDimension { BOTH_DIMS, SEMANTIC_DIM, REPRESENTATION_DIM };
void PrintTo(OStream& os, PrintDimension dim = BOTH_DIMS); // NOLINT
void PrintTo(std::ostream& os, PrintDimension dim = BOTH_DIMS); // NOLINT
#ifdef DEBUG
void Print();
@ -606,7 +606,7 @@ class TypeImpl<Config>::BitsetType : public TypeImpl<Config> {
static bitset Lub(Limits lim);
static const char* Name(bitset);
static void Print(OStream& os, bitset); // NOLINT
static void Print(std::ostream& os, bitset); // NOLINT
#ifdef DEBUG
static void Print(bitset);
#endif

View File

@ -56,7 +56,7 @@ void AstTyper::Run(CompilationInfo* info) {
var->name()->Print(os);
os << " : " << Brief(value) << " -> ";
type->PrintTo(os);
os << endl;
os << std::endl;
}
#endif // OBJECT_PRINT

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <sstream>
#include "src/v8.h"
#if V8_TARGET_ARCH_X64
@ -360,9 +362,9 @@ LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) {
void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
OStringStream os;
std::ostringstream os;
os << hydrogen()->access() << " <- ";
stream->Add(os.c_str());
stream->Add(os.str().c_str());
value()->PrintTo(stream);
}

View File

@ -376,7 +376,7 @@ LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) {
void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
OStringStream os;
std::ostringstream os;
os << hydrogen()->access() << " <- ";
stream->Add(os.c_str());
value()->PrintTo(stream);

View File

@ -135,7 +135,6 @@
'test-mementos.cc',
'test-object-observe.cc',
'test-ordered-hash-table.cc',
'test-ostreams.cc',
'test-parsing.cc',
'test-platform.cc',
'test-profile-generator.cc',

View File

@ -58,7 +58,8 @@ class InterpreterState {
return Value(op->kind(), op->index());
}
friend OStream& operator<<(OStream& os, const InterpreterState& is) {
friend std::ostream& operator<<(std::ostream& os,
const InterpreterState& is) {
for (OperandMap::const_iterator it = is.values_.begin();
it != is.values_.end(); ++it) {
if (it != is.values_.begin()) os << " ";

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <sstream>
#include "src/v8.h"
#include "src/compiler/operator.h"
@ -11,7 +13,6 @@ using namespace v8::internal;
using namespace v8::internal::compiler;
#define NaN (v8::base::OS::nan_value())
#define Infinity (std::numeric_limits<double>::infinity())
TEST(TestOperatorMnemonic) {
SimpleOperator op1(10, Operator::kNoProperties, 0, 0, "ThisOne");
@ -67,9 +68,9 @@ TEST(TestSimpleOperatorEquals) {
static SmartArrayPointer<const char> OperatorToString(Operator* op) {
OStringStream os;
std::ostringstream os;
os << *op;
return SmartArrayPointer<const char>(StrDup(os.c_str()));
return SmartArrayPointer<const char>(StrDup(os.str().c_str()));
}
@ -236,9 +237,6 @@ TEST(TestOperator1doublePrint) {
Operator1<double> op3(12, Operator::kNoProperties, 0, 1, "FooBar", 2e+123);
CHECK_EQ("FooBar[2e+123]", OperatorToString(&op3).get());
Operator1<double> op4(12, Operator::kNoProperties, 0, 1, "BarFoo", Infinity);
CHECK_EQ("BarFoo[inf]", OperatorToString(&op4).get());
Operator1<double> op5(12, Operator::kNoProperties, 0, 1, "BarFoo", NaN);
CHECK_EQ("BarFoo[nan]", OperatorToString(&op5).get());
}

View File

@ -95,7 +95,7 @@ static Schedule* ComputeAndVerifySchedule(int expected, Graph* graph) {
if (FLAG_trace_turbo_scheduler) {
OFStream os(stdout);
os << *schedule << endl;
os << *schedule << std::endl;
}
ScheduleVerifier::Run(schedule);
CHECK_EQ(expected, GetScheduledNodeCount(schedule));

View File

@ -3076,7 +3076,7 @@ TEST(PrintSharedFunctionInfo) {
OFStream os(stdout);
g->shared()->Print(os);
os << endl;
os << std::endl;
}
#endif // OBJECT_PRINT

View File

@ -1,148 +0,0 @@
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string.h>
#include <limits>
#include "include/v8stdint.h"
#include "src/ostreams.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
TEST(OStringStreamConstructor) {
OStringStream oss;
const size_t expected_size = 0;
CHECK(expected_size == oss.size());
CHECK_GT(oss.capacity(), 0);
CHECK_NE(NULL, oss.data());
CHECK_EQ("", oss.c_str());
}
#define TEST_STRING \
"Ash nazg durbatuluk, " \
"ash nazg gimbatul, " \
"ash nazg thrakatuluk, " \
"agh burzum-ishi krimpatul."
TEST(OStringStreamGrow) {
OStringStream oss;
const int repeat = 30;
size_t len = strlen(TEST_STRING);
for (int i = 0; i < repeat; ++i) {
oss.write(TEST_STRING, len);
}
const char* expected =
TEST_STRING TEST_STRING TEST_STRING TEST_STRING TEST_STRING
TEST_STRING TEST_STRING TEST_STRING TEST_STRING TEST_STRING
TEST_STRING TEST_STRING TEST_STRING TEST_STRING TEST_STRING
TEST_STRING TEST_STRING TEST_STRING TEST_STRING TEST_STRING
TEST_STRING TEST_STRING TEST_STRING TEST_STRING TEST_STRING
TEST_STRING TEST_STRING TEST_STRING TEST_STRING TEST_STRING;
const size_t expected_len = len * repeat;
CHECK(expected_len == oss.size());
CHECK_GT(oss.capacity(), 0);
CHECK_EQ(0, strncmp(expected, oss.data(), expected_len));
CHECK_EQ(expected, oss.c_str());
}
template <class T>
static void check(const char* expected, T value) {
OStringStream oss;
oss << value << " " << hex << value;
CHECK_EQ(expected, oss.c_str());
}
TEST(NumericFormatting) {
check<bool>("0 0", false);
check<bool>("1 1", true);
check<int16_t>("-12345 cfc7", -12345);
check<int16_t>("-32768 8000", std::numeric_limits<int16_t>::min());
check<int16_t>("32767 7fff", std::numeric_limits<int16_t>::max());
check<uint16_t>("34567 8707", 34567);
check<uint16_t>("0 0", std::numeric_limits<uint16_t>::min());
check<uint16_t>("65535 ffff", std::numeric_limits<uint16_t>::max());
check<int32_t>("-1234567 ffed2979", -1234567);
check<int32_t>("-2147483648 80000000", std::numeric_limits<int32_t>::min());
check<int32_t>("2147483647 7fffffff", std::numeric_limits<int32_t>::max());
check<uint32_t>("3456789 34bf15", 3456789);
check<uint32_t>("0 0", std::numeric_limits<uint32_t>::min());
check<uint32_t>("4294967295 ffffffff", std::numeric_limits<uint32_t>::max());
check<int64_t>("-1234567 ffffffffffed2979", -1234567);
check<int64_t>("-9223372036854775808 8000000000000000",
std::numeric_limits<int64_t>::min());
check<int64_t>("9223372036854775807 7fffffffffffffff",
std::numeric_limits<int64_t>::max());
check<uint64_t>("3456789 34bf15", 3456789);
check<uint64_t>("0 0", std::numeric_limits<uint64_t>::min());
check<uint64_t>("18446744073709551615 ffffffffffffffff",
std::numeric_limits<uint64_t>::max());
check<float>("0 0", 0.0f);
check<float>("123 123", 123.0f);
check<float>("-0.5 -0.5", -0.5f);
check<float>("1.25 1.25", 1.25f);
check<float>("0.0625 0.0625", 6.25e-2f);
check<double>("0 0", 0.0);
check<double>("123 123", 123.0);
check<double>("-0.5 -0.5", -0.5);
check<double>("1.25 1.25", 1.25);
check<double>("0.0625 0.0625", 6.25e-2);
}
TEST(CharacterOutput) {
check<char>("a a", 'a');
check<signed char>("B B", 'B');
check<unsigned char>("9 9", '9');
check<const char*>("bye bye", "bye");
OStringStream os;
os.put('H').write("ello", 4);
CHECK_EQ("Hello", os.c_str());
}
TEST(Manipulators) {
OStringStream os;
os << 123 << hex << 123 << endl << 123 << dec << 123 << 123;
CHECK_EQ("1237b\n7b123123", os.c_str());
}
class MiscStuff {
public:
MiscStuff(int i, double d, const char* s) : i_(i), d_(d), s_(s) { }
private:
friend OStream& operator<<(OStream& os, const MiscStuff& m);
int i_;
double d_;
const char* s_;
};
OStream& operator<<(OStream& os, const MiscStuff& m) {
return os << "{i:" << m.i_ << ", d:" << m.d_ << ", s:'" << m.s_ << "'}";
}
TEST(CustomOutput) {
OStringStream os;
MiscStuff m(123, 4.5, "Hurz!");
os << m;
CHECK_EQ("{i:123, d:4.5, s:'Hurz!'}", os.c_str());
}

View File

@ -25,8 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdlib.h>
#include <cstdlib>
#include <sstream>
#include "src/v8.h"
@ -103,9 +103,9 @@ static void CheckParseEq(const char* input, const char* expected) {
&reader, false, &result, &zone));
CHECK(result.tree != NULL);
CHECK(result.error.is_null());
OStringStream os;
std::ostringstream os;
result.tree->Print(os, &zone);
CHECK_EQ(expected, os.c_str());
CHECK_EQ(expected, os.str().c_str());
}
@ -435,11 +435,11 @@ TEST(Errors) {
// Check that we don't allow more than kMaxCapture captures
const int kMaxCaptures = 1 << 16; // Must match RegExpParser::kMaxCaptures.
const char* kTooManyCaptures = "Too many captures";
OStringStream os;
std::ostringstream os;
for (int i = 0; i <= kMaxCaptures; i++) {
os << "()";
}
ExpectError(os.c_str(), kTooManyCaptures);
ExpectError(os.str().c_str(), kTooManyCaptures);
}