 Chromium Code Reviews
 Chromium Code Reviews Issue 2244983004:
  [elements, turbofan] Implement simple GrowElements  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 2244983004:
  [elements, turbofan] Implement simple GrowElements  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| Index: src/elements.cc | 
| diff --git a/src/elements.cc b/src/elements.cc | 
| index 29fa4fb08c8bdaef6bda5d26794b4deab44a962c..c945f8e68545f3fe4b6e75adc173b7260f98e84c 100644 | 
| --- a/src/elements.cc | 
| +++ b/src/elements.cc | 
| @@ -891,6 +891,27 @@ class ElementsAccessorBase : public ElementsAccessor { | 
| Subclass::GrowCapacityAndConvertImpl(object, capacity); | 
| } | 
| + bool GrowCapacity(Handle<JSObject> object, uint32_t capacity) final { | 
| + if (object->map()->is_prototype_map() || | 
| 
Jakob Kummerow
2016/08/16 15:15:01
To explain why this code does what it's doing, ple
 | 
| + object->WouldConvertToSlowElements(capacity)) { | 
| + return false; | 
| + } | 
| + Handle<FixedArrayBase> old_elements(object->elements()); | 
| + DCHECK(static_cast<uint32_t>(old_elements->length()) < capacity); | 
| + Handle<FixedArrayBase> elements = | 
| + ConvertElementsWithCapacity(object, old_elements, kind(), capacity); | 
| + | 
| + DCHECK_EQ(object->GetElementsKind(), kind()); | 
| + // Transition through the allocation site as well if present. | 
| + if (JSObject::UpdateAllocationSite<AllocationSiteUpdateMode::kCheckOnly>( | 
| + object, kind())) { | 
| + return false; | 
| + } | 
| + | 
| + object->set_elements(*elements); | 
| + return true; | 
| + } | 
| + | 
| void Delete(Handle<JSObject> obj, uint32_t entry) final { | 
| Subclass::DeleteImpl(obj, entry); | 
| } |