Revision: 6207
Author: [email protected]
Date: Thu Jan  6 06:05:23 2011
Log: Rename write buffers to store buffers.
Review URL: http://codereview.chromium.org/5985012
http://code.google.com/p/v8/source/detail?r=6207

Added:
 /branches/experimental/gc/src/store-buffer-inl.h
 /branches/experimental/gc/src/store-buffer.cc
 /branches/experimental/gc/src/store-buffer.h
Deleted:
 /branches/experimental/gc/src/write-buffer-inl.h
 /branches/experimental/gc/src/write-buffer.cc
 /branches/experimental/gc/src/write-buffer.h
Modified:
 /branches/experimental/gc/src/SConscript
 /branches/experimental/gc/src/assembler.cc
 /branches/experimental/gc/src/assembler.h
 /branches/experimental/gc/src/code-stubs.h
 /branches/experimental/gc/src/heap-inl.h
 /branches/experimental/gc/src/heap.h
 /branches/experimental/gc/src/ia32/code-stubs-ia32.cc
 /branches/experimental/gc/src/ia32/code-stubs-ia32.h
 /branches/experimental/gc/src/ia32/macro-assembler-ia32.cc
 /branches/experimental/gc/src/runtime.cc
 /branches/experimental/gc/src/runtime.h
 /branches/experimental/gc/src/serialize.cc
 /branches/experimental/gc/src/v8-counters.h
 /branches/experimental/gc/src/v8.cc
 /branches/experimental/gc/src/x64/code-stubs-x64.cc
 /branches/experimental/gc/src/x64/code-stubs-x64.h
 /branches/experimental/gc/src/x64/macro-assembler-x64.cc

=======================================
--- /dev/null
+++ /branches/experimental/gc/src/store-buffer-inl.h Thu Jan 6 06:05:23 2011
@@ -0,0 +1,56 @@
+// Copyright 2011 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_WRITE_BARRIER_INL_H_
+#define V8_WRITE_BARRIER_INL_H_
+
+#include "v8.h"
+#include "store-buffer.h"
+
+namespace v8 {
+namespace internal {
+
+Address StoreBuffer::TopAddress() {
+  return reinterpret_cast<Address>(Heap::store_buffer_top_address());
+}
+
+
+void StoreBuffer::Mark(Address addr) {
+  Address* top = reinterpret_cast<Address*>(Heap::store_buffer_top());
+  *top++ = addr;
+  Heap::public_set_store_buffer_top(top);
+  if ((reinterpret_cast<uintptr_t>(top) & kStoreBufferOverflowBit) != 0) {
+    ASSERT(top == limit_);
+    Compact();
+  } else {
+    ASSERT(top < limit_);
+  }
+}
+
+} }  // namespace v8::internal
+
+#endif  // V8_WRITE_BARRIER_INL_H_
=======================================
--- /dev/null
+++ /branches/experimental/gc/src/store-buffer.cc       Thu Jan  6 06:05:23 2011
@@ -0,0 +1,136 @@
+// Copyright 2010 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 "v8-counters.h"
+#include "store-buffer.h"
+#include "store-buffer-inl.h"
+
+namespace v8 {
+namespace internal {
+
+Address* StoreBuffer::start_ = NULL;
+Address* StoreBuffer::limit_ = NULL;
+uintptr_t* StoreBuffer::hash_map_1_ = NULL;
+uintptr_t* StoreBuffer::hash_map_2_ = NULL;
+VirtualMemory* StoreBuffer::virtual_memory_ = NULL;
+
+void StoreBuffer::Setup() {
+  virtual_memory_ = new VirtualMemory(kStoreBufferSize * 3);
+  uintptr_t start_as_int =
+      reinterpret_cast<uintptr_t>(virtual_memory_->address());
+  start_ =
+ reinterpret_cast<Address*>(RoundUp(start_as_int, kStoreBufferSize * 2));
+  limit_ = start_ + (kStoreBufferSize / sizeof(*start_));
+
+  ASSERT(reinterpret_cast<Address>(start_) >= virtual_memory_->address());
+  ASSERT(reinterpret_cast<Address>(limit_) >= virtual_memory_->address());
+  Address* vm_limit = reinterpret_cast<Address*>(
+      reinterpret_cast<char*>(virtual_memory_->address()) +
+          virtual_memory_->size());
+  ASSERT(start_ <= vm_limit);
+  ASSERT(limit_ <= vm_limit);
+  USE(vm_limit);
+ ASSERT((reinterpret_cast<uintptr_t>(limit_) & kStoreBufferOverflowBit) != 0); + ASSERT((reinterpret_cast<uintptr_t>(limit_ - 1) & kStoreBufferOverflowBit) ==
+         0);
+
+  virtual_memory_->Commit(reinterpret_cast<Address>(start_),
+                          kStoreBufferSize,
+                          false);  // Not executable.
+  Heap::public_set_store_buffer_top(start_);
+
+  hash_map_1_ = new uintptr_t[kHashMapLength];
+  hash_map_2_ = new uintptr_t[kHashMapLength];
+}
+
+
+void StoreBuffer::TearDown() {
+  delete virtual_memory_;
+  delete[] hash_map_1_;
+  delete[] hash_map_2_;
+  start_ = limit_ = NULL;
+  Heap::public_set_store_buffer_top(start_);
+}
+
+
+void StoreBuffer::Compact() {
+  memset(reinterpret_cast<void*>(hash_map_1_),
+         0,
+         sizeof(uintptr_t) * kHashMapLength);
+  memset(reinterpret_cast<void*>(hash_map_2_),
+         0,
+         sizeof(uintptr_t) * kHashMapLength);
+  Address* top = reinterpret_cast<Address*>(Heap::store_buffer_top());
+  Address* stop = top;
+  ASSERT(top <= limit_);
+  top = start_;
+  // Goes through the addresses in the store buffer attempting to remove
+  // duplicates.  In the interest of speed this is a lossy operation.  Some
+  // duplicates will remain.  We have two hash tables with different hash
+  // functions to reduce the number of unnecessary clashes.
+  for (Address* current = start_; current < stop; current++) {
+    uintptr_t int_addr = reinterpret_cast<uintptr_t>(*current);
+    // Shift out the last bits including any tags.
+    int_addr >>= kPointerSizeLog2;
+    int hash1 =
+ ((int_addr ^ (int_addr >> kHashMapLengthLog2)) & (kHashMapLength - 1));
+    if (hash_map_1_[hash1] == int_addr) continue;
+    int hash2 =
+ ((int_addr - (int_addr >> kHashMapLengthLog2)) & (kHashMapLength - 1));
+    hash2 ^= hash2 >> (kHashMapLengthLog2 * 2);
+    if (hash_map_2_[hash2] == int_addr) continue;
+    if (hash_map_1_[hash1] == 0) {
+      hash_map_1_[hash1] = int_addr;
+    } else if (hash_map_2_[hash2] == 0) {
+      hash_map_2_[hash2] = int_addr;
+    } else {
+ // Rather than slowing down we just throw away some entries. This will
+      // cause some duplicates to remain undetected.
+      hash_map_1_[hash1] = int_addr;
+      hash_map_2_[hash2] = 0;
+    }
+    ASSERT(top <= current);
+    ASSERT(top <= limit_);
+    *top++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2);
+  }
+  Counters::store_buffer_compactions.Increment();
+  if (limit_ - top < top - start_) {
+    // Compression did not free up at least half.
+    // TODO(gc): Set an interrupt to do a GC on the next back edge.
+    // TODO(gc): Allocate the rest of new space to force a GC on the next
+    // allocation.
+    if (limit_ - top < (top - start_) >> 1) {
+      // Compression did not free up at least one quarter.
+      // TODO(gc): Set a flag to scan all of memory.
+      top = start_;
+      Counters::store_buffer_overflows.Increment();
+    }
+  }
+  Heap::public_set_store_buffer_top(top);
+}
+
+} }  // namespace v8::internal
=======================================
--- /dev/null
+++ /branches/experimental/gc/src/store-buffer.h        Thu Jan  6 06:05:23 2011
@@ -0,0 +1,68 @@
+// Copyright 2010 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_WRITE_BARRIER_H_
+#define V8_WRITE_BARRIER_H_
+
+#include "allocation.h"
+#include "checks.h"
+#include "globals.h"
+#include "platform.h"
+
+namespace v8 {
+namespace internal {
+
+
+// Used to implement the write barrier by collecting addresses of pointers
+// between spaces.
+class StoreBuffer : public AllStatic {
+ public:
+  static inline Address TopAddress();
+
+  static void Setup();
+  static void TearDown();
+
+  static inline void Mark(Address addr);
+
+  static const int kStoreBufferOverflowBit = 1 << 16;
+  static const int kStoreBufferSize = kStoreBufferOverflowBit;
+  static const int kHashMapLengthLog2 = 12;
+  static const int kHashMapLength = 1 << kHashMapLengthLog2;
+
+  static void Compact();
+
+ private:
+  static Address* start_;
+  static Address* limit_;
+  static VirtualMemory* virtual_memory_;
+  static uintptr_t* hash_map_1_;
+  static uintptr_t* hash_map_2_;
+};
+
+} }  // namespace v8::internal
+
+#endif  // V8_WRITE_BARRIER_H_
=======================================
--- /branches/experimental/gc/src/write-buffer-inl.h Thu Jan 6 05:18:03 2011
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2011 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_WRITE_BARRIER_INL_H_
-#define V8_WRITE_BARRIER_INL_H_
-
-#include "v8.h"
-#include "write-buffer.h"
-
-namespace v8 {
-namespace internal {
-
-Address WriteBuffer::TopAddress() {
-  return reinterpret_cast<Address>(Heap::write_buffer_top_address());
-}
-
-
-void WriteBuffer::Mark(Address addr) {
-  Address* top = reinterpret_cast<Address*>(Heap::write_buffer_top());
-  *top++ = addr;
-  Heap::public_set_write_buffer_top(top);
-  if ((reinterpret_cast<uintptr_t>(top) & kWriteBufferOverflowBit) != 0) {
-    ASSERT(top == limit_);
-    Compact();
-  } else {
-    ASSERT(top < limit_);
-  }
-}
-
-} }  // namespace v8::internal
-
-#endif  // V8_WRITE_BARRIER_INL_H_
=======================================
--- /branches/experimental/gc/src/write-buffer.cc       Thu Jan  6 05:18:03 2011
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright 2010 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 "v8-counters.h"
-#include "write-buffer.h"
-#include "write-buffer-inl.h"
-
-namespace v8 {
-namespace internal {
-
-Address* WriteBuffer::start_ = NULL;
-Address* WriteBuffer::limit_ = NULL;
-uintptr_t* WriteBuffer::hash_map_1_ = NULL;
-uintptr_t* WriteBuffer::hash_map_2_ = NULL;
-VirtualMemory* WriteBuffer::virtual_memory_ = NULL;
-
-void WriteBuffer::Setup() {
-  virtual_memory_ = new VirtualMemory(kWriteBufferSize * 3);
-  uintptr_t start_as_int =
-      reinterpret_cast<uintptr_t>(virtual_memory_->address());
-  start_ =
- reinterpret_cast<Address*>(RoundUp(start_as_int, kWriteBufferSize * 2));
-  limit_ = start_ + (kWriteBufferSize / sizeof(*start_));
-
-  ASSERT(reinterpret_cast<Address>(start_) >= virtual_memory_->address());
-  ASSERT(reinterpret_cast<Address>(limit_) >= virtual_memory_->address());
-  Address* vm_limit = reinterpret_cast<Address*>(
-      reinterpret_cast<char*>(virtual_memory_->address()) +
-          virtual_memory_->size());
-  ASSERT(start_ <= vm_limit);
-  ASSERT(limit_ <= vm_limit);
-  USE(vm_limit);
- ASSERT((reinterpret_cast<uintptr_t>(limit_) & kWriteBufferOverflowBit) != 0); - ASSERT((reinterpret_cast<uintptr_t>(limit_ - 1) & kWriteBufferOverflowBit) ==
-         0);
-
-  virtual_memory_->Commit(reinterpret_cast<Address>(start_),
-                          kWriteBufferSize,
-                          false);  // Not executable.
-  Heap::public_set_write_buffer_top(start_);
-
-  hash_map_1_ = new uintptr_t[kHashMapLength];
-  hash_map_2_ = new uintptr_t[kHashMapLength];
-}
-
-
-void WriteBuffer::TearDown() {
-  delete virtual_memory_;
-  delete[] hash_map_1_;
-  delete[] hash_map_2_;
-  start_ = limit_ = NULL;
-  Heap::public_set_write_buffer_top(start_);
-}
-
-
-void WriteBuffer::Compact() {
-  memset(reinterpret_cast<void*>(hash_map_1_),
-         0,
-         sizeof(uintptr_t) * kHashMapLength);
-  memset(reinterpret_cast<void*>(hash_map_2_),
-         0,
-         sizeof(uintptr_t) * kHashMapLength);
-  Address* top = reinterpret_cast<Address*>(Heap::write_buffer_top());
-  Address* stop = top;
-  ASSERT(top <= limit_);
-  top = start_;
-  // Goes through the addresses in the write buffer attempting to remove
-  // duplicates.  In the interest of speed this is a lossy operation.  Some
-  // duplicates will remain.  We have two hash tables with different hash
-  // functions to reduce the number of unnecessary clashes.
-  for (Address* current = start_; current < stop; current++) {
-    uintptr_t int_addr = reinterpret_cast<uintptr_t>(*current);
-    // Shift out the last bits including any tags.
-    int_addr >>= kPointerSizeLog2;
-    int hash1 =
- ((int_addr ^ (int_addr >> kHashMapLengthLog2)) & (kHashMapLength - 1));
-    if (hash_map_1_[hash1] == int_addr) continue;
-    int hash2 =
- ((int_addr - (int_addr >> kHashMapLengthLog2)) & (kHashMapLength - 1));
-    hash2 ^= hash2 >> (kHashMapLengthLog2 * 2);
-    if (hash_map_2_[hash2] == int_addr) continue;
-    if (hash_map_1_[hash1] == 0) {
-      hash_map_1_[hash1] = int_addr;
-    } else if (hash_map_2_[hash2] == 0) {
-      hash_map_2_[hash2] = int_addr;
-    } else {
- // Rather than slowing down we just throw away some entries. This will
-      // cause some duplicates to remain undetected.
-      hash_map_1_[hash1] = int_addr;
-      hash_map_2_[hash2] = 0;
-    }
-    ASSERT(top <= current);
-    ASSERT(top <= limit_);
-    *top++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2);
-  }
-  Counters::write_buffer_compactions.Increment();
-  if (limit_ - top < top - start_) {
-    // Compression did not free up at least half.
-    // TODO(gc): Set an interrupt to do a GC on the next back edge.
-    // TODO(gc): Allocate the rest of new space to force a GC on the next
-    // allocation.
-    if (limit_ - top < (top - start_) >> 1) {
-      // Compression did not free up at least one quarter.
-      // TODO(gc): Set a flag to scan all of memory.
-      top = start_;
-      Counters::write_buffer_overflows.Increment();
-    }
-  }
-  Heap::public_set_write_buffer_top(top);
-}
-
-} }  // namespace v8::internal
=======================================
--- /branches/experimental/gc/src/write-buffer.h        Thu Jan  6 05:18:03 2011
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2010 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_WRITE_BARRIER_H_
-#define V8_WRITE_BARRIER_H_
-
-#include "allocation.h"
-#include "checks.h"
-#include "globals.h"
-#include "platform.h"
-
-namespace v8 {
-namespace internal {
-
-
-// Used to implement the write barrier by collecting addresses of pointers
-// between spaces.
-class WriteBuffer : public AllStatic {
- public:
-  static inline Address TopAddress();
-
-  static void Setup();
-  static void TearDown();
-
-  static inline void Mark(Address addr);
-
-  static const int kWriteBufferOverflowBit = 1 << 16;
-  static const int kWriteBufferSize = kWriteBufferOverflowBit;
-  static const int kHashMapLengthLog2 = 12;
-  static const int kHashMapLength = 1 << kHashMapLengthLog2;
-
-  static void Compact();
-
- private:
-  static Address* start_;
-  static Address* limit_;
-  static VirtualMemory* virtual_memory_;
-  static uintptr_t* hash_map_1_;
-  static uintptr_t* hash_map_2_;
-};
-
-} }  // namespace v8::internal
-
-#endif  // V8_WRITE_BARRIER_H_
=======================================
--- /branches/experimental/gc/src/SConscript    Wed Jan  5 05:52:13 2011
+++ /branches/experimental/gc/src/SConscript    Thu Jan  6 06:05:23 2011
@@ -128,7 +128,7 @@
     variables.cc
     version.cc
     virtual-frame.cc
-    write-buffer.cc
+    store-buffer.cc
     zone.cc
     extensions/gc-extension.cc
     extensions/externalize-string-extension.cc
=======================================
--- /branches/experimental/gc/src/assembler.cc  Tue Dec 21 04:32:46 2010
+++ /branches/experimental/gc/src/assembler.cc  Thu Jan  6 06:05:23 2011
@@ -47,7 +47,7 @@
 #include "ast.h"
 #include "regexp-macro-assembler.h"
 #include "platform.h"
-#include "write-buffer.h"
+#include "store-buffer.h"
 // Include native regexp-macro-assembler.
 #ifndef V8_INTERPRETED_REGEXP
 #if V8_TARGET_ARCH_IA32
@@ -673,8 +673,8 @@
 }


-ExternalReference ExternalReference::write_buffer_top() {
-  return ExternalReference(WriteBuffer::TopAddress());
+ExternalReference ExternalReference::store_buffer_top() {
+  return ExternalReference(StoreBuffer::TopAddress());
 }


=======================================
--- /branches/experimental/gc/src/assembler.h   Wed Jan  5 06:17:18 2011
+++ /branches/experimental/gc/src/assembler.h   Thu Jan  6 06:05:23 2011
@@ -538,7 +538,7 @@
   static ExternalReference heap_always_allocate_scope_depth();

   // Write barrier.
-  static ExternalReference write_buffer_top();
+  static ExternalReference store_buffer_top();

   // Used for fast allocation in generated code.
   static ExternalReference new_space_allocation_top_address();
=======================================
--- /branches/experimental/gc/src/code-stubs.h  Wed Jan  5 06:17:18 2011
+++ /branches/experimental/gc/src/code-stubs.h  Thu Jan  6 06:05:23 2011
@@ -47,7 +47,7 @@
   V(Compare)                             \
   V(CompareIC)                           \
   V(MathPow)                             \
-  V(WriteBufferOverflow)                 \
+  V(StoreBufferOverflow)                 \
   V(TranscendentalCache)                 \
   V(RecordWrite)                         \
   V(ConvertToDouble)                     \
=======================================
--- /branches/experimental/gc/src/heap-inl.h    Thu Jan  6 05:18:03 2011
+++ /branches/experimental/gc/src/heap-inl.h    Thu Jan  6 06:05:23 2011
@@ -31,8 +31,8 @@
 #include "heap.h"
 #include "objects.h"
 #include "v8-counters.h"
-#include "write-buffer.h"
-#include "write-buffer-inl.h"
+#include "store-buffer.h"
+#include "store-buffer-inl.h"

 namespace v8 {
 namespace internal {
@@ -272,13 +272,13 @@


 void Heap::RecordWrite(Address address, int offset) {
-  WriteBuffer::Mark(address + offset);
+  StoreBuffer::Mark(address + offset);
 }


 void Heap::RecordWrites(Address address, int start, int len) {
   for (int i = 0; i < len; i++) {
-    WriteBuffer::Mark(address + start + i);
+    StoreBuffer::Mark(address + start + i);
   }
 }

=======================================
--- /branches/experimental/gc/src/heap.h        Thu Jan  6 05:18:03 2011
+++ /branches/experimental/gc/src/heap.h        Thu Jan  6 06:05:23 2011
@@ -48,7 +48,7 @@
V(Map, two_pointer_filler_map, TwoPointerFillerMap) \ /* Cluster the most popular ones in a few cache lines here at the top. */ \ V(Smi, stack_limit, StackLimit) \ - V(Smi, write_buffer_top, WriteBufferTop) \ + V(Smi, store_buffer_top, StoreBufferTop) \ V(Object, undefined_value, UndefinedValue) \ V(Object, the_hole_value, TheHoleValue) \ V(Object, null_value, NullValue) \
@@ -906,8 +906,8 @@
     roots_[kEmptyScriptRootIndex] = script;
   }

-  static void public_set_write_buffer_top(Address* top) {
-    roots_[kWriteBufferTopRootIndex] = reinterpret_cast<Smi*>(top);
+  static void public_set_store_buffer_top(Address* top) {
+    roots_[kStoreBufferTopRootIndex] = reinterpret_cast<Smi*>(top);
   }

   // Update the next script id.
@@ -916,8 +916,8 @@
   // Generated code can embed this address to get access to the roots.
   static Object** roots_address() { return roots_; }

-  static Address* write_buffer_top_address() {
-    return reinterpret_cast<Address*>(&roots_[kWriteBufferTopRootIndex]);
+  static Address* store_buffer_top_address() {
+    return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]);
   }

   // Get address of global contexts list for serialization support.
=======================================
--- /branches/experimental/gc/src/ia32/code-stubs-ia32.cc Wed Jan 5 06:17:18 2011 +++ /branches/experimental/gc/src/ia32/code-stubs-ia32.cc Thu Jan 6 06:05:23 2011
@@ -259,8 +259,8 @@
 }


-void WriteBufferOverflowStub::Generate(MacroAssembler* masm) {
- // We don't allow a GC during a write buffer overflow so there is no need to
+void StoreBufferOverflowStub::Generate(MacroAssembler* masm) {
+ // We don't allow a GC during a store buffer overflow so there is no need to
   // store the registers in any particular way, but we do have to store and
   // restore them.
   __ pushad();
@@ -274,9 +274,9 @@
   }
   const int argument_count = 0;
   __ PrepareCallCFunction(argument_count, ecx);
-  ExternalReference write_buffer_overflow =
- ExternalReference(Runtime::FunctionForId(Runtime::kWriteBufferOverflow));
-  __ CallCFunction(write_buffer_overflow, argument_count);
+  ExternalReference store_buffer_overflow =
+ ExternalReference(Runtime::FunctionForId(Runtime::kStoreBufferOverflow));
+  __ CallCFunction(store_buffer_overflow, argument_count);
   if (save_doubles_ == kSaveFPRegs) {
     CpuFeatures::Scope scope(SSE2);
     for (int i = 0; i < XMMRegister::kNumRegisters; i++) {
=======================================
--- /branches/experimental/gc/src/ia32/code-stubs-ia32.h Wed Jan 5 06:17:18 2011 +++ /branches/experimental/gc/src/ia32/code-stubs-ia32.h Thu Jan 6 06:05:23 2011
@@ -72,9 +72,9 @@
 };


-class WriteBufferOverflowStub: public CodeStub {
+class StoreBufferOverflowStub: public CodeStub {
  public:
-  explicit WriteBufferOverflowStub(SaveFPRegsMode save_fp)
+  explicit StoreBufferOverflowStub(SaveFPRegsMode save_fp)
       : save_doubles_(save_fp) { }

   void Generate(MacroAssembler* masm);
@@ -82,7 +82,7 @@
  private:
   SaveFPRegsMode save_doubles_;

-  Major MajorKey() { return WriteBufferOverflow; }
+  Major MajorKey() { return StoreBufferOverflow; }
   int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; }
 };

=======================================
--- /branches/experimental/gc/src/ia32/macro-assembler-ia32.cc Wed Jan 5 06:17:18 2011 +++ /branches/experimental/gc/src/ia32/macro-assembler-ia32.cc Thu Jan 6 06:05:23 2011
@@ -60,23 +60,23 @@
     bind(&not_in_new_space);
   }

-  // Load write buffer top.
-  ExternalReference write_buffer = ExternalReference::write_buffer_top();
-  mov(scratch, Operand::StaticVariable(write_buffer));
+  // Load store buffer top.
+  ExternalReference store_buffer = ExternalReference::store_buffer_top();
+  mov(scratch, Operand::StaticVariable(store_buffer));
   // Store pointer to buffer.
   mov(Operand(scratch, 0), addr);
   // Increment buffer top.
   add(Operand(scratch), Immediate(kPointerSize));
   // Write back new top of buffer.
-  mov(Operand::StaticVariable(write_buffer), scratch);
+  mov(Operand::StaticVariable(store_buffer), scratch);
   // Call stub on end of buffer.
   NearLabel no_overflow;
   // Check for end of buffer.
-  test(scratch, Immediate(WriteBuffer::kWriteBufferOverflowBit));
+  test(scratch, Immediate(StoreBuffer::kStoreBufferOverflowBit));
   j(equal, &no_overflow);
-  WriteBufferOverflowStub write_buffer_overflow =
-      WriteBufferOverflowStub(save_fp);
-  CallStub(&write_buffer_overflow);
+  StoreBufferOverflowStub store_buffer_overflow =
+      StoreBufferOverflowStub(save_fp);
+  CallStub(&store_buffer_overflow);
   bind(&no_overflow);
 }

=======================================
--- /branches/experimental/gc/src/runtime.cc    Wed Jan  5 06:17:18 2011
+++ /branches/experimental/gc/src/runtime.cc    Thu Jan  6 06:05:23 2011
@@ -5400,8 +5400,8 @@
 }


-static MaybeObject* Runtime_WriteBufferOverflow(Arguments args) {
-  WriteBuffer::Compact();
+static MaybeObject* Runtime_StoreBufferOverflow(Arguments args) {
+  StoreBuffer::Compact();
   return Heap::undefined_value();
 }

=======================================
--- /branches/experimental/gc/src/runtime.h     Wed Jan  5 06:17:18 2011
+++ /branches/experimental/gc/src/runtime.h     Thu Jan  6 06:05:23 2011
@@ -86,7 +86,7 @@
   F(CompileForOnStackReplacement, 1, 1) \
   F(SetNewFunctionAttributes, 1, 1) \
   F(AllocateInNewSpace, 1, 1) \
-  F(WriteBufferOverflow, 0, 1) \
+  F(StoreBufferOverflow, 0, 1) \
   \
   /* Array join support */ \
   F(PushIfAbsent, 2, 1) \
=======================================
--- /branches/experimental/gc/src/serialize.cc  Thu Jan  6 05:18:03 2011
+++ /branches/experimental/gc/src/serialize.cc  Thu Jan  6 06:05:23 2011
@@ -498,10 +498,10 @@
       UNCLASSIFIED,
       39,
       "power_double_int_function");
-  Add(ExternalReference::write_buffer_top().address(),
+  Add(ExternalReference::store_buffer_top().address(),
       UNCLASSIFIED,
       40,
-      "write_buffer_top");
+      "store_buffer_top");
 }


@@ -652,8 +652,8 @@

 void Deserializer::Deserialize() {
   // Don't GC while deserializing - just expand the heap.
-  Address* write_buffer_top =
-      reinterpret_cast<Address*>(Heap::write_buffer_top());
+  Address* store_buffer_top =
+      reinterpret_cast<Address*>(Heap::store_buffer_top());
   AlwaysAllocateScope always_allocate;
   // Don't use the free lists while deserializing.
   LinearAllocationScope allocate_linearly;
@@ -670,7 +670,7 @@
   Heap::IterateWeakRoots(this, VISIT_ALL);

   Heap::set_global_contexts_list(Heap::undefined_value());
-  Heap::public_set_write_buffer_top(write_buffer_top);
+  Heap::public_set_store_buffer_top(store_buffer_top);
 }


=======================================
--- /branches/experimental/gc/src/v8-counters.h Tue Dec 21 04:32:46 2010
+++ /branches/experimental/gc/src/v8-counters.h Thu Jan  6 06:05:23 2011
@@ -108,9 +108,9 @@
   /* Number of code objects found from pc. */                         \
   SC(pc_to_code, V8.PcToCode)                                         \
   SC(pc_to_code_cached, V8.PcToCodeCached)                            \
-  /* The write-buffer implementation of the write barrier. */         \
-  SC(write_buffer_compactions, V8.WriteBufferCompactions)             \
-  SC(write_buffer_overflows, V8.WriteBufferOverflows)
+  /* The store-buffer implementation of the write barrier. */         \
+  SC(store_buffer_compactions, V8.StoreBufferCompactions)             \
+  SC(store_buffer_overflows, V8.StoreBufferOverflows)


 #define STATS_COUNTER_LIST_2(SC)                                      \
=======================================
--- /branches/experimental/gc/src/v8.cc Wed Dec 15 00:27:21 2010
+++ /branches/experimental/gc/src/v8.cc Thu Jan  6 06:05:23 2011
@@ -39,7 +39,7 @@
 #include "serialize.h"
 #include "simulator.h"
 #include "stub-cache.h"
-#include "write-buffer.h"
+#include "store-buffer.h"

 namespace v8 {
 namespace internal {
@@ -94,7 +94,7 @@
     StackGuard::InitThread(lock);
   }

-  WriteBuffer::Setup();
+  StoreBuffer::Setup();

   // Setup the object heap
   ASSERT(!Heap::HasBeenSetup());
@@ -183,7 +183,7 @@
   Logger::TearDown();
   Heap::TearDown();

-  WriteBuffer::TearDown();
+  StoreBuffer::TearDown();

   is_running_ = false;
   has_been_disposed_ = true;
=======================================
--- /branches/experimental/gc/src/x64/code-stubs-x64.cc Thu Jan 6 05:18:03 2011 +++ /branches/experimental/gc/src/x64/code-stubs-x64.cc Thu Jan 6 06:05:23 2011
@@ -255,8 +255,8 @@
 }


-void WriteBufferOverflowStub::Generate(MacroAssembler* masm) {
- // We don't allow a GC during a write buffer overflow so there is no need to
+void StoreBufferOverflowStub::Generate(MacroAssembler* masm) {
+ // We don't allow a GC during a store buffer overflow so there is no need to
   // store the registers in any particular way, but we do have to store and
   // restore them.
   Register saved_regs[] =
@@ -276,9 +276,9 @@
   }
   const int argument_count = 0;
   __ PrepareCallCFunction(argument_count);
-  ExternalReference write_buffer_overflow =
- ExternalReference(Runtime::FunctionForId(Runtime::kWriteBufferOverflow));
-  __ CallCFunction(write_buffer_overflow, argument_count);
+  ExternalReference store_buffer_overflow =
+ ExternalReference(Runtime::FunctionForId(Runtime::kStoreBufferOverflow));
+  __ CallCFunction(store_buffer_overflow, argument_count);
   if (save_doubles_ == kSaveFPRegs) {
     CpuFeatures::Scope scope(SSE2);
     for (int i = 0; i < XMMRegister::kNumRegisters; i++) {
=======================================
--- /branches/experimental/gc/src/x64/code-stubs-x64.h Thu Jan 6 05:18:03 2011 +++ /branches/experimental/gc/src/x64/code-stubs-x64.h Thu Jan 6 06:05:23 2011
@@ -63,9 +63,9 @@
 };


-class WriteBufferOverflowStub: public CodeStub {
+class StoreBufferOverflowStub: public CodeStub {
  public:
-  explicit WriteBufferOverflowStub(SaveFPRegsMode save_fp)
+  explicit StoreBufferOverflowStub(SaveFPRegsMode save_fp)
       : save_doubles_(save_fp) { }

   void Generate(MacroAssembler* masm);
@@ -73,7 +73,7 @@
  private:
   SaveFPRegsMode save_doubles_;

-  Major MajorKey() { return WriteBufferOverflow; }
+  Major MajorKey() { return StoreBufferOverflow; }
   int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; }
 };

=======================================
--- /branches/experimental/gc/src/x64/macro-assembler-x64.cc Thu Jan 6 05:18:03 2011 +++ /branches/experimental/gc/src/x64/macro-assembler-x64.cc Thu Jan 6 06:05:23 2011
@@ -86,22 +86,22 @@
     bind(&not_in_new_space);
   }

-  // Load write buffer top.
-  LoadRoot(scratch, Heap::kWriteBufferTopRootIndex);
+  // Load store buffer top.
+  LoadRoot(scratch, Heap::kStoreBufferTopRootIndex);
   // Store pointer to buffer.
   movq(Operand(scratch, 0), addr);
   // Increment buffer top.
   addq(scratch, Immediate(kPointerSize));
   // Write back new top of buffer.
-  StoreRoot(scratch, Heap::kWriteBufferTopRootIndex);
+  StoreRoot(scratch, Heap::kStoreBufferTopRootIndex);
   // Call stub on end of buffer.
   NearLabel no_overflow;
   // Check for end of buffer.
-  testq(scratch, Immediate(WriteBuffer::kWriteBufferOverflowBit));
+  testq(scratch, Immediate(StoreBuffer::kStoreBufferOverflowBit));
   j(equal, &no_overflow);
-  WriteBufferOverflowStub write_buffer_overflow =
-      WriteBufferOverflowStub(save_fp);
-  CallStub(&write_buffer_overflow);
+  StoreBufferOverflowStub store_buffer_overflow =
+      StoreBufferOverflowStub(save_fp);
+  CallStub(&store_buffer_overflow);
   bind(&no_overflow);
 }

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

Reply via email to