From 901f20b0527510438f349f08e22a68cb14a34d88 Mon Sep 17 00:00:00 2001 From: "svenpanne@chromium.org" Date: Fri, 23 Sep 2011 11:51:05 +0000 Subject: [PATCH] Improved printing of a few Hydrogen instructions. Review URL: http://codereview.chromium.org/8002021 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9413 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/hydrogen-instructions.cc | 39 ++++++++++++++++++++++++++++++++++++ src/hydrogen-instructions.h | 10 +++++++++ 2 files changed, 49 insertions(+) diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index 658f5e1505..1497526f23 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -707,6 +707,14 @@ void HUnaryControlInstruction::PrintDataTo(StringStream* stream) { } +void HIsNilAndBranch::PrintDataTo(StringStream* stream) { + value()->PrintNameTo(stream); + stream->Add(kind() == kStrictEquality ? " === " : " == "); + stream->Add(nil() == kNullValue ? "null" : "undefined"); + HControlInstruction::PrintDataTo(stream); +} + + void HReturn::PrintDataTo(StringStream* stream) { value()->PrintNameTo(stream); } @@ -777,6 +785,12 @@ void HTypeofIsAndBranch::PrintDataTo(StringStream* stream) { value()->PrintNameTo(stream); stream->Add(" == "); stream->Add(type_literal_->GetFlatContent().ToAsciiVector()); + HControlInstruction::PrintDataTo(stream); +} + + +void HTypeof::PrintDataTo(StringStream* stream) { + value()->PrintNameTo(stream); } @@ -857,6 +871,23 @@ void HCheckFunction::PrintDataTo(StringStream* stream) { } +const char* HCheckInstanceType::GetCheckName() { + switch (check_) { + case IS_SPEC_OBJECT: return "object"; + case IS_JS_ARRAY: return "array"; + case IS_STRING: return "string"; + case IS_SYMBOL: return "symbol"; + } + UNREACHABLE(); + return ""; +} + +void HCheckInstanceType::PrintDataTo(StringStream* stream) { + stream->Add("%s ", GetCheckName()); + HUnaryOperation::PrintDataTo(stream); +} + + void HCallStub::PrintDataTo(StringStream* stream) { stream->Add("%s ", CodeStub::MajorName(major_key_, false)); @@ -1311,6 +1342,14 @@ void HCompareIDAndBranch::PrintDataTo(StringStream* stream) { } +void HCompareObjectEqAndBranch::PrintDataTo(StringStream* stream) { + left()->PrintNameTo(stream); + stream->Add(" "); + right()->PrintNameTo(stream); + HControlInstruction::PrintDataTo(stream); +} + + void HGoto::PrintDataTo(StringStream* stream) { stream->Add("B%d", SuccessorAt(0)->block_id()); } diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index fefe0c1335..4a25da07e5 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -1978,6 +1978,8 @@ class HCheckInstanceType: public HUnaryOperation { return new HCheckInstanceType(value, IS_SYMBOL); } + virtual void PrintDataTo(StringStream* stream); + virtual Representation RequiredInputRepresentation(int index) const { return Representation::Tagged(); } @@ -2008,6 +2010,8 @@ class HCheckInstanceType: public HUnaryOperation { LAST_INTERVAL_CHECK = IS_JS_ARRAY }; + const char* GetCheckName(); + HCheckInstanceType(HValue* value, Check check) : HUnaryOperation(value), check_(check) { set_representation(Representation::Tagged()); @@ -2623,6 +2627,8 @@ class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { HValue* left() { return OperandAt(0); } HValue* right() { return OperandAt(1); } + virtual void PrintDataTo(StringStream* stream); + virtual Representation RequiredInputRepresentation(int index) const { return Representation::Tagged(); } @@ -2662,6 +2668,8 @@ class HIsNilAndBranch: public HUnaryControlInstruction { EqualityKind kind() const { return kind_; } NilValue nil() const { return nil_; } + virtual void PrintDataTo(StringStream* stream); + virtual Representation RequiredInputRepresentation(int index) const { return Representation::Tagged(); } @@ -4129,6 +4137,8 @@ class HTypeof: public HTemplateInstruction<2> { HValue* context() { return OperandAt(0); } HValue* value() { return OperandAt(1); } + virtual void PrintDataTo(StringStream* stream); + virtual Representation RequiredInputRepresentation(int index) const { return Representation::Tagged(); }