Reviewers: Toon Verwaest,

Message:
Hi Toon, PTAL, thx!
--Michael

Description:
Make HForceRepresentation an idef.

An optimization in the array constructor wasn't firing because the code
would check for constant values, failing to find them through
intervening HForceRepresentation instructions. Repaired this site. A
follow-on CL will provide a better way of making decisions based on
constant HValues.

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

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

Affected files (+6, -3 lines):
  M src/hydrogen-instructions.h
  M src/hydrogen.cc


Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index dd7781bca0a657932fe327def7e586aae10a3cbd..9bd0b90b4c3b55b0b958cfeb0ee4b59e7dd52a42 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -1579,6 +1579,9 @@ class HForceRepresentation V8_FINAL : public HTemplateInstruction<1> {

   DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation)

+ protected:
+  virtual int RedefinedOperandIndex() { return 0; }
+
  private:
HForceRepresentation(HValue* value, Representation required_representation) {
     SetOperandAt(0, value);
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 7c42a3bcd63c0eb952d133a2c4e64863e5be2056..33586f347ef85a5911c5315a963c23e3f2c55188 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -2100,10 +2100,10 @@ void HGraphBuilder::BuildFillElementsWithHole(HValue* elements,
   static const int kLoopUnfoldLimit = 4;
   bool unfold_loop = false;
   int initial_capacity = JSArray::kPreallocatedArrayElements;
-  if (from->IsConstant() && to->IsConstant() &&
+ if (from->ActualValue()->IsConstant() && to->ActualValue()->IsConstant() &&
       initial_capacity <= kLoopUnfoldLimit) {
-    HConstant* constant_from = HConstant::cast(from);
-    HConstant* constant_to = HConstant::cast(to);
+    HConstant* constant_from = HConstant::cast(from->ActualValue());
+    HConstant* constant_to = HConstant::cast(to->ActualValue());

     if (constant_from->HasInteger32Value() &&
         constant_from->Integer32Value() == 0 &&


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