Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: src/hydrogen.cc

Issue 1393833002: [heap] Reland prepare code for smaller large object allocation limit than max allocatable memory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/spaces-inl.h ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/allocation-site-scopes.h" 9 #include "src/allocation-site-scopes.h"
10 #include "src/ast-numbering.h" 10 #include "src/ast-numbering.h"
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 done); 1845 done);
1846 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); 1846 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
1847 return result; 1847 return result;
1848 } 1848 }
1849 1849
1850 1850
1851 HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length, 1851 HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length,
1852 HValue* index, 1852 HValue* index,
1853 HValue* input) { 1853 HValue* input) {
1854 NoObservableSideEffectsScope scope(this); 1854 NoObservableSideEffectsScope scope(this);
1855 HConstant* max_length = Add<HConstant>(JSObject::kInitialMaxFastElementArray); 1855 HConstant* max_length = Add<HConstant>(JSArray::kInitialMaxFastElementArray);
1856 Add<HBoundsCheck>(length, max_length); 1856 Add<HBoundsCheck>(length, max_length);
1857 1857
1858 // Generate size calculation code here in order to make it dominate 1858 // Generate size calculation code here in order to make it dominate
1859 // the JSRegExpResult allocation. 1859 // the JSRegExpResult allocation.
1860 ElementsKind elements_kind = FAST_ELEMENTS; 1860 ElementsKind elements_kind = FAST_ELEMENTS;
1861 HValue* size = BuildCalculateElementsSize(elements_kind, length); 1861 HValue* size = BuildCalculateElementsSize(elements_kind, length);
1862 1862
1863 // Allocate the JSRegExpResult and the FixedArray in one step. 1863 // Allocate the JSRegExpResult and the FixedArray in one step.
1864 HValue* result = Add<HAllocate>( 1864 HValue* result = Add<HAllocate>(
1865 Add<HConstant>(JSRegExpResult::kSize), HType::JSArray(), 1865 Add<HConstant>(JSRegExpResult::kSize), HType::JSArray(),
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
2651 return array_builder->AllocateEmptyArray(); 2651 return array_builder->AllocateEmptyArray();
2652 } else { 2652 } else {
2653 return array_builder->AllocateArray(length_argument, 2653 return array_builder->AllocateArray(length_argument,
2654 array_length, 2654 array_length,
2655 length_argument); 2655 length_argument);
2656 } 2656 }
2657 } 2657 }
2658 2658
2659 HValue* constant_zero = graph()->GetConstant0(); 2659 HValue* constant_zero = graph()->GetConstant0();
2660 HConstant* max_alloc_length = 2660 HConstant* max_alloc_length =
2661 Add<HConstant>(JSObject::kInitialMaxFastElementArray); 2661 Add<HConstant>(JSArray::kInitialMaxFastElementArray);
2662 HInstruction* checked_length = Add<HBoundsCheck>(length_argument, 2662 HInstruction* checked_length = Add<HBoundsCheck>(length_argument,
2663 max_alloc_length); 2663 max_alloc_length);
2664 IfBuilder if_builder(this); 2664 IfBuilder if_builder(this);
2665 if_builder.If<HCompareNumericAndBranch>(checked_length, constant_zero, 2665 if_builder.If<HCompareNumericAndBranch>(checked_length, constant_zero,
2666 Token::EQ); 2666 Token::EQ);
2667 if_builder.Then(); 2667 if_builder.Then();
2668 const int initial_capacity = JSArray::kPreallocatedArrayElements; 2668 const int initial_capacity = JSArray::kPreallocatedArrayElements;
2669 HConstant* initial_capacity_node = Add<HConstant>(initial_capacity); 2669 HConstant* initial_capacity_node = Add<HConstant>(initial_capacity);
2670 Push(initial_capacity_node); // capacity 2670 Push(initial_capacity_node); // capacity
2671 Push(constant_zero); // length 2671 Push(constant_zero); // length
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
3121 // redundant initialization of elements and length fields and at the same 3121 // redundant initialization of elements and length fields and at the same
3122 // time the object will be fully prepared for GC if it happens during 3122 // time the object will be fully prepared for GC if it happens during
3123 // elements allocation. 3123 // elements allocation.
3124 HValue* result = BuildCloneShallowArrayEmpty( 3124 HValue* result = BuildCloneShallowArrayEmpty(
3125 boilerplate, allocation_site, mode); 3125 boilerplate, allocation_site, mode);
3126 3126
3127 HAllocate* elements = BuildAllocateElements(kind, elements_size); 3127 HAllocate* elements = BuildAllocateElements(kind, elements_size);
3128 3128
3129 // This function implicitly relies on the fact that the 3129 // This function implicitly relies on the fact that the
3130 // FastCloneShallowArrayStub is called only for literals shorter than 3130 // FastCloneShallowArrayStub is called only for literals shorter than
3131 // JSObject::kInitialMaxFastElementArray. 3131 // JSArray::kInitialMaxFastElementArray.
3132 // Can't add HBoundsCheck here because otherwise the stub will eager a frame. 3132 // Can't add HBoundsCheck here because otherwise the stub will eager a frame.
3133 HConstant* size_upper_bound = EstablishElementsAllocationSize( 3133 HConstant* size_upper_bound = EstablishElementsAllocationSize(
3134 kind, JSObject::kInitialMaxFastElementArray); 3134 kind, JSArray::kInitialMaxFastElementArray);
3135 elements->set_size_upper_bound(size_upper_bound); 3135 elements->set_size_upper_bound(size_upper_bound);
3136 3136
3137 Add<HStoreNamedField>(result, HObjectAccess::ForElementsPointer(), elements); 3137 Add<HStoreNamedField>(result, HObjectAccess::ForElementsPointer(), elements);
3138 3138
3139 // The allocation for the cloned array above causes register pressure on 3139 // The allocation for the cloned array above causes register pressure on
3140 // machines with low register counts. Force a reload of the boilerplate 3140 // machines with low register counts. Force a reload of the boilerplate
3141 // elements here to free up a register for the allocation to avoid unnecessary 3141 // elements here to free up a register for the allocation to avoid unnecessary
3142 // spillage. 3142 // spillage.
3143 boilerplate_elements = AddLoadElements(boilerplate); 3143 boilerplate_elements = AddLoadElements(boilerplate);
3144 boilerplate_elements->SetFlag(HValue::kCantBeReplaced); 3144 boilerplate_elements->SetFlag(HValue::kCantBeReplaced);
(...skipping 10517 matching lines...) Expand 10 before | Expand all | Expand 10 after
13662 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13662 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13663 } 13663 }
13664 13664
13665 #ifdef DEBUG 13665 #ifdef DEBUG
13666 graph_->Verify(false); // No full verify. 13666 graph_->Verify(false); // No full verify.
13667 #endif 13667 #endif
13668 } 13668 }
13669 13669
13670 } // namespace internal 13670 } // namespace internal
13671 } // namespace v8 13671 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces-inl.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698