From 8537e167f238574440151f1c50c7868fcdfb7811 Mon Sep 17 00:00:00 2001 From: "ishell@chromium.org" Date: Thu, 21 Nov 2013 16:55:16 +0000 Subject: [PATCH] Code object now prints its major_key when applicable. R=jkummerow@chromium.org Review URL: https://codereview.chromium.org/81043002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17980 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/objects-inl.h | 38 +++++++++++++++++--------------------- src/objects.cc | 5 +++++ src/objects.h | 1 + 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/objects-inl.h b/src/objects-inl.h index 2e8c0ad..fa6b6f3 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -3874,33 +3874,14 @@ inline void Code::set_is_crankshafted(bool value) { int Code::major_key() { - ASSERT(kind() == STUB || - kind() == HANDLER || - kind() == BINARY_OP_IC || - kind() == COMPARE_IC || - kind() == COMPARE_NIL_IC || - kind() == STORE_IC || - kind() == LOAD_IC || - kind() == KEYED_LOAD_IC || - kind() == KEYED_CALL_IC || - kind() == TO_BOOLEAN_IC); + ASSERT(has_major_key()); return StubMajorKeyField::decode( READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); } void Code::set_major_key(int major) { - ASSERT(kind() == STUB || - kind() == HANDLER || - kind() == BINARY_OP_IC || - kind() == COMPARE_IC || - kind() == COMPARE_NIL_IC || - kind() == LOAD_IC || - kind() == KEYED_LOAD_IC || - kind() == STORE_IC || - kind() == KEYED_STORE_IC || - kind() == KEYED_CALL_IC || - kind() == TO_BOOLEAN_IC); + ASSERT(has_major_key()); ASSERT(0 <= major && major < 256); int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); int updated = StubMajorKeyField::update(previous, major); @@ -3908,6 +3889,21 @@ void Code::set_major_key(int major) { } +bool Code::has_major_key() { + return kind() == STUB || + kind() == HANDLER || + kind() == BINARY_OP_IC || + kind() == COMPARE_IC || + kind() == COMPARE_NIL_IC || + kind() == LOAD_IC || + kind() == KEYED_LOAD_IC || + kind() == STORE_IC || + kind() == KEYED_STORE_IC || + kind() == KEYED_CALL_IC || + kind() == TO_BOOLEAN_IC; +} + + bool Code::is_pregenerated() { return (kind() == STUB && IsPregeneratedField::decode(flags())); } diff --git a/src/objects.cc b/src/objects.cc index c874ee3..2b38b1d 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -33,6 +33,7 @@ #include "arguments.h" #include "bootstrapper.h" #include "codegen.h" +#include "code-stubs.h" #include "cpu-profiler.h" #include "debug.h" #include "deoptimizer.h" @@ -11135,6 +11136,10 @@ void Code::PrintExtraICState(FILE* out, Kind kind, ExtraICState extra) { void Code::Disassemble(const char* name, FILE* out) { PrintF(out, "kind = %s\n", Kind2String(kind())); + if (has_major_key()) { + PrintF(out, "major_key = %s\n", + CodeStub::MajorName(CodeStub::GetMajorKey(this), true)); + } if (is_inline_cache_stub()) { PrintF(out, "ic_state = %s\n", ICState2String(ic_state())); PrintExtraICState(out, kind(), needs_extended_extra_ic_state(kind()) ? diff --git a/src/objects.h b/src/objects.h index ffde816..1e26178 100644 --- a/src/objects.h +++ b/src/objects.h @@ -5141,6 +5141,7 @@ class Code: public HeapObject { // [major_key]: For kind STUB or BINARY_OP_IC, the major key. inline int major_key(); inline void set_major_key(int value); + inline bool has_major_key(); // For kind STUB or ICs, tells whether or not a code object was generated by // the optimizing compiler (but it may not be an optimized function). -- 2.7.4