Make HForceRepresentation an idef.
authormvstanton@chromium.org <mvstanton@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 13 Nov 2013 17:03:11 +0000 (17:03 +0000)
committermvstanton@chromium.org <mvstanton@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 13 Nov 2013 17:03:11 +0000 (17:03 +0000)
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.

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/59623009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17708 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/hydrogen-instructions.h
src/hydrogen.cc

index dd7781b..9bd0b90 100644 (file)
@@ -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 7c42a3b..33586f3 100644 (file)
@@ -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 &&