Revision: 8446
Author:   [email protected]
Date:     Tue Jun 28 06:42:01 2011
Log:      Make gc branch compile on Win32.

Just compile, there are still crashes.
And not even close to compiling successfully on Win64.

Review URL: http://codereview.chromium.org/7277038
http://code.google.com/p/v8/source/detail?r=8446

Modified:
 /branches/experimental/gc/src/compiler-intrinsics.h
 /branches/experimental/gc/src/heap.cc
 /branches/experimental/gc/src/heap.h
 /branches/experimental/gc/src/incremental-marking.cc
 /branches/experimental/gc/src/platform-win32.cc
 /branches/experimental/gc/src/spaces.h
 /branches/experimental/gc/src/x64/macro-assembler-x64.h

=======================================
--- /branches/experimental/gc/src/compiler-intrinsics.h Wed Jan 19 09:55:55 2011 +++ /branches/experimental/gc/src/compiler-intrinsics.h Tue Jun 28 06:42:01 2011
@@ -50,6 +50,24 @@
 int CompilerIntrinsics::CountLeadingZeros(uint32_t value) {
   return __builtin_clz(value);
 }
+
+#elif defined(_MSC_VER)
+
+#pragma intrinsic(_BitScanForward)
+#pragma intrinsic(_BitScanReverse)
+
+int CompilerIntrinsics::CountTrailingZeros(uint32_t value) {
+  unsigned long result;
+  _BitScanForward(&result, static_cast<long>(value));
+  return static_cast<int>(result);
+}
+
+int CompilerIntrinsics::CountLeadingZeros(uint32_t value) {
+  unsigned long result;
+  _BitScanReverse(&result, static_cast<long>(value));
+  return 31 - static_cast<int>(result);
+}
+
 #else
 #error Unsupported compiler
 #endif
=======================================
--- /branches/experimental/gc/src/heap.cc       Fri Jun 24 05:46:32 2011
+++ /branches/experimental/gc/src/heap.cc       Tue Jun 28 06:42:01 2011
@@ -4564,9 +4564,9 @@
 // TODO(1236194): Since the heap size is configurable on the command line
 // and through the API, we should gracefully handle the case that the heap
 // size is not big enough to fit all the initial objects.
-bool Heap::ConfigureHeap(intptr_t max_semispace_size,
-                         intptr_t max_old_gen_size,
-                         intptr_t max_executable_size) {
+bool Heap::ConfigureHeap(int max_semispace_size,
+                         int max_old_gen_size,
+                         int max_executable_size) {
   if (HasBeenSetup()) return false;

   if (max_semispace_size > 0) {
=======================================
--- /branches/experimental/gc/src/heap.h        Fri Jun 24 05:19:57 2011
+++ /branches/experimental/gc/src/heap.h        Tue Jun 28 06:42:01 2011
@@ -352,9 +352,9 @@
  public:
   // Configure heap size before setup. Return false if the heap has been
   // setup already.
-  bool ConfigureHeap(intptr_t max_semispace_size,
-                     intptr_t max_old_gen_size,
-                     intptr_t max_executable_size);
+  bool ConfigureHeap(int max_semispace_size,
+                     int max_old_gen_size,
+                     int max_executable_size);
   bool ConfigureHeapDefault();

   // Initializes the global object heap. If create_heap_objects is true,
=======================================
--- /branches/experimental/gc/src/incremental-marking.cc Fri Jun 24 05:46:32 2011 +++ /branches/experimental/gc/src/incremental-marking.cc Tue Jun 28 06:42:01 2011
@@ -567,7 +567,8 @@

   if ((steps_count_ % kAllocationMarkingFactorSpeedupInterval) == 0) {
     allocation_marking_factor_ += kAllocationMarkingFactorSpeedup;
-    allocation_marking_factor_ *= 1.3;
+    allocation_marking_factor_ =
+        static_cast<int>(allocation_marking_factor_ * 1.3);
     if (FLAG_trace_gc) {
PrintF("Marking speed increased to %d\n", allocation_marking_factor_);
     }
=======================================
--- /branches/experimental/gc/src/platform-win32.cc     Mon May  9 14:11:15 2011
+++ /branches/experimental/gc/src/platform-win32.cc     Tue Jun 28 06:42:01 2011
@@ -1434,7 +1434,7 @@


 VirtualMemory::VirtualMemory(size_t size) {
-  address_ = VirtualAlloc(NULL, size, MEM_RESERVE, PAGE_NOACCESS);
+  address_ = ReserveRegion(size);
   size_ = size;
 }

@@ -1447,22 +1447,47 @@


bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) {
+  if (CommitRegion(address, size, is_executable)) {
+    UpdateAllocatedSpaceLimits(address, static_cast<int>(size));
+    return true;
+  }
+  return false;
+}
+
+
+bool VirtualMemory::Uncommit(void* address, size_t size) {
+  ASSERT(IsReserved());
+  return UncommitRegion(address, size);
+}
+
+
+void* VirtualMemory::ReserveRegion(size_t size) {
+  return VirtualAlloc(NULL, size, MEM_RESERVE, PAGE_NOACCESS);
+}
+
+
+bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) {
   int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
-  if (NULL == VirtualAlloc(address, size, MEM_COMMIT, prot)) {
+  if (NULL == VirtualAlloc(base, size, MEM_COMMIT, prot)) {
     return false;
   }

-  UpdateAllocatedSpaceLimits(address, static_cast<int>(size));
+  UpdateAllocatedSpaceLimits(base, static_cast<int>(size));
   return true;
 }


-bool VirtualMemory::Uncommit(void* address, size_t size) {
-  ASSERT(IsReserved());
-  return VirtualFree(address, size, MEM_DECOMMIT) != false;
+bool VirtualMemory::UncommitRegion(void* base, size_t size) {
+  return VirtualFree(base, size, MEM_DECOMMIT) != false;
 }


+bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
+  return VirtualFree(base, size, MEM_DECOMMIT) != false;
+}
+
+
+
// ----------------------------------------------------------------------------
 // Win32 thread support.

=======================================
--- /branches/experimental/gc/src/spaces.h      Fri Jun 24 05:46:32 2011
+++ /branches/experimental/gc/src/spaces.h      Tue Jun 28 06:42:01 2011
@@ -379,11 +379,11 @@
   };

   void SetFlag(int flag) {
-    flags_ |= (1 << flag);
+    flags_ |= static_cast<uintptr_t>(1) << flag;
   }

   void ClearFlag(int flag) {
-    flags_ &= ~(1 << flag);
+    flags_ &= ~(static_cast<uintptr_t>(1) << flag);
   }

   void SetFlagTo(int flag, bool value) {
@@ -395,7 +395,7 @@
   }

   bool IsFlagSet(int flag) {
-    return (flags_ & (1 << flag)) != 0;
+    return (flags_ & (static_cast<uintptr_t>(1) << flag)) != 0;
   }

   // Set or clear multiple flags at a time. The flags in the mask
@@ -421,7 +421,8 @@
     MemoryChunk::FromAddress(address)->IncrementLiveBytes(by);
   }

-  static const intptr_t kAlignment = (1 << kPageSizeBits);
+  static const intptr_t kAlignment =
+      (static_cast<uintptr_t>(1) << kPageSizeBits);

   static const intptr_t kAlignmentMask = kAlignment - 1;

=======================================
--- /branches/experimental/gc/src/x64/macro-assembler-x64.h Fri Jun 10 14:58:26 2011 +++ /branches/experimental/gc/src/x64/macro-assembler-x64.h Tue Jun 28 06:42:01 2011
@@ -151,8 +151,9 @@
                       Register exclusion2 = no_reg,
                       Register exclusion3 = no_reg);

- // ---------------------------------------------------------------------------
-  // GC Support
+// ---------------------------------------------------------------------------
+// GC Support
+

   enum RememberedSetFinalAction {
     kReturnAtEnd,

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

Reply via email to