Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Unified Diff: src/scopes.cc

Issue 9372106: Make HashMap a template class to specify the allocation policy. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/isolate.h ('K') | « src/scopes.h ('k') | src/zone.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.cc
===================================================================
--- src/scopes.cc (revision 10795)
+++ src/scopes.cc (working copy)
@@ -40,26 +40,6 @@
namespace internal {
// ----------------------------------------------------------------------------
-// A Zone allocator for use with LocalsMap.
-
-// TODO(isolates): It is probably worth it to change the Allocator class to
-// take a pointer to an isolate.
-class ZoneAllocator: public Allocator {
- public:
- /* nothing to do */
- virtual ~ZoneAllocator() {}
-
- virtual void* New(size_t size) { return ZONE->New(static_cast<int>(size)); }
-
- /* ignored - Zone is freed in one fell swoop */
- virtual void Delete(void* p) {}
-};
-
-
-static ZoneAllocator* LocalsMapAllocator = ::new ZoneAllocator();
-
-
-// ----------------------------------------------------------------------------
// Implementation of LocalsMap
//
// Note: We are storing the handle locations as key values in the hash map.
@@ -77,7 +57,7 @@
}
-VariableMap::VariableMap() : HashMap(Match, LocalsMapAllocator, 8) {}
+VariableMap::VariableMap() : ZoneHashMap(Match, 8) {}
VariableMap::~VariableMap() {}
@@ -88,7 +68,7 @@
bool is_valid_lhs,
Variable::Kind kind,
InitializationFlag initialization_flag) {
- HashMap::Entry* p = HashMap::Lookup(name.location(), name->Hash(), true);
+ Entry* p = ZoneHashMap::Lookup(name.location(), name->Hash(), true);
if (p->value == NULL) {
// The variable has not been declared yet -> insert it.
ASSERT(p->key == name.location());
@@ -104,7 +84,7 @@
Variable* VariableMap::Lookup(Handle<String> name) {
- HashMap::Entry* p = HashMap::Lookup(name.location(), name->Hash(), false);
+ Entry* p = ZoneHashMap::Lookup(name.location(), name->Hash(), false);
if (p != NULL) {
ASSERT(*reinterpret_cast<String**>(p->key) == *name);
ASSERT(p->value != NULL);
« src/isolate.h ('K') | « src/scopes.h ('k') | src/zone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698