From 1dd19c450a895dccc0f6fcfe205318dc6d05cc41 Mon Sep 17 00:00:00 2001 From: "mvstanton@chromium.org" Date: Wed, 18 Dec 2013 22:51:23 +0000 Subject: [PATCH] Pretty printing for array code stubs. The minor keys encode things like specialized ElementsKind for each stub. This can be useful to see in disassembly traces. R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/110103002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18369 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/code-stubs.cc | 22 ++++++++++++++++++++++ src/code-stubs.h | 16 ++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/code-stubs.cc b/src/code-stubs.cc index 275beb4..9003852 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -585,6 +585,28 @@ void CallConstructStub::PrintName(StringStream* stream) { } +void ArrayConstructorStub::PrintName(StringStream* stream) { + stream->Add("ArrayConstructorStub"); + switch (argument_count_) { + case ANY: stream->Add("_Any"); break; + case NONE: stream->Add("_None"); break; + case ONE: stream->Add("_One"); break; + case MORE_THAN_ONE: stream->Add("_More_Than_One"); break; + } +} + + +void ArrayConstructorStubBase::BasePrintName(const char* name, + StringStream* stream) { + stream->Add(name); + stream->Add("_"); + stream->Add(ElementsKindToString(elements_kind())); + if (override_mode() == DISABLE_ALLOCATION_SITES) { + stream->Add("_DISABLE_ALLOCATION_SITES"); + } +} + + bool ToBooleanStub::UpdateStatus(Handle object) { Types old_types(types_); bool to_boolean_value = types_.UpdateStatus(object); diff --git a/src/code-stubs.h b/src/code-stubs.h index 2ab62b0..5678ebd 100644 --- a/src/code-stubs.h +++ b/src/code-stubs.h @@ -741,6 +741,7 @@ class ArrayConstructorStub: public PlatformCodeStub { private: void GenerateDispatchToArrayStub(MacroAssembler* masm, AllocationSiteOverrideMode mode); + virtual void PrintName(StringStream* stream); virtual CodeStub::Major MajorKey() { return ArrayConstructor; } virtual int MinorKey() { return argument_count_; } @@ -1933,6 +1934,9 @@ class ArrayConstructorStubBase : public HydrogenCodeStub { static const int kConstructor = 0; static const int kPropertyCell = 1; + protected: + void BasePrintName(const char* name, StringStream* stream); + private: int NotMissMinorKey() { return bit_field_; } @@ -1968,6 +1972,10 @@ class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { private: Major MajorKey() { return ArrayNoArgumentConstructor; } + virtual void PrintName(StringStream* stream) { + BasePrintName("ArrayNoArgumentConstructorStub", stream); + } + DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); }; @@ -1990,6 +1998,10 @@ class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { private: Major MajorKey() { return ArraySingleArgumentConstructor; } + virtual void PrintName(StringStream* stream) { + BasePrintName("ArraySingleArgumentConstructorStub", stream); + } + DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); }; @@ -2012,6 +2024,10 @@ class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { private: Major MajorKey() { return ArrayNArgumentsConstructor; } + virtual void PrintName(StringStream* stream) { + BasePrintName("ArrayNArgumentsConstructorStub", stream); + } + DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); }; -- 2.7.4