Revision: 16979
Author:   machenb...@chromium.org
Date:     Fri Sep 27 09:45:14 2013 UTC
Log: Revert "Add methods to enable configuration of ResourceConstraints based on limits derived at runtime." and "Fix Windows build of defaults.cc."

This reverts commit r16964 and r16968 due to performance regressions in octane.

TBR=hpa...@chromium.org

Review URL: https://codereview.chromium.org/24996003
http://code.google.com/p/v8/source/detail?r=16979

Deleted:
 /branches/bleeding_edge/include/v8-defaults.h
 /branches/bleeding_edge/src/defaults.cc
Modified:
 /branches/bleeding_edge/include/v8-testing.h
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/d8.cc
 /branches/bleeding_edge/src/globals.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/platform-posix.cc
 /branches/bleeding_edge/src/platform-win32.cc
 /branches/bleeding_edge/src/platform.h
 /branches/bleeding_edge/tools/gyp/v8.gyp

=======================================
--- /branches/bleeding_edge/include/v8-defaults.h Thu Sep 26 13:31:19 2013 UTC
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef V8_V8_DEFAULTS_H_
-#define V8_V8_DEFAULTS_H_
-
-#include "v8.h"
-
-/**
- * Default configuration support for the V8 JavaScript engine.
- */
-namespace v8 {
-
-/**
- * Configures the constraints with reasonable default values based on the
- * capabilities of the current device the VM is running on.
- */
-bool V8_EXPORT ConfigureResourceConstraintsForCurrentPlatform(
-    ResourceConstraints* constraints);
-
-
-/**
- * Convience function which performs SetResourceConstraints with the settings
- * returned by ConfigureResourceConstraintsForCurrentPlatform.
- */
-bool V8_EXPORT SetDefaultResourceConstraintsForCurrentPlatform();
-
-}  // namespace v8
-
-#endif  // V8_V8_DEFAULTS_H_
=======================================
--- /branches/bleeding_edge/src/defaults.cc     Thu Sep 26 14:49:47 2013 UTC
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "../include/v8-defaults.h"
-
-#include "platform.h"
-#include "globals.h"
-#include "v8.h"
-
-namespace v8 {
-
-bool ConfigureResourceConstraintsForCurrentPlatform(
-    ResourceConstraints* constraints) {
-  if (constraints == NULL) {
-    return false;
-  }
-
-  uint64_t physical_memory = i::OS::TotalPhysicalMemory();
-  int lump_of_memory = (i::kPointerSize / 4) * i::MB;
-
- // The young_space_size should be a power of 2 and old_generation_size should
-  // be a multiple of Page::kPageSize.
-  if (physical_memory > 2ul * i::GB) {
-    constraints->set_max_young_space_size(8 * lump_of_memory);
-    constraints->set_max_old_space_size(700 * lump_of_memory);
-    constraints->set_max_executable_size(256 * lump_of_memory);
-  } else if (physical_memory > 512ul * i::MB) {
-    constraints->set_max_young_space_size(4 * lump_of_memory);
-    constraints->set_max_old_space_size(192 * lump_of_memory);
-    constraints->set_max_executable_size(192 * lump_of_memory);
-  } else /* (physical_memory <= 512GB) */ {
-    constraints->set_max_young_space_size(1 * lump_of_memory);
-    constraints->set_max_old_space_size(96 * lump_of_memory);
-    constraints->set_max_executable_size(96 * lump_of_memory);
-  }
-  return true;
-}
-
-
-bool SetDefaultResourceConstraintsForCurrentPlatform() {
-  ResourceConstraints constraints;
-  if (!ConfigureResourceConstraintsForCurrentPlatform(&constraints))
-    return false;
-  return SetResourceConstraints(&constraints);
-}
-
-}  // namespace v8::internal
=======================================
--- /branches/bleeding_edge/include/v8-testing.h Thu Sep 26 13:31:19 2013 UTC +++ /branches/bleeding_edge/include/v8-testing.h Fri Sep 27 09:45:14 2013 UTC
@@ -68,4 +68,8 @@

 }  // namespace v8

+
+#undef V8_EXPORT
+
+
 #endif  // V8_V8_TEST_H_
=======================================
--- /branches/bleeding_edge/include/v8.h        Fri Sep 27 07:04:02 2013 UTC
+++ /branches/bleeding_edge/include/v8.h        Fri Sep 27 09:45:14 2013 UTC
@@ -3804,9 +3804,6 @@
 };


-/**
- * Sets the given ResourceConstraints on the current isolate.
- */
 bool V8_EXPORT SetResourceConstraints(ResourceConstraints* constraints);


=======================================
--- /branches/bleeding_edge/src/d8.cc   Thu Sep 26 13:31:19 2013 UTC
+++ /branches/bleeding_edge/src/d8.cc   Fri Sep 27 09:45:14 2013 UTC
@@ -49,7 +49,6 @@
 #endif  // !V8_SHARED

 #ifdef V8_SHARED
-#include "../include/v8-defaults.h"
 #include "../include/v8-testing.h"
 #endif  // V8_SHARED

@@ -67,7 +66,6 @@
 #include "natives.h"
 #include "platform.h"
 #include "v8.h"
-#include "v8-defaults.h"
 #endif  // V8_SHARED

 #if !defined(_WIN32) && !defined(_WIN64)
@@ -1651,7 +1649,6 @@
 #else
   SetStandaloneFlagsViaCommandLine();
 #endif
-  v8::SetDefaultResourceConstraintsForCurrentPlatform();
   ShellArrayBufferAllocator array_buffer_allocator;
   v8::V8::SetArrayBufferAllocator(&array_buffer_allocator);
   int result = 0;
=======================================
--- /branches/bleeding_edge/src/globals.h       Thu Sep 26 13:31:19 2013 UTC
+++ /branches/bleeding_edge/src/globals.h       Fri Sep 27 09:45:14 2013 UTC
@@ -248,12 +248,10 @@
 const int kPointerSizeLog2 = 3;
 const intptr_t kIntptrSignBit = V8_INT64_C(0x8000000000000000);
 const uintptr_t kUintptrAllBitsSet = V8_UINT64_C(0xFFFFFFFFFFFFFFFF);
-const bool kIs64BitArch = true;
 #else
 const int kPointerSizeLog2 = 2;
 const intptr_t kIntptrSignBit = 0x80000000;
 const uintptr_t kUintptrAllBitsSet = 0xFFFFFFFFu;
-const bool kIs64BitArch = false;
 #endif

 const int kBitsPerByte = 8;
=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Sep 26 13:31:19 2013 UTC
+++ /branches/bleeding_edge/src/heap.cc Fri Sep 27 09:45:14 2013 UTC
@@ -67,14 +67,29 @@

 Heap::Heap()
     : isolate_(NULL),
-      code_range_size_(kIs64BitArch ? 512 * MB : 0),
// semispace_size_ should be a power of 2 and old_generation_size_ should be
 // a multiple of Page::kPageSize.
-      reserved_semispace_size_(8 * (kPointerSize / 4) * MB),
-      max_semispace_size_(8 * (kPointerSize / 4)  * MB),
+#if V8_TARGET_ARCH_X64
+#define LUMP_OF_MEMORY (2 * MB)
+      code_range_size_(512*MB),
+#else
+#define LUMP_OF_MEMORY MB
+      code_range_size_(0),
+#endif
+#if defined(ANDROID) || V8_TARGET_ARCH_MIPS
+      reserved_semispace_size_(4 * Max(LUMP_OF_MEMORY, Page::kPageSize)),
+      max_semispace_size_(4 * Max(LUMP_OF_MEMORY, Page::kPageSize)),
       initial_semispace_size_(Page::kPageSize),
-      max_old_generation_size_(700ul * (kPointerSize / 4) * MB),
-      max_executable_size_(256ul * (kPointerSize / 4) * MB),
+      max_old_generation_size_(192*MB),
+      max_executable_size_(max_old_generation_size_),
+#else
+      reserved_semispace_size_(8 * Max(LUMP_OF_MEMORY, Page::kPageSize)),
+      max_semispace_size_(8 * Max(LUMP_OF_MEMORY, Page::kPageSize)),
+      initial_semispace_size_(Page::kPageSize),
+      max_old_generation_size_(700ul * LUMP_OF_MEMORY),
+      max_executable_size_(256l * LUMP_OF_MEMORY),
+#endif
+
 // Variables set based on semispace_size_ and old_generation_size_ in
// ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_)
 // Will be 4 * reserved_semispace_size_ to ensure that young
@@ -155,9 +170,6 @@
   max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE;
 #endif

-  // Ensure old_generation_size_ is a multiple of kPageSize.
-  ASSERT(MB >= Page::kPageSize);
-
   intptr_t max_virtual = OS::MaxVirtualMemory();

   if (max_virtual > 0) {
=======================================
--- /branches/bleeding_edge/src/platform-posix.cc Thu Sep 26 13:31:19 2013 UTC +++ /branches/bleeding_edge/src/platform-posix.cc Fri Sep 27 09:45:14 2013 UTC
@@ -98,48 +98,6 @@
   if (result != 0) return 0;
   return limit.rlim_cur;
 }
-
-
-uint64_t OS::TotalPhysicalMemory() {
-#if V8_OS_MACOSX
-  int mib[2];
-  mib[0] = CTL_HW;
-  mib[1] = HW_MEMSIZE;
-  int64_t size = 0;
-  size_t len = sizeof(size);
-  if (sysctl(mib, 2, &size, &len, NULL, 0) != 0) {
-    UNREACHABLE();
-    return 0;
-  }
-  return static_cast<uint64_t>(size);
-#elif V8_OS_FREEBSD
-  int pages, page_size;
-  size_t size = sizeof(pages);
-  sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0);
-  sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);
-  if (pages == -1 || page_size == -1) {
-    UNREACHABLE();
-    return 0;
-  }
-  return static_cast<uint64_t>(pages) * page_size;
-#elif V8_OS_CYGWIN
-  MEMORYSTATUS memory_info;
-  memory_info.dwLength = sizeof(memory_info);
-  if (!GlobalMemoryStatus(&memory_info)) {
-    UNREACHABLE();
-    return 0;
-  }
-  return static_cast<uint64_t>(memory_info.dwTotalPhys);
-#else
-  intptr_t pages = sysconf(_SC_PHYS_PAGES);
-  intptr_t page_size = sysconf(_SC_PAGESIZE);
-  if (pages == -1 || page_size == -1) {
-    UNREACHABLE();
-    return 0;
-  }
-  return static_cast<uint64_t>(pages) * page_size;
-#endif
-}


 int OS::ActivationFrameAlignment() {
=======================================
--- /branches/bleeding_edge/src/platform-win32.cc Thu Sep 26 13:31:19 2013 UTC +++ /branches/bleeding_edge/src/platform-win32.cc Fri Sep 27 09:45:14 2013 UTC
@@ -1269,18 +1269,6 @@

 void OS::SignalCodeMovingGC() {
 }
-
-
-uint64_t OS::TotalPhysicalMemory() {
-  MEMORYSTATUSEX memory_info;
-  memory_info.dwLength = sizeof(memory_info);
-  if (!GlobalMemoryStatusEx(&memory_info)) {
-    UNREACHABLE();
-    return 0;
-  }
-
-  return static_cast<uint64_t>(memory_info.ullTotalPhys);
-}


 #else  // __MINGW32__
=======================================
--- /branches/bleeding_edge/src/platform.h      Thu Sep 26 13:31:19 2013 UTC
+++ /branches/bleeding_edge/src/platform.h      Fri Sep 27 09:45:14 2013 UTC
@@ -302,9 +302,6 @@
// positions indicated by the members of the CpuFeature enum from globals.h
   static uint64_t CpuFeaturesImpliedByPlatform();

-  // The total amount of physical memory available on the current system.
-  static uint64_t TotalPhysicalMemory();
-
   // Maximum size of the virtual memory.  0 means there is no artificial
   // limit.
   static intptr_t MaxVirtualMemory();
=======================================
--- /branches/bleeding_edge/tools/gyp/v8.gyp    Thu Sep 26 16:25:57 2013 UTC
+++ /branches/bleeding_edge/tools/gyp/v8.gyp    Fri Sep 27 09:45:14 2013 UTC
@@ -270,7 +270,6 @@
         '../../src/debug-agent.h',
         '../../src/debug.cc',
         '../../src/debug.h',
-        '../../src/defaults.cc',
         '../../src/deoptimizer.cc',
         '../../src/deoptimizer.h',
         '../../src/disasm.h',

--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to