Commit 5b63bc1f authored by vitalyr@chromium.org's avatar vitalyr@chromium.org

Static state cleanup: add more consts.

R=vegorov@chromium.org

Review URL: http://codereview.chromium.org/7491052

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8843 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 61ae1be6
......@@ -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() {
......
......@@ -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"
};
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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() {
......
......@@ -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;
......
......@@ -34,7 +34,7 @@ namespace v8 {
namespace internal {
const char* Log::kLogToTemporaryFile = "&";
const char* const Log::kLogToTemporaryFile = "&";
Log::Log(Logger* logger)
......
......@@ -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);
......
......@@ -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() {
......
......@@ -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 },
......
......@@ -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.
......
......@@ -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() {
......
......@@ -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;
......
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