Upgrade V8 to 5.1.281.57  DO NOT MERGE

FPIIM-449

Change-Id: Id981b686b4d587ac31697662eb98bb34be42ad90
(cherry picked from commit 3b9bc31999c9787eb726ecdbfd5796bfdec32a18)
diff --git a/src/heap/store-buffer.cc b/src/heap/store-buffer.cc
index 21f375b..a982eb3 100644
--- a/src/heap/store-buffer.cc
+++ b/src/heap/store-buffer.cc
@@ -8,7 +8,6 @@
 
 #include "src/counters.h"
 #include "src/heap/incremental-marking.h"
-#include "src/heap/store-buffer-inl.h"
 #include "src/isolate.h"
 #include "src/objects-inl.h"
 #include "src/v8.h"
@@ -17,17 +16,20 @@
 namespace internal {
 
 StoreBuffer::StoreBuffer(Heap* heap)
-    : heap_(heap), start_(nullptr), limit_(nullptr), virtual_memory_(nullptr) {}
+    : heap_(heap),
+      top_(nullptr),
+      start_(nullptr),
+      limit_(nullptr),
+      virtual_memory_(nullptr) {}
 
 void StoreBuffer::SetUp() {
   // Allocate 3x the buffer size, so that we can start the new store buffer
   // aligned to 2x the size.  This lets us use a bit test to detect the end of
   // the area.
-  virtual_memory_ = new base::VirtualMemory(kStoreBufferSize * 3);
+  virtual_memory_ = new base::VirtualMemory(kStoreBufferSize * 2);
   uintptr_t start_as_int =
       reinterpret_cast<uintptr_t>(virtual_memory_->address());
-  start_ =
-      reinterpret_cast<Address*>(RoundUp(start_as_int, kStoreBufferSize * 2));
+  start_ = reinterpret_cast<Address*>(RoundUp(start_as_int, kStoreBufferSize));
   limit_ = start_ + (kStoreBufferSize / kPointerSize);
 
   DCHECK(reinterpret_cast<Address>(start_) >= virtual_memory_->address());
@@ -38,23 +40,20 @@
   DCHECK(start_ <= vm_limit);
   DCHECK(limit_ <= vm_limit);
   USE(vm_limit);
-  DCHECK((reinterpret_cast<uintptr_t>(limit_) & kStoreBufferOverflowBit) != 0);
-  DCHECK((reinterpret_cast<uintptr_t>(limit_ - 1) & kStoreBufferOverflowBit) ==
-         0);
+  DCHECK((reinterpret_cast<uintptr_t>(limit_) & kStoreBufferMask) == 0);
 
   if (!virtual_memory_->Commit(reinterpret_cast<Address>(start_),
                                kStoreBufferSize,
                                false)) {  // Not executable.
     V8::FatalProcessOutOfMemory("StoreBuffer::SetUp");
   }
-  heap_->set_store_buffer_top(reinterpret_cast<Smi*>(start_));
+  top_ = start_;
 }
 
 
 void StoreBuffer::TearDown() {
   delete virtual_memory_;
-  start_ = limit_ = NULL;
-  heap_->set_store_buffer_top(reinterpret_cast<Smi*>(start_));
+  top_ = start_ = limit_ = nullptr;
 }
 
 
@@ -64,16 +63,15 @@
 }
 
 void StoreBuffer::MoveEntriesToRememberedSet() {
-  Address* top = reinterpret_cast<Address*>(heap_->store_buffer_top());
-  if (top == start_) return;
-  DCHECK(top <= limit_);
-  heap_->set_store_buffer_top(reinterpret_cast<Smi*>(start_));
-  for (Address* current = start_; current < top; current++) {
+  if (top_ == start_) return;
+  DCHECK(top_ <= limit_);
+  for (Address* current = start_; current < top_; current++) {
     DCHECK(!heap_->code_space()->Contains(*current));
     Address addr = *current;
     Page* page = Page::FromAnyPointerAddress(heap_, addr);
     RememberedSet<OLD_TO_NEW>::Insert(page, addr);
   }
+  top_ = start_;
 }
 
 }  // namespace internal