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) {
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()));
}
......
......@@ -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()) ?
......
......@@ -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).
......
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