Reviewers: Hannes Payer,
Message:
PTAL
Description:
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.
Please review this at https://codereview.chromium.org/275453004/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+3, -14 lines):
M src/hydrogen.h
M src/hydrogen.cc
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
d7394ff3b89b4e0d675899d24343d087a5d86114..60730ab6c17bb399ea9e52b3838768b51bdcabe9
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -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);
Index: src/hydrogen.h
diff --git a/src/hydrogen.h b/src/hydrogen.h
index
d20a81771ed0cb31677f0f2cded6fd3508d4dbc1..060ccb9b364ba880704fabdcc6fc2c4ba1fced87
100644
--- a/src/hydrogen.h
+++ b/src/hydrogen.h
@@ -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,
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.