Reviewers: Vitaly, Description: - Add a pointer to StubCache from Isolate. - Remove AllStatic parent from StubCache. - Add empty constructor to StubCache.
Please review this at http://codereview.chromium.org/2463002/show SVN Base: http://v8.googlecode.com/svn/branches/experimental/isolates/ Affected files: M src/isolate.h M src/isolate.cc M src/stub-cache.h M src/stub-cache.cc Index: src/isolate.cc =================================================================== --- src/isolate.cc (revision 4763) +++ src/isolate.cc (working copy) @@ -64,11 +64,14 @@ } -Isolate::Isolate() { +Isolate::Isolate() + : stub_cache_(NULL) { } Isolate::~Isolate() { + delete stub_cache_; + stub_cache_ = NULL; } @@ -122,6 +125,7 @@ #ifdef ENABLE_DEBUGGER_SUPPORT Debug::Setup(create_heap_objects); #endif + stub_cache_ = new StubCache(); StubCache::Initialize(create_heap_objects); // If we are deserializing, read the state into the now-empty heap. Index: src/isolate.h =================================================================== --- src/isolate.h (revision 4763) +++ src/isolate.h (working copy) @@ -34,6 +34,7 @@ namespace internal { class Deserializer; +class StubCache; class Isolate { public: @@ -54,6 +55,7 @@ // Accessors. Heap* heap() { return &heap_; } + StubCache* stub_cache() { return stub_cache_; } private: Isolate(); @@ -63,6 +65,7 @@ bool Init(Deserializer* des); Heap heap_; + StubCache* stub_cache_; DISALLOW_COPY_AND_ASSIGN(Isolate); }; Index: src/stub-cache.cc =================================================================== --- src/stub-cache.cc (revision 4763) +++ src/stub-cache.cc (working copy) @@ -42,6 +42,10 @@ StubCache::Entry StubCache::primary_[StubCache::kPrimaryTableSize]; StubCache::Entry StubCache::secondary_[StubCache::kSecondaryTableSize]; +StubCache::StubCache() { +} + + void StubCache::Initialize(bool create_heap_objects) { ASSERT(IsPowerOf2(kPrimaryTableSize)); ASSERT(IsPowerOf2(kSecondaryTableSize)); Index: src/stub-cache.h =================================================================== --- src/stub-cache.h (revision 4763) +++ src/stub-cache.h (working copy) @@ -44,7 +44,7 @@ class SCTableReference; -class StubCache : public AllStatic { +class StubCache { public: struct Entry { String* key; @@ -215,6 +215,9 @@ }; private: + StubCache(); + + friend class Isolate; friend class SCTableReference; static const int kPrimaryTableSize = 2048; static const int kSecondaryTableSize = 512; -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
