Commit 8537e167 authored by ishell@chromium.org's avatar ishell@chromium.org

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
parent e257a1b3
...@@ -3874,33 +3874,14 @@ inline void Code::set_is_crankshafted(bool value) { ...@@ -3874,33 +3874,14 @@ inline void Code::set_is_crankshafted(bool value) {
int Code::major_key() { int Code::major_key() {
ASSERT(kind() == STUB || ASSERT(has_major_key());
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);
return StubMajorKeyField::decode( return StubMajorKeyField::decode(
READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); READ_UINT32_FIELD(this, kKindSpecificFlags2Offset));
} }
void Code::set_major_key(int major) { void Code::set_major_key(int major) {
ASSERT(kind() == STUB || ASSERT(has_major_key());
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(0 <= major && major < 256); ASSERT(0 <= major && major < 256);
int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
int updated = StubMajorKeyField::update(previous, major); int updated = StubMajorKeyField::update(previous, major);
...@@ -3908,6 +3889,21 @@ void Code::set_major_key(int 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() { bool Code::is_pregenerated() {
return (kind() == STUB && IsPregeneratedField::decode(flags())); return (kind() == STUB && IsPregeneratedField::decode(flags()));
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "arguments.h" #include "arguments.h"
#include "bootstrapper.h" #include "bootstrapper.h"
#include "codegen.h" #include "codegen.h"
#include "code-stubs.h"
#include "cpu-profiler.h" #include "cpu-profiler.h"
#include "debug.h" #include "debug.h"
#include "deoptimizer.h" #include "deoptimizer.h"
...@@ -11135,6 +11136,10 @@ void Code::PrintExtraICState(FILE* out, Kind kind, ExtraICState extra) { ...@@ -11135,6 +11136,10 @@ void Code::PrintExtraICState(FILE* out, Kind kind, ExtraICState extra) {
void Code::Disassemble(const char* name, FILE* out) { void Code::Disassemble(const char* name, FILE* out) {
PrintF(out, "kind = %s\n", Kind2String(kind())); 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()) { if (is_inline_cache_stub()) {
PrintF(out, "ic_state = %s\n", ICState2String(ic_state())); PrintF(out, "ic_state = %s\n", ICState2String(ic_state()));
PrintExtraICState(out, kind(), needs_extended_extra_ic_state(kind()) ? PrintExtraICState(out, kind(), needs_extended_extra_ic_state(kind()) ?
......
...@@ -5141,6 +5141,7 @@ class Code: public HeapObject { ...@@ -5141,6 +5141,7 @@ class Code: public HeapObject {
// [major_key]: For kind STUB or BINARY_OP_IC, the major key. // [major_key]: For kind STUB or BINARY_OP_IC, the major key.
inline int major_key(); inline int major_key();
inline void set_major_key(int value); 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 // 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). // the optimizing compiler (but it may not be an optimized function).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment