From 338ab857b9a911f4f6c56e79e7c36c5c555b2ec8 Mon Sep 17 00:00:00 2001 From: "erik.corry@gmail.com" Date: Fri, 7 Oct 2011 14:41:08 +0000 Subject: [PATCH] Remove a static initializer that could potentially slow down startup time. BUG=1753 Review URL: http://codereview.chromium.org/8198005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9551 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/jsregexp.cc | 1 - src/jsregexp.h | 2 +- src/profile-generator.cc | 2 -- src/profile-generator.h | 2 +- src/splay-tree-inl.h | 6 +++--- test/cctest/test-regexp.cc | 3 +-- 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/jsregexp.cc b/src/jsregexp.cc index 5c68743..c1a9e06 100644 --- a/src/jsregexp.cc +++ b/src/jsregexp.cc @@ -4723,7 +4723,6 @@ bool OutSet::Get(unsigned value) { const uc16 DispatchTable::Config::kNoKey = unibrow::Utf8::kBadChar; -const DispatchTable::Entry DispatchTable::Config::kNoValue; void DispatchTable::AddRange(CharacterRange full_range, int value) { diff --git a/src/jsregexp.h b/src/jsregexp.h index 5281487..df110d1 100644 --- a/src/jsregexp.h +++ b/src/jsregexp.h @@ -389,7 +389,7 @@ class DispatchTable : public ZoneObject { 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; diff --git a/src/profile-generator.cc b/src/profile-generator.cc index c1052e6..bae35c8 100644 --- a/src/profile-generator.cc +++ b/src/profile-generator.cc @@ -488,8 +488,6 @@ void CpuProfile::Print() { 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) { diff --git a/src/profile-generator.h b/src/profile-generator.h index a3b0f1a..0eb73be 100644 --- a/src/profile-generator.h +++ b/src/profile-generator.h @@ -257,7 +257,7 @@ class CodeMap { 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); } diff --git a/src/splay-tree-inl.h b/src/splay-tree-inl.h index 9c2287e..4640ed5 100644 --- a/src/splay-tree-inl.h +++ b/src/splay-tree-inl.h @@ -45,7 +45,7 @@ template bool SplayTree::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 @@ bool SplayTree::Insert(const Key& key, Locator* locator) { 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 @@ template void SplayTree::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 diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc index 89a9112..b778478 100644 --- a/test/cctest/test-regexp.cc +++ b/test/cctest/test-regexp.cc @@ -530,7 +530,7 @@ class TestConfig { 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 @@ class TestConfig { const int TestConfig::kNoKey = 0; -const int TestConfig::kNoValue = 0; static unsigned PseudoRandom(int i, int j) { -- 2.7.4