Revision: 15633
Author:   [email protected]
Date:     Thu Jul 11 07:21:14 2013
Log:      Support grow-stub by >1 if the target is holey.

[email protected]

Review URL: https://chromiumcodereview.appspot.com/18484006
http://code.google.com/p/v8/source/detail?r=15633

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

=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Thu Jul 11 07:17:56 2013
+++ /branches/bleeding_edge/src/hydrogen.cc     Thu Jul 11 07:21:14 2013
@@ -1146,21 +1146,22 @@
   Zone* zone = this->zone();
   IfBuilder length_checker(this);

-  length_checker.If<HCompareNumericAndBranch>(length, key, Token::EQ);
+  Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ;
+  length_checker.If<HCompareNumericAndBranch>(key, length, token);
+
   length_checker.Then();

   HValue* current_capacity = AddLoadFixedArrayLength(elements);

   IfBuilder capacity_checker(this);

-  capacity_checker.If<HCompareNumericAndBranch>(length, current_capacity,
-                                                Token::EQ);
+  capacity_checker.If<HCompareNumericAndBranch>(key, current_capacity,
+                                                Token::GTE);
   capacity_checker.Then();

   HValue* context = environment()->LookupContext();

-  HValue* new_capacity =
-      BuildNewElementsCapacity(context, current_capacity);
+  HValue* new_capacity = BuildNewElementsCapacity(context, key);

   HValue* new_elements = BuildGrowElementsCapacity(object, elements,
                                                    kind, kind, length,
@@ -1174,7 +1175,7 @@

   if (is_js_array) {
     HValue* new_length = AddInstruction(
-        HAdd::New(zone, context, length, graph_->GetConstant1()));
+        HAdd::New(zone, context, key, graph_->GetConstant1()));
     new_length->ClearFlag(HValue::kCanOverflow);

     Representation representation = IsFastElementsKind(kind)
@@ -1184,10 +1185,9 @@
   }

   length_checker.Else();
+  Add<HBoundsCheck>(key, length);

-  Add<HBoundsCheck>(key, length);
   environment()->Push(elements);
-
   length_checker.End();

   return environment()->Pop();

--
--
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/groups/opt_out.


Reply via email to