Reviewers: danno, Hannes Payer, mtbrandyberry, michael_dawson, Sven Panne,

Description:
PPC: perf enhancement: Use larger heap page size on PPC.

Revisit of https://codereview.chromium.org/910333004.

Use 4MB heap page size over the default of 1MB.

This change provides an improvement of 1.86% on the composite octane
benchmark score on PPC. This is 0.56% more than if --min_semi_space_size=4
was used to specify a 4MB heap page size.

Additionally, two more tests required modification to account for
configurable heap page size.

[email protected], [email protected], [email protected],
[email protected], [email protected]
BUG=

Please review this at https://codereview.chromium.org/1221433022/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+28, -13 lines):
  M src/base/build_config.h
  M src/heap/heap.cc
  M test/cctest/test-api.cc
  M test/cctest/test-strings.cc


Index: src/base/build_config.h
diff --git a/src/base/build_config.h b/src/base/build_config.h
index 661bf80e6e579311841ff27aa76ba31b3b49ebbd..b8ba4eb8d2c5a406c6355113c378dce8280bdaa7 100644
--- a/src/base/build_config.h
+++ b/src/base/build_config.h
@@ -177,6 +177,11 @@

// Number of bits to represent the page size for paged spaces. The value of 20
 // gives 1Mb bytes per page.
+#if V8_HOST_ARCH_PPC && V8_TARGET_ARCH_PPC && V8_OS_LINUX
+// Bump up for Power Linux due to larger (64K) page size.
+const int kPageSizeBits = 22;
+#else
 const int kPageSizeBits = 20;
+#endif

 #endif  // V8_BASE_BUILD_CONFIG_H_
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 4660a67dd2847e668ca305a780bc8e80a2482488..ab4e79048680b0d0b5b01095f1ff421b0dfea3c3 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -169,7 +169,7 @@ Heap::Heap()
 #endif

   // Ensure old_generation_size_ is a multiple of kPageSize.
-  DCHECK(MB >= Page::kPageSize);
+  DCHECK((max_old_generation_size_ & (Page::kPageSize - 1)) == 0);

   memset(roots_, 0, sizeof(roots_[0]) * kRootListLength);
   set_native_contexts_list(NULL);
@@ -5354,6 +5354,13 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, max_executable_size_ = static_cast<intptr_t>(FLAG_max_executable_size) * MB;
   }

+  if (Page::kPageSize > MB) {
+    max_semi_space_size_ = ROUND_UP(max_semi_space_size_, Page::kPageSize);
+    max_old_generation_size_ =
+        ROUND_UP(max_old_generation_size_, Page::kPageSize);
+    max_executable_size_ = ROUND_UP(max_executable_size_, Page::kPageSize);
+  }
+
   if (FLAG_stress_compaction) {
     // This will cause more frequent GCs when stressing.
     max_semi_space_size_ = Page::kPageSize;
@@ -5379,12 +5386,6 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size,
     reserved_semispace_size_ = max_semi_space_size_;
   }

-  // The max executable size must be less than or equal to the max old
-  // generation size.
-  if (max_executable_size_ > max_old_generation_size_) {
-    max_executable_size_ = max_old_generation_size_;
-  }
-
// The new space size must be a power of two to support single-bit testing
   // for containment.
   max_semi_space_size_ =
@@ -5403,7 +5404,8 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size,
                      max_semi_space_size_ / MB);
       }
     } else {
-      initial_semispace_size_ = initial_semispace_size;
+      initial_semispace_size_ =
+          ROUND_UP(initial_semispace_size, Page::kPageSize);
     }
   }

@@ -5428,7 +5430,7 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size,
                      max_semi_space_size_ / MB);
       }
     } else {
-      target_semispace_size_ = target_semispace_size;
+ target_semispace_size_ = ROUND_UP(target_semispace_size, Page::kPageSize);
     }
   }

@@ -5444,6 +5446,12 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size,
       Max(static_cast<intptr_t>(paged_space_count * Page::kPageSize),
           max_old_generation_size_);

+  // The max executable size must be less than or equal to the max old
+  // generation size.
+  if (max_executable_size_ > max_old_generation_size_) {
+    max_executable_size_ = max_old_generation_size_;
+  }
+
   if (FLAG_initial_old_space_size > 0) {
     initial_old_generation_size_ = FLAG_initial_old_space_size * MB;
   } else {
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 2bfdeabd42cd606a40e8242d120465dc0414a0ab..412e963b60d349c8c478e4e91ba157f5318ebb63 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -17210,10 +17210,12 @@ class InitDefaultIsolateThread : public v8::base::Thread {
   void Run() {
     v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+    const intptr_t pageSizeMult =
+        v8::internal::Page::kPageSize / v8::internal::MB;
     switch (testCase_) {
       case SetResourceConstraints: {
-        create_params.constraints.set_max_semi_space_size(1);
-        create_params.constraints.set_max_old_space_size(4);
+ create_params.constraints.set_max_semi_space_size(1 * pageSizeMult);
+        create_params.constraints.set_max_old_space_size(4 * pageSizeMult);
         break;
       }
       default:
Index: test/cctest/test-strings.cc
diff --git a/test/cctest/test-strings.cc b/test/cctest/test-strings.cc
index d8d7c96871a8c63005343844bab68ce608429cb5..bf3177d3e824b48b3a263e20d4b160d6fa77012e 100644
--- a/test/cctest/test-strings.cc
+++ b/test/cctest/test-strings.cc
@@ -1209,8 +1209,8 @@ TEST(SliceFromSlice) {
 UNINITIALIZED_TEST(OneByteArrayJoin) {
   v8::Isolate::CreateParams create_params;
   // Set heap limits.
-  create_params.constraints.set_max_semi_space_size(1);
-  create_params.constraints.set_max_old_space_size(6);
+ create_params.constraints.set_max_semi_space_size(1 * Page::kPageSize / MB); + create_params.constraints.set_max_old_space_size(6 * Page::kPageSize / MB);
   create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
   v8::Isolate* isolate = v8::Isolate::New(create_params);
   isolate->Enter();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to