Revision: 21218
Author:   [email protected]
Date:     Fri May  9 12:19:59 2014 UTC
Log:      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.

[email protected]

Review URL: https://codereview.chromium.org/275453004
http://code.google.com/p/v8/source/detail?r=21218

Modified:
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/hydrogen.h

=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Fri May  9 08:28:25 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc     Fri May  9 12:19:59 2014 UTC
@@ -2414,16 +2414,6 @@

   return new_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,
@@ -2432,7 +2422,9 @@
                                                  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);
=======================================
--- /branches/bleeding_edge/src/hydrogen.h      Wed May  7 08:41:35 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.h      Fri May  9 12:19:59 2014 UTC
@@ -1665,9 +1665,6 @@

   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.

Reply via email to