Commit 3e08756f authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Fix new space array check limit.

Also inline BuildNewSpaceArrayCheck() into its caller, because
the name BuildNewSpaceArrayCheck was confusing anyway, since
it has nothing do with new space actually.

R=hpayer@chromium.org

Review URL: https://codereview.chromium.org/275453004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21218 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6b1f7426
......@@ -2416,23 +2416,15 @@ HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* old_capacity) {
}
void HGraphBuilder::BuildNewSpaceArrayCheck(HValue* length, ElementsKind kind) {
int element_size = IsFastDoubleElementsKind(kind) ? kDoubleSize
: kPointerSize;
int max_size = Page::kMaxRegularHeapObjectSize / element_size;
max_size -= JSArray::kSize / element_size;
HConstant* max_size_constant = Add<HConstant>(max_size);
Add<HBoundsCheck>(length, max_size_constant);
}
HValue* HGraphBuilder::BuildGrowElementsCapacity(HValue* object,
HValue* elements,
ElementsKind kind,
ElementsKind new_kind,
HValue* length,
HValue* new_capacity) {
BuildNewSpaceArrayCheck(new_capacity, new_kind);
Add<HBoundsCheck>(new_capacity, Add<HConstant>(
(Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) >>
ElementsKindToShiftSize(kind)));
HValue* new_elements = BuildAllocateElementsAndInitializeElementsHeader(
new_kind, new_capacity);
......
......@@ -1665,9 +1665,6 @@ class HGraphBuilder {
HValue* BuildNewElementsCapacity(HValue* old_capacity);
void BuildNewSpaceArrayCheck(HValue* length,
ElementsKind kind);
class JSArrayBuilder V8_FINAL {
public:
JSArrayBuilder(HGraphBuilder* builder,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment