Revision: 15315
Author: [email protected]
Date: Tue Jun 25 02:09:25 2013
Log: 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=
[email protected]
Review URL: https://codereview.chromium.org/17636003
http://code.google.com/p/v8/source/detail?r=15315
Modified:
/branches/bleeding_edge/src/heap.h
/branches/bleeding_edge/src/objects-inl.h
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/src/spaces.cc
=======================================
--- /branches/bleeding_edge/src/heap.h Wed Jun 19 04:53:30 2013
+++ /branches/bleeding_edge/src/heap.h Tue Jun 25 02:09:25 2013
@@ -1873,7 +1873,7 @@
enum {
FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1,
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 =
FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1
};
@@ -1885,7 +1885,7 @@
object_sizes_[type] += size;
} else {
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_sizes_[FIRST_CODE_KIND_SUB_TYPE + sub_type] += size;
} else if (type == FIXED_ARRAY_TYPE) {
=======================================
--- /branches/bleeding_edge/src/objects-inl.h Fri Jun 21 06:02:38 2013
+++ /branches/bleeding_edge/src/objects-inl.h Tue Jun 25 02:09:25 2013
@@ -4041,7 +4041,12 @@
bool Code::is_inline_cache_stub() {
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;
+ }
}
=======================================
--- /branches/bleeding_edge/src/objects.h Mon Jun 24 05:55:19 2013
+++ /branches/bleeding_edge/src/objects.h Tue Jun 25 02:09:25 2013
@@ -4439,39 +4439,45 @@
// cache state, and arguments count.
typedef uint32_t Flags;
-#define CODE_KIND_LIST(V) \
- V(FUNCTION) \
- V(OPTIMIZED_FUNCTION) \
- V(STUB) \
- 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) \
+#define NON_IC_KIND_LIST(V) \
+ V(FUNCTION) \
+ V(OPTIMIZED_FUNCTION) \
+ V(STUB) \
+ V(BUILTIN) \
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 {
#define DEFINE_CODE_KIND_ENUM(name) name,
CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM)
#undef DEFINE_CODE_KIND_ENUM
+ };
- // Pseudo-kinds.
- LAST_CODE_KIND = TO_BOOLEAN_IC,
- FIRST_IC_KIND = LOAD_IC,
- LAST_IC_KIND = TO_BOOLEAN_IC
+ enum {
+#define COUNT_FLAG(name) + 1
+ NUMBER_OF_KINDS = 0 CODE_KIND_LIST(COUNT_FLAG)
+#undef COUNT_FLAG
};
// No more than 16 kinds. The value is currently encoded in four bits in
// Flags.
- STATIC_ASSERT(LAST_CODE_KIND < 16);
+ STATIC_ASSERT(NUMBER_OF_KINDS <= 16);
static const char* Kind2String(Kind kind);
@@ -4491,10 +4497,6 @@
PROTOTYPE_STUB
};
- enum {
- NUMBER_OF_KINDS = LAST_IC_KIND + 1
- };
-
typedef int ExtraICState;
static const ExtraICState kNoExtraICState = 0;
=======================================
--- /branches/bleeding_edge/src/spaces.cc Mon Jun 24 05:55:19 2013
+++ /branches/bleeding_edge/src/spaces.cc Tue Jun 25 02:09:25 2013
@@ -1790,50 +1790,20 @@
}
-static void ClearCodeKindStatistics() {
- Isolate* isolate = Isolate::Current();
+static void ClearCodeKindStatistics(int* code_kind_statistics) {
for (int i = 0; i < Code::NUMBER_OF_KINDS; i++) {
- isolate->code_kind_statistics()[i] = 0;
+ code_kind_statistics[i] = 0;
}
}
-static void ReportCodeKindStatistics() {
- 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
-
+static void ReportCodeKindStatistics(int* code_kind_statistics) {
PrintF("\n Code kind histograms: \n");
for (int i = 0; i < Code::NUMBER_OF_KINDS; i++) {
- if (isolate->code_kind_statistics()[i] > 0) {
- PrintF(" %-20s: %10d bytes\n", table[i],
- isolate->code_kind_statistics()[i]);
+ if (code_kind_statistics[i] > 0) {
+ PrintF(" %-20s: %10d bytes\n",
+ Code::Kind2String(static_cast<Code::Kind>(i)),
+ code_kind_statistics[i]);
}
}
PrintF("\n");
@@ -1841,7 +1811,7 @@
static int CollectHistogramInfo(HeapObject* obj) {
- Isolate* isolate = Isolate::Current();
+ Isolate* isolate = obj->GetIsolate();
InstanceType type = obj->map()->instance_type();
ASSERT(0 <= type && type <= LAST_TYPE);
ASSERT(isolate->heap_histograms()[type].name() != NULL);
@@ -2715,7 +2685,7 @@
Isolate* isolate = Isolate::Current();
CommentStatistic* comments_statistics =
isolate->paged_space_comments_statistics();
- ReportCodeKindStatistics();
+ ReportCodeKindStatistics(isolate->code_kind_statistics());
PrintF("Code comment statistics (\" [ comment-txt : size/ "
"count (average)\"):\n");
for (int i = 0; i <= CommentStatistic::kMaxComments; i++) {
@@ -2733,7 +2703,7 @@
Isolate* isolate = Isolate::Current();
CommentStatistic* comments_statistics =
isolate->paged_space_comments_statistics();
- ClearCodeKindStatistics();
+ ClearCodeKindStatistics(isolate->code_kind_statistics());
for (int i = 0; i < CommentStatistic::kMaxComments; i++) {
comments_statistics[i].Clear();
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.