Reviewers: jarin,

Message:
Committed patchset #1 manually as r20889 (presubmit successful).

Description:
Insert HSimulate immediately after Crankshaft-inlined push.

[email protected]
LOG=N

Committed: https://code.google.com/p/v8/source/detail?r=20889

Please review this at https://codereview.chromium.org/247383002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+10, -5 lines):
  M src/hydrogen.cc
  A + test/mjsunit/array-push9.js


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index d2624161bcff57d7bbdcd94d46d7b132af303592..7ac1d5e26550406c9e02537f86e6e682793ee322 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -7786,23 +7786,28 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
       HValue* value_to_push = Pop();
       HValue* array = Pop();

- HValue* length = Add<HLoadNamedField>(array, static_cast<HValue*>(NULL),
-          HObjectAccess::ForArrayLength(elements_kind));
+      HInstruction* new_size = NULL;
+      HValue* length = NULL;

       {
         NoObservableSideEffectsScope scope(this);

+        length = Add<HLoadNamedField>(array, static_cast<HValue*>(NULL),
+          HObjectAccess::ForArrayLength(elements_kind));
+
+        new_size = AddUncasted<HAdd>(length, graph()->GetConstant1());
+
         bool is_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
         BuildUncheckedMonomorphicElementAccess(array, length,
                                                value_to_push, is_array,
                                                elements_kind, STORE,
                                                NEVER_RETURN_HOLE,
STORE_AND_GROW_NO_TRANSITION);
+        Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE);
       }

- HInstruction* new_size = NewUncasted<HAdd>(length, Add<HConstant>(argc));
       Drop(1);  // Drop function.
-      ast_context()->ReturnInstruction(new_size, expr->id());
+      ast_context()->ReturnValue(new_size);
       return true;
     }
     default:
Index: test/mjsunit/array-push9.js
diff --git a/test/mjsunit/array-push3.js b/test/mjsunit/array-push9.js
similarity index 87%
copy from test/mjsunit/array-push3.js
copy to test/mjsunit/array-push9.js
index 99bd857a7386f260d31f86ebd2f5d3bede325eea..d80cee89eaf17f4ed0130ab7ee12c568efc27fe7 100644
--- a/test/mjsunit/array-push3.js
+++ b/test/mjsunit/array-push9.js
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

-// Flags: --allow-natives-syntax
+// Flags: --allow-natives-syntax --deopt-every-n-times=5 --nodead-code-elimination

 var array = [];



--
--
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