Reviewers: Sven Panne, malchev_google.com,

Message:
Please take a look.

Patch Set 1 contains the original patch from Iliyan.

Patch Set 2 is what I propose to take from the original patch.

Iliyan's message follows:

Most of the StubCache object is initialized with a single memset() to zero in
the constructor. This is wasteful of memory, as the memset will immediately
cause COW duplication of 4 pages (per v8 instance?), most of which may not
actually be used.

This patch removes the memsets() from the constructor, and constructs the object on top of a calloc()-allocated buffer instread. Calloc() will most likely get
fresh pages via an anonymous mmap() behind the scenes, which are
already zeroed out by the kernel.


https://chromiumcodereview.appspot.com/9464054/diff/2001/src/stub-cache.cc
File src/stub-cache.cc (left):

https://chromiumcodereview.appspot.com/9464054/diff/2001/src/stub-cache.cc#oldcode48
src/stub-cache.cc:48: memset(primary_, 0, sizeof(primary_[0]) *
StubCache::kPrimaryTableSize);
It should be save to remove the memsets, because the isolate calls
StubCache::Initialize() shortly after constructing the stub cache.

Description:
Do not call memset() to initialize StubCache.

Patch from Iliyan Malchev.


Please review this at https://chromiumcodereview.appspot.com/9464054/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/stub-cache.cc


Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index 4bbfe176875852072578e068ef96663b56a4ce83..f50c47432aa381541739885e1218188111b0781e 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -45,8 +45,6 @@ namespace internal {

 StubCache::StubCache(Isolate* isolate) : isolate_(isolate) {
   ASSERT(isolate == Isolate::Current());
-  memset(primary_, 0, sizeof(primary_[0]) * StubCache::kPrimaryTableSize);
- memset(secondary_, 0, sizeof(secondary_[0]) * StubCache::kSecondaryTableSize);
 }




--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to