From: ishell@chromium.org Date: Thu, 21 Nov 2013 16:55:16 +0000 (+0000) Subject: Code object now prints its major_key when applicable. X-Git-Tag: upstream/4.7.83~11610 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8537e167f238574440151f1c50c7868fcdfb7811;p=platform%2Fupstream%2Fv8.git 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 --- 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).