Reviewers: Vyacheslav Egorov,
Description:
Static state cleanup: add more consts.
[email protected]
Please review this at http://codereview.chromium.org/7491052/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/arm/deoptimizer-arm.cc
M src/arm/disasm-arm.cc
M src/assembler.h
M src/assembler.cc
M src/codegen.cc
M src/deoptimizer.h
M src/ia32/deoptimizer-ia32.cc
M src/ia32/disasm-ia32.cc
M src/log-utils.h
M src/log-utils.cc
M src/mips/deoptimizer-mips.cc
M src/scanner-base.h
M src/scanner-base.cc
M src/x64/deoptimizer-x64.cc
M src/x64/disasm-x64.cc
Index: src/arm/deoptimizer-arm.cc
diff --git a/src/arm/deoptimizer-arm.cc b/src/arm/deoptimizer-arm.cc
index
cd70e6de8242f4d6638bdc0c8f645288c50ffcde..3bcfccf6eb90606ea0c8e95aee7f6fc0fddbfda5
100644
--- a/src/arm/deoptimizer-arm.cc
+++ b/src/arm/deoptimizer-arm.cc
@@ -35,7 +35,7 @@
namespace v8 {
namespace internal {
-int Deoptimizer::table_entry_size_ = 16;
+const int Deoptimizer::table_entry_size_ = 16;
int Deoptimizer::patch_size() {
Index: src/arm/disasm-arm.cc
diff --git a/src/arm/disasm-arm.cc b/src/arm/disasm-arm.cc
index
d4bd81ce464c9c5a7576f6a18f24a94e02cc41ba..603b3cfd9caaf0baa4fc5ef5fea5b34426d2770d
100644
--- a/src/arm/disasm-arm.cc
+++ b/src/arm/disasm-arm.cc
@@ -200,7 +200,7 @@ void Decoder::PrintDRegister(int reg) {
// These shift names are defined in a way to match the native disassembler
// formatting. See for example the command "objdump -d <binary file>".
-static const char* shift_names[kNumberOfShifts] = {
+static const char* const shift_names[kNumberOfShifts] = {
"lsl", "lsr", "asr", "ror"
};
Index: src/assembler.cc
diff --git a/src/assembler.cc b/src/assembler.cc
index
fbd808958044611bcd93ac4e77a53c07a07bcf28..ad5f3508160b3ff7d437a9b8530ccd30aa6d7e65
100644
--- a/src/assembler.cc
+++ b/src/assembler.cc
@@ -74,7 +74,7 @@ const double DoubleConstant::zero = 0.0;
const double DoubleConstant::canonical_non_hole_nan = OS::nan_value();
const double DoubleConstant::the_hole_nan = BitCast<double>(kHoleNanInt64);
const double DoubleConstant::negative_infinity = -V8_INFINITY;
-const char* RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING";
+const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION
PADDING";
//
-----------------------------------------------------------------------------
// Implementation of AssemblerBase
Index: src/assembler.h
diff --git a/src/assembler.h b/src/assembler.h
index
2d14f06914d5cc1af442b58501c081ee56275cdb..d58034df0d7567ab05622ae1c6ab08857e667053
100644
--- a/src/assembler.h
+++ b/src/assembler.h
@@ -171,7 +171,7 @@ class RelocInfo BASE_EMBEDDED {
// where we are not sure to have enough space for patching in during
// lazy deoptimization. This is the case if we have indirect calls for
which
// we do not normally record relocation info.
- static const char* kFillerCommentString;
+ static const char* const kFillerCommentString;
// The minimum size of a comment is equal to three bytes for the extra
tagged
// pc + the tag for the data, and kPointerSize for the actual pointer to
the
Index: src/codegen.cc
diff --git a/src/codegen.cc b/src/codegen.cc
index
fb723a3bccc7fe0ec8422f7d20d4b0bff0ea5b21..cdc9ba1553276ed9edaad35f8d0d25f0210ef7c6
100644
--- a/src/codegen.cc
+++ b/src/codegen.cc
@@ -169,7 +169,6 @@ void CodeGenerator::PrintCode(Handle<Code> code,
CompilationInfo* info) {
#endif // ENABLE_DISASSEMBLER
}
-static Vector<const char> kRegexp = CStrVector("regexp");
bool CodeGenerator::ShouldGenerateLog(Expression* type) {
ASSERT(type != NULL);
@@ -179,7 +178,7 @@ bool CodeGenerator::ShouldGenerateLog(Expression* type)
{
}
Handle<String> name = Handle<String>::cast(type->AsLiteral()->handle());
if (FLAG_log_regexp) {
- if (name->IsEqualTo(kRegexp))
+ if (name->IsEqualTo(CStrVector("regexp")))
return true;
}
return false;
Index: src/deoptimizer.h
diff --git a/src/deoptimizer.h b/src/deoptimizer.h
index
9265905366bb6e3921f0f803d92e83c6e5175a07..81345ad2d1ab92a539698c7b612e22922b1490c9
100644
--- a/src/deoptimizer.h
+++ b/src/deoptimizer.h
@@ -317,7 +317,7 @@ class Deoptimizer : public Malloced {
List<HeapNumberMaterializationDescriptor> deferred_heap_numbers_;
- static int table_entry_size_;
+ static const int table_entry_size_;
friend class FrameDescription;
friend class DeoptimizingCodeListNode;
Index: src/ia32/deoptimizer-ia32.cc
diff --git a/src/ia32/deoptimizer-ia32.cc b/src/ia32/deoptimizer-ia32.cc
index
4ff1bfc35fee6da36ba0afd587328c5b3d8cb0a5..0e47e971cbbfd1648fb809351b41e1295d418a82
100644
--- a/src/ia32/deoptimizer-ia32.cc
+++ b/src/ia32/deoptimizer-ia32.cc
@@ -37,7 +37,7 @@
namespace v8 {
namespace internal {
-int Deoptimizer::table_entry_size_ = 10;
+const int Deoptimizer::table_entry_size_ = 10;
int Deoptimizer::patch_size() {
Index: src/ia32/disasm-ia32.cc
diff --git a/src/ia32/disasm-ia32.cc b/src/ia32/disasm-ia32.cc
index
7a59a4f62ac85cb88e16c5e4ca1c52d27f827f2b..900668fbdcedd2943044a950e512dfaf8d5fd312
100644
--- a/src/ia32/disasm-ia32.cc
+++ b/src/ia32/disasm-ia32.cc
@@ -54,7 +54,7 @@ struct ByteMnemonic {
};
-static ByteMnemonic two_operands_instr[] = {
+static const ByteMnemonic two_operands_instr[] = {
{0x03, "add", REG_OPER_OP_ORDER},
{0x09, "or", OPER_REG_OP_ORDER},
{0x0B, "or", REG_OPER_OP_ORDER},
@@ -79,7 +79,7 @@ static ByteMnemonic two_operands_instr[] = {
};
-static ByteMnemonic zero_operands_instr[] = {
+static const ByteMnemonic zero_operands_instr[] = {
{0xC3, "ret", UNSET_OP_ORDER},
{0xC9, "leave", UNSET_OP_ORDER},
{0x90, "nop", UNSET_OP_ORDER},
@@ -98,14 +98,14 @@ static ByteMnemonic zero_operands_instr[] = {
};
-static ByteMnemonic call_jump_instr[] = {
+static const ByteMnemonic call_jump_instr[] = {
{0xE8, "call", UNSET_OP_ORDER},
{0xE9, "jmp", UNSET_OP_ORDER},
{-1, "", UNSET_OP_ORDER}
};
-static ByteMnemonic short_immediate_instr[] = {
+static const ByteMnemonic short_immediate_instr[] = {
{0x05, "add", UNSET_OP_ORDER},
{0x0D, "or", UNSET_OP_ORDER},
{0x15, "adc", UNSET_OP_ORDER},
@@ -117,7 +117,7 @@ static ByteMnemonic short_immediate_instr[] = {
};
-static const char* jump_conditional_mnem[] = {
+static const char* const jump_conditional_mnem[] = {
/*0*/ "jo", "jno", "jc", "jnc",
/*4*/ "jz", "jnz", "jna", "ja",
/*8*/ "js", "jns", "jpe", "jpo",
@@ -125,7 +125,7 @@ static const char* jump_conditional_mnem[] = {
};
-static const char* set_conditional_mnem[] = {
+static const char* const set_conditional_mnem[] = {
/*0*/ "seto", "setno", "setc", "setnc",
/*4*/ "setz", "setnz", "setna", "seta",
/*8*/ "sets", "setns", "setpe", "setpo",
@@ -133,7 +133,7 @@ static const char* set_conditional_mnem[] = {
};
-static const char* conditional_move_mnem[] = {
+static const char* const conditional_move_mnem[] = {
/*0*/ "cmovo", "cmovno", "cmovc", "cmovnc",
/*4*/ "cmovz", "cmovnz", "cmovna", "cmova",
/*8*/ "cmovs", "cmovns", "cmovpe", "cmovpo",
@@ -169,7 +169,7 @@ class InstructionTable {
InstructionDesc instructions_[256];
void Clear();
void Init();
- void CopyTable(ByteMnemonic bm[], InstructionType type);
+ void CopyTable(const ByteMnemonic bm[], InstructionType type);
void SetTableRange(InstructionType type,
byte start,
byte end,
@@ -208,7 +208,8 @@ void InstructionTable::Init() {
}
-void InstructionTable::CopyTable(ByteMnemonic bm[], InstructionType type) {
+void InstructionTable::CopyTable(const ByteMnemonic bm[],
+ InstructionType type) {
for (int i = 0; bm[i].b >= 0; i++) {
InstructionDesc* id = &instructions_[bm[i].b];
id->mnem = bm[i].mnem;
Index: src/log-utils.cc
diff --git a/src/log-utils.cc b/src/log-utils.cc
index
6112e34fcb5d4f4c20bd1b6b98fc966ebe90093e..27e654d5e8a55bb08da0f4bc47db87e210e65629
100644
--- a/src/log-utils.cc
+++ b/src/log-utils.cc
@@ -34,7 +34,7 @@ namespace v8 {
namespace internal {
-const char* Log::kLogToTemporaryFile = "&";
+const char* const Log::kLogToTemporaryFile = "&";
Log::Log(Logger* logger)
Index: src/log-utils.h
diff --git a/src/log-utils.h b/src/log-utils.h
index
d336d714b968dafceca88d90d60435bcbfd9f6e6..2b20a01bbc6a134f0e0e9f30f575f5062fd86dc0
100644
--- a/src/log-utils.h
+++ b/src/log-utils.h
@@ -59,7 +59,7 @@ class Log {
// This mode is only used in tests, as temporary files are automatically
// deleted on close and thus can't be accessed afterwards.
- static const char* kLogToTemporaryFile;
+ static const char* const kLogToTemporaryFile;
private:
explicit Log(Logger* logger);
Index: src/mips/deoptimizer-mips.cc
diff --git a/src/mips/deoptimizer-mips.cc b/src/mips/deoptimizer-mips.cc
index
9a19aba75d019e8182e8c9a9fb7d9f86e6ffaf4d..18b6231999e841250d28bacd06adcfee1b916300
100644
--- a/src/mips/deoptimizer-mips.cc
+++ b/src/mips/deoptimizer-mips.cc
@@ -39,7 +39,7 @@ namespace v8 {
namespace internal {
-int Deoptimizer::table_entry_size_ = 10;
+const int Deoptimizer::table_entry_size_ = 10;
int Deoptimizer::patch_size() {
Index: src/scanner-base.cc
diff --git a/src/scanner-base.cc b/src/scanner-base.cc
index
16f8db5a986d398288c2449d07ee7da9422eaa80..40ff7d38219a1723d3347002bf7ad61782527eb8
100644
--- a/src/scanner-base.cc
+++ b/src/scanner-base.cc
@@ -788,7 +788,7 @@ bool JavaScriptScanner::ScanRegExpFlags() {
//
----------------------------------------------------------------------------
// Keyword Matcher
-KeywordMatcher::FirstState KeywordMatcher::first_states_[] = {
+const KeywordMatcher::FirstState KeywordMatcher::first_states_[] = {
{ "break", KEYWORD_PREFIX, Token::BREAK },
{ NULL, C, Token::ILLEGAL },
{ NULL, D, Token::ILLEGAL },
Index: src/scanner-base.h
diff --git a/src/scanner-base.h b/src/scanner-base.h
index
3d67d4e1eadb5633e82e11d10204f1ebe4de5ec7..22844bbaf9f1757e539d45bd0eecd80a6379741e
100644
--- a/src/scanner-base.h
+++ b/src/scanner-base.h
@@ -633,7 +633,7 @@ class KeywordMatcher {
static const unsigned int kFirstCharRangeLength =
kFirstCharRangeMax - kFirstCharRangeMin + 1;
// State map for first keyword character range.
- static FirstState first_states_[kFirstCharRangeLength];
+ static const FirstState first_states_[kFirstCharRangeLength];
// If input equals keyword's character at position, continue matching
keyword
// from that position.
Index: src/x64/deoptimizer-x64.cc
diff --git a/src/x64/deoptimizer-x64.cc b/src/x64/deoptimizer-x64.cc
index
2a31f28d5e975e3a6693ac4cab5bebf1c0a40b60..4051cf3e81c042250c1b8c38839d1c24110a8e72
100644
--- a/src/x64/deoptimizer-x64.cc
+++ b/src/x64/deoptimizer-x64.cc
@@ -38,7 +38,7 @@ namespace v8 {
namespace internal {
-int Deoptimizer::table_entry_size_ = 10;
+const int Deoptimizer::table_entry_size_ = 10;
int Deoptimizer::patch_size() {
Index: src/x64/disasm-x64.cc
diff --git a/src/x64/disasm-x64.cc b/src/x64/disasm-x64.cc
index
14c95bc5acec8b35852143beee951884918ff8ae..1b8871fd473cb1956453e1b679cc7b9ea38b1a3d
100644
--- a/src/x64/disasm-x64.cc
+++ b/src/x64/disasm-x64.cc
@@ -58,7 +58,7 @@ struct ByteMnemonic {
};
-static ByteMnemonic two_operands_instr[] = {
+static const ByteMnemonic two_operands_instr[] = {
{ 0x00, BYTE_OPER_REG_OP_ORDER, "add" },
{ 0x01, OPER_REG_OP_ORDER, "add" },
{ 0x02, BYTE_REG_OPER_OP_ORDER, "add" },
@@ -105,7 +105,7 @@ static ByteMnemonic two_operands_instr[] = {
};
-static ByteMnemonic zero_operands_instr[] = {
+static const ByteMnemonic zero_operands_instr[] = {
{ 0xC3, UNSET_OP_ORDER, "ret" },
{ 0xC9, UNSET_OP_ORDER, "leave" },
{ 0xF4, UNSET_OP_ORDER, "hlt" },
@@ -125,14 +125,14 @@ static ByteMnemonic zero_operands_instr[] = {
};
-static ByteMnemonic call_jump_instr[] = {
+static const ByteMnemonic call_jump_instr[] = {
{ 0xE8, UNSET_OP_ORDER, "call" },
{ 0xE9, UNSET_OP_ORDER, "jmp" },
{ -1, UNSET_OP_ORDER, "" }
};
-static ByteMnemonic short_immediate_instr[] = {
+static const ByteMnemonic short_immediate_instr[] = {
{ 0x05, UNSET_OP_ORDER, "add" },
{ 0x0D, UNSET_OP_ORDER, "or" },
{ 0x15, UNSET_OP_ORDER, "adc" },
@@ -145,7 +145,7 @@ static ByteMnemonic short_immediate_instr[] = {
};
-static const char* conditional_code_suffix[] = {
+static const char* const conditional_code_suffix[] = {
"o", "no", "c", "nc", "z", "nz", "na", "a",
"s", "ns", "pe", "po", "l", "ge", "le", "g"
};
@@ -193,7 +193,7 @@ class InstructionTable {
InstructionDesc instructions_[256];
void Clear();
void Init();
- void CopyTable(ByteMnemonic bm[], InstructionType type);
+ void CopyTable(const ByteMnemonic bm[], InstructionType type);
void SetTableRange(InstructionType type, byte start, byte end, bool
byte_size,
const char* mnem);
void AddJumpConditionalShort();
@@ -228,7 +228,8 @@ void InstructionTable::Init() {
}
-void InstructionTable::CopyTable(ByteMnemonic bm[], InstructionType type) {
+void InstructionTable::CopyTable(const ByteMnemonic bm[],
+ InstructionType type) {
for (int i = 0; bm[i].b >= 0; i++) {
InstructionDesc* id = &instructions_[bm[i].b];
id->mnem = bm[i].mnem;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev