Commit 66efb966 authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Fix compilation error introduced with r15287.

REGEXP was added to Code::Kind after TO_BOOLEAN_IC, but NUMBER_OF_KINDS,
which is used as array size for table[] in ReportCodeKindStatistics, was
still TO_BOOLEAN_IC + 1 (indirectly via LAST_IC_KIND).

BUG=
R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/17636003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15315 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e7adf305
...@@ -1873,7 +1873,7 @@ class Heap { ...@@ -1873,7 +1873,7 @@ class Heap {
enum { enum {
FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1,
FIRST_FIXED_ARRAY_SUB_TYPE = FIRST_FIXED_ARRAY_SUB_TYPE =
FIRST_CODE_KIND_SUB_TYPE + Code::LAST_CODE_KIND + 1, FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS,
OBJECT_STATS_COUNT = OBJECT_STATS_COUNT =
FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1
}; };
...@@ -1885,7 +1885,7 @@ class Heap { ...@@ -1885,7 +1885,7 @@ class Heap {
object_sizes_[type] += size; object_sizes_[type] += size;
} else { } else {
if (type == CODE_TYPE) { if (type == CODE_TYPE) {
ASSERT(sub_type <= Code::LAST_CODE_KIND); ASSERT(sub_type < Code::NUMBER_OF_KINDS);
object_counts_[FIRST_CODE_KIND_SUB_TYPE + sub_type]++; object_counts_[FIRST_CODE_KIND_SUB_TYPE + sub_type]++;
object_sizes_[FIRST_CODE_KIND_SUB_TYPE + sub_type] += size; object_sizes_[FIRST_CODE_KIND_SUB_TYPE + sub_type] += size;
} else if (type == FIXED_ARRAY_TYPE) { } else if (type == FIXED_ARRAY_TYPE) {
......
...@@ -4041,7 +4041,12 @@ void Code::set_marked_for_deoptimization(bool flag) { ...@@ -4041,7 +4041,12 @@ void Code::set_marked_for_deoptimization(bool flag) {
bool Code::is_inline_cache_stub() { bool Code::is_inline_cache_stub() {
Kind kind = this->kind(); Kind kind = this->kind();
return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; switch (kind) {
#define CASE(name) case name: return true;
IC_KIND_LIST(CASE)
#undef CASE
default: return false;
}
} }
......
...@@ -4439,39 +4439,45 @@ class Code: public HeapObject { ...@@ -4439,39 +4439,45 @@ class Code: public HeapObject {
// cache state, and arguments count. // cache state, and arguments count.
typedef uint32_t Flags; typedef uint32_t Flags;
#define CODE_KIND_LIST(V) \ #define NON_IC_KIND_LIST(V) \
V(FUNCTION) \ V(FUNCTION) \
V(OPTIMIZED_FUNCTION) \ V(OPTIMIZED_FUNCTION) \
V(STUB) \ V(STUB) \
V(BUILTIN) \ V(BUILTIN) \
V(LOAD_IC) \
V(KEYED_LOAD_IC) \
V(CALL_IC) \
V(KEYED_CALL_IC) \
V(STORE_IC) \
V(KEYED_STORE_IC) \
V(UNARY_OP_IC) \
V(BINARY_OP_IC) \
V(COMPARE_IC) \
V(COMPARE_NIL_IC) \
V(TO_BOOLEAN_IC) \
V(REGEXP) V(REGEXP)
#define IC_KIND_LIST(V) \
V(LOAD_IC) \
V(KEYED_LOAD_IC) \
V(CALL_IC) \
V(KEYED_CALL_IC) \
V(STORE_IC) \
V(KEYED_STORE_IC) \
V(UNARY_OP_IC) \
V(BINARY_OP_IC) \
V(COMPARE_IC) \
V(COMPARE_NIL_IC) \
V(TO_BOOLEAN_IC)
#define CODE_KIND_LIST(V) \
NON_IC_KIND_LIST(V) \
IC_KIND_LIST(V)
enum Kind { enum Kind {
#define DEFINE_CODE_KIND_ENUM(name) name, #define DEFINE_CODE_KIND_ENUM(name) name,
CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM) CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM)
#undef DEFINE_CODE_KIND_ENUM #undef DEFINE_CODE_KIND_ENUM
};
// Pseudo-kinds. enum {
LAST_CODE_KIND = TO_BOOLEAN_IC, #define COUNT_FLAG(name) + 1
FIRST_IC_KIND = LOAD_IC, NUMBER_OF_KINDS = 0 CODE_KIND_LIST(COUNT_FLAG)
LAST_IC_KIND = TO_BOOLEAN_IC #undef COUNT_FLAG
}; };
// No more than 16 kinds. The value is currently encoded in four bits in // No more than 16 kinds. The value is currently encoded in four bits in
// Flags. // Flags.
STATIC_ASSERT(LAST_CODE_KIND < 16); STATIC_ASSERT(NUMBER_OF_KINDS <= 16);
static const char* Kind2String(Kind kind); static const char* Kind2String(Kind kind);
...@@ -4491,10 +4497,6 @@ class Code: public HeapObject { ...@@ -4491,10 +4497,6 @@ class Code: public HeapObject {
PROTOTYPE_STUB PROTOTYPE_STUB
}; };
enum {
NUMBER_OF_KINDS = LAST_IC_KIND + 1
};
typedef int ExtraICState; typedef int ExtraICState;
static const ExtraICState kNoExtraICState = 0; static const ExtraICState kNoExtraICState = 0;
......
...@@ -1790,50 +1790,20 @@ static void ClearHistograms() { ...@@ -1790,50 +1790,20 @@ static void ClearHistograms() {
} }
static void ClearCodeKindStatistics() { static void ClearCodeKindStatistics(int* code_kind_statistics) {
Isolate* isolate = Isolate::Current();
for (int i = 0; i < Code::NUMBER_OF_KINDS; i++) { for (int i = 0; i < Code::NUMBER_OF_KINDS; i++) {
isolate->code_kind_statistics()[i] = 0; code_kind_statistics[i] = 0;
} }
} }
static void ReportCodeKindStatistics() { static void ReportCodeKindStatistics(int* code_kind_statistics) {
Isolate* isolate = Isolate::Current();
const char* table[Code::NUMBER_OF_KINDS] = { NULL };
#define CASE(name) \
case Code::name: table[Code::name] = #name; \
break
for (int i = 0; i < Code::NUMBER_OF_KINDS; i++) {
switch (static_cast<Code::Kind>(i)) {
CASE(FUNCTION);
CASE(OPTIMIZED_FUNCTION);
CASE(STUB);
CASE(BUILTIN);
CASE(LOAD_IC);
CASE(KEYED_LOAD_IC);
CASE(STORE_IC);
CASE(KEYED_STORE_IC);
CASE(CALL_IC);
CASE(KEYED_CALL_IC);
CASE(UNARY_OP_IC);
CASE(BINARY_OP_IC);
CASE(COMPARE_IC);
CASE(COMPARE_NIL_IC);
CASE(TO_BOOLEAN_IC);
CASE(REGEXP);
}
}
#undef CASE
PrintF("\n Code kind histograms: \n"); PrintF("\n Code kind histograms: \n");
for (int i = 0; i < Code::NUMBER_OF_KINDS; i++) { for (int i = 0; i < Code::NUMBER_OF_KINDS; i++) {
if (isolate->code_kind_statistics()[i] > 0) { if (code_kind_statistics[i] > 0) {
PrintF(" %-20s: %10d bytes\n", table[i], PrintF(" %-20s: %10d bytes\n",
isolate->code_kind_statistics()[i]); Code::Kind2String(static_cast<Code::Kind>(i)),
code_kind_statistics[i]);
} }
} }
PrintF("\n"); PrintF("\n");
...@@ -1841,7 +1811,7 @@ static void ReportCodeKindStatistics() { ...@@ -1841,7 +1811,7 @@ static void ReportCodeKindStatistics() {
static int CollectHistogramInfo(HeapObject* obj) { static int CollectHistogramInfo(HeapObject* obj) {
Isolate* isolate = Isolate::Current(); Isolate* isolate = obj->GetIsolate();
InstanceType type = obj->map()->instance_type(); InstanceType type = obj->map()->instance_type();
ASSERT(0 <= type && type <= LAST_TYPE); ASSERT(0 <= type && type <= LAST_TYPE);
ASSERT(isolate->heap_histograms()[type].name() != NULL); ASSERT(isolate->heap_histograms()[type].name() != NULL);
...@@ -2715,7 +2685,7 @@ void PagedSpace::ReportCodeStatistics() { ...@@ -2715,7 +2685,7 @@ void PagedSpace::ReportCodeStatistics() {
Isolate* isolate = Isolate::Current(); Isolate* isolate = Isolate::Current();
CommentStatistic* comments_statistics = CommentStatistic* comments_statistics =
isolate->paged_space_comments_statistics(); isolate->paged_space_comments_statistics();
ReportCodeKindStatistics(); ReportCodeKindStatistics(isolate->code_kind_statistics());
PrintF("Code comment statistics (\" [ comment-txt : size/ " PrintF("Code comment statistics (\" [ comment-txt : size/ "
"count (average)\"):\n"); "count (average)\"):\n");
for (int i = 0; i <= CommentStatistic::kMaxComments; i++) { for (int i = 0; i <= CommentStatistic::kMaxComments; i++) {
...@@ -2733,7 +2703,7 @@ void PagedSpace::ResetCodeStatistics() { ...@@ -2733,7 +2703,7 @@ void PagedSpace::ResetCodeStatistics() {
Isolate* isolate = Isolate::Current(); Isolate* isolate = Isolate::Current();
CommentStatistic* comments_statistics = CommentStatistic* comments_statistics =
isolate->paged_space_comments_statistics(); isolate->paged_space_comments_statistics();
ClearCodeKindStatistics(); ClearCodeKindStatistics(isolate->code_kind_statistics());
for (int i = 0; i < CommentStatistic::kMaxComments; i++) { for (int i = 0; i < CommentStatistic::kMaxComments; i++) {
comments_statistics[i].Clear(); comments_statistics[i].Clear();
} }
......
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