Reviewers: danno,
Description:
Remove a static initializer that could potentially slow down startup time.
BUG=1753
Please review this at http://codereview.chromium.org/8198005/
SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/
Affected files:
M src/jsregexp.h
M src/jsregexp.cc
M src/profile-generator.h
M src/profile-generator.cc
M src/splay-tree-inl.h
M test/cctest/test-regexp.cc
Index: src/jsregexp.cc
===================================================================
--- src/jsregexp.cc (revision 9549)
+++ src/jsregexp.cc (working copy)
@@ -4723,7 +4723,6 @@
const uc16 DispatchTable::Config::kNoKey = unibrow::Utf8::kBadChar;
-const DispatchTable::Entry DispatchTable::Config::kNoValue;
void DispatchTable::AddRange(CharacterRange full_range, int value) {
Index: src/jsregexp.h
===================================================================
--- src/jsregexp.h (revision 9549)
+++ src/jsregexp.h (working copy)
@@ -389,7 +389,7 @@
typedef uc16 Key;
typedef Entry Value;
static const uc16 kNoKey;
- static const Entry kNoValue;
+ static const Entry NoValue() { return Value(); }
static inline int Compare(uc16 a, uc16 b) {
if (a == b)
return 0;
Index: src/profile-generator.cc
===================================================================
--- src/profile-generator.cc (revision 9549)
+++ src/profile-generator.cc (working copy)
@@ -488,8 +488,6 @@
CodeEntry* const CodeMap::kSharedFunctionCodeEntry = NULL;
const CodeMap::CodeTreeConfig::Key CodeMap::CodeTreeConfig::kNoKey = NULL;
-const CodeMap::CodeTreeConfig::Value CodeMap::CodeTreeConfig::kNoValue =
- CodeMap::CodeEntryInfo(NULL, 0);
void CodeMap::AddCode(Address addr, CodeEntry* entry, unsigned size) {
Index: src/profile-generator.h
===================================================================
--- src/profile-generator.h (revision 9549)
+++ src/profile-generator.h (working copy)
@@ -257,7 +257,7 @@
typedef Address Key;
typedef CodeEntryInfo Value;
static const Key kNoKey;
- static const Value kNoValue;
+ static const Value NoValue() { return CodeEntryInfo(NULL, 0); }
static int Compare(const Key& a, const Key& b) {
return a < b ? -1 : (a > b ? 1 : 0);
}
Index: src/splay-tree-inl.h
===================================================================
--- src/splay-tree-inl.h (revision 9549)
+++ src/splay-tree-inl.h (working copy)
@@ -45,7 +45,7 @@
bool SplayTree<Config, Allocator>::Insert(const Key& key, Locator*
locator) {
if (is_empty()) {
// If the tree is empty, insert the new node.
- root_ = new Node(key, Config::kNoValue);
+ root_ = new Node(key, Config::NoValue());
} else {
// Splay on the key to move the last node on the search path
// for the key to the root of the tree.
@@ -57,7 +57,7 @@
return false;
}
// Insert the new node.
- Node* node = new Node(key, Config::kNoValue);
+ Node* node = new Node(key, Config::NoValue());
InsertInternal(cmp, node);
}
locator->bind(root_);
@@ -226,7 +226,7 @@
void SplayTree<Config, Allocator>::Splay(const Key& key) {
if (is_empty())
return;
- Node dummy_node(Config::kNoKey, Config::kNoValue);
+ Node dummy_node(Config::kNoKey, Config::NoValue());
// Create a dummy node. The use of the dummy node is a bit
// counter-intuitive: The right child of the dummy node will hold
// the L tree of the algorithm. The left child of the dummy node
Index: test/cctest/test-regexp.cc
===================================================================
--- test/cctest/test-regexp.cc (revision 9549)
+++ test/cctest/test-regexp.cc (working copy)
@@ -530,7 +530,7 @@
typedef int Key;
typedef int Value;
static const int kNoKey;
- static const int kNoValue;
+ static int NoValue() { return 0; }
static inline int Compare(int a, int b) {
if (a < b)
return -1;
@@ -543,7 +543,6 @@
const int TestConfig::kNoKey = 0;
-const int TestConfig::kNoValue = 0;
static unsigned PseudoRandom(int i, int j) {
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev