Upgrade V8 to version 4.9.385.28

https://chromium.googlesource.com/v8/v8/+/4.9.385.28

FPIIM-449

Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/src/hashmap.h b/src/hashmap.h
index 33eb115..f94def7 100644
--- a/src/hashmap.h
+++ b/src/hashmap.h
@@ -41,13 +41,15 @@
     int order;  // If you never remove entries this is the insertion order.
   };
 
-  // If an entry with matching key is found, Lookup()
-  // returns that entry. If no matching entry is found,
-  // but insert is set, a new entry is inserted with
-  // corresponding key, key hash, and NULL value.
+  // If an entry with matching key is found, returns that entry.
   // Otherwise, NULL is returned.
-  Entry* Lookup(void* key, uint32_t hash, bool insert,
-                AllocationPolicy allocator = AllocationPolicy());
+  Entry* Lookup(void* key, uint32_t hash) const;
+
+  // If an entry with matching key is found, returns that entry.
+  // If no matching entry is found, a new entry is inserted with
+  // corresponding key, key hash, and NULL value.
+  Entry* LookupOrInsert(void* key, uint32_t hash,
+                        AllocationPolicy allocator = AllocationPolicy());
 
   // Removes the entry with matching key.
   // It returns the value of the deleted entry
@@ -88,7 +90,7 @@
   uint32_t occupancy_;
 
   Entry* map_end() const { return map_ + capacity_; }
-  Entry* Probe(void* key, uint32_t hash);
+  Entry* Probe(void* key, uint32_t hash) const;
   void Initialize(uint32_t capacity, AllocationPolicy allocator);
   void Resize(AllocationPolicy allocator);
 };
@@ -109,35 +111,38 @@
 }
 
 
-template<class AllocationPolicy>
+template <class AllocationPolicy>
 typename TemplateHashMapImpl<AllocationPolicy>::Entry*
-TemplateHashMapImpl<AllocationPolicy>::Lookup(
-    void* key, uint32_t hash, bool insert, AllocationPolicy allocator) {
+TemplateHashMapImpl<AllocationPolicy>::Lookup(void* key, uint32_t hash) const {
+  Entry* p = Probe(key, hash);
+  return p->key != NULL ? p : NULL;
+}
+
+
+template <class AllocationPolicy>
+typename TemplateHashMapImpl<AllocationPolicy>::Entry*
+TemplateHashMapImpl<AllocationPolicy>::LookupOrInsert(
+    void* key, uint32_t hash, AllocationPolicy allocator) {
   // Find a matching entry.
   Entry* p = Probe(key, hash);
   if (p->key != NULL) {
     return p;
   }
 
-  // No entry found; insert one if necessary.
-  if (insert) {
-    p->key = key;
-    p->value = NULL;
-    p->hash = hash;
-    p->order = occupancy_;
-    occupancy_++;
+  // No entry found; insert one.
+  p->key = key;
+  p->value = NULL;
+  p->hash = hash;
+  p->order = occupancy_;
+  occupancy_++;
 
-    // Grow the map if we reached >= 80% occupancy.
-    if (occupancy_ + occupancy_/4 >= capacity_) {
-      Resize(allocator);
-      p = Probe(key, hash);
-    }
-
-    return p;
+  // Grow the map if we reached >= 80% occupancy.
+  if (occupancy_ + occupancy_ / 4 >= capacity_) {
+    Resize(allocator);
+    p = Probe(key, hash);
   }
 
-  // No entry found and none inserted.
-  return NULL;
+  return p;
 }
 
 
@@ -235,9 +240,9 @@
 }
 
 
-template<class AllocationPolicy>
+template <class AllocationPolicy>
 typename TemplateHashMapImpl<AllocationPolicy>::Entry*
-    TemplateHashMapImpl<AllocationPolicy>::Probe(void* key, uint32_t hash) {
+TemplateHashMapImpl<AllocationPolicy>::Probe(void* key, uint32_t hash) const {
   DCHECK(key != NULL);
 
   DCHECK(base::bits::IsPowerOfTwo32(capacity_));
@@ -282,7 +287,7 @@
   // Rehash all current entries.
   for (Entry* p = map; n > 0; p++) {
     if (p->key != NULL) {
-      Entry* entry = Lookup(p->key, p->hash, true, allocator);
+      Entry* entry = LookupOrInsert(p->key, p->hash, allocator);
       entry->value = p->value;
       entry->order = p->order;
       n--;
@@ -338,10 +343,14 @@
   Iterator end() const { return Iterator(this, NULL); }
   Iterator find(Key* key, bool insert = false,
                 AllocationPolicy allocator = AllocationPolicy()) {
-    return Iterator(this, this->Lookup(key, key->Hash(), insert, allocator));
+    if (insert) {
+      return Iterator(this, this->LookupOrInsert(key, key->Hash(), allocator));
+    }
+    return Iterator(this, this->Lookup(key, key->Hash()));
   }
 };
 
-} }  // namespace v8::internal
+}  // namespace internal
+}  // namespace v8
 
 #endif  // V8_HASHMAP_H_