Revision: 15244
Author:   [email protected]
Date:     Thu Jun 20 06:22:46 2013
Log:      Flexible representation for BuildIncrement, but CannotBeTagged.

[email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Thu Jun 20 03:48:14 2013 +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Thu Jun 20 06:22:46 2013
@@ -128,6 +128,7 @@
                                   const char* reason) {
   Representation r = representation();
   if (new_rep.is_more_general_than(r)) {
+    if (CheckFlag(kCannotBeTagged) && r.IsTagged()) return;
     if (FLAG_trace_representation) {
       PrintF("Changing #%d %s representation %s -> %s based on %s\n",
              id(), Mnemonic(), r.Mnemonic(), new_rep.Mnemonic(), reason);
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Thu Jun 20 03:48:14 2013 +++ /branches/bleeding_edge/src/hydrogen-instructions.h Thu Jun 20 06:22:46 2013
@@ -784,6 +784,7 @@

   enum Flag {
     kFlexibleRepresentation,
+    kCannotBeTagged,
     // Participate in Global Value Numbering, i.e. elimination of
// unnecessary recomputations. If an instruction sets this flag, it must
     // implement DataEquals(), which will be used to determine if other
@@ -891,7 +892,8 @@
     ASSERT(CheckFlag(kFlexibleRepresentation));
     RepresentationChanged(r);
     representation_ = r;
-    if (r.IsTagged()) {
+    if (r.IsTagged() ||
+        (r.IsDouble() && CheckFlag(kCannotBeTagged))) {
       // Tagged is the bottom of the lattice, don't go any further.
       ClearFlag(kFlexibleRepresentation);
     }
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Thu Jun 20 06:09:43 2013
+++ /branches/bleeding_edge/src/hydrogen.cc     Thu Jun 20 06:22:46 2013
@@ -2953,7 +2953,11 @@
          current != NULL; current = current->next()) {
       if (current->representation().IsNone() &&
           current->CheckFlag(HInstruction::kFlexibleRepresentation)) {
-        current->ChangeRepresentation(Representation::Tagged());
+        if (current->CheckFlag(HInstruction::kCannotBeTagged)) {
+          current->ChangeRepresentation(Representation::Double());
+        } else {
+          current->ChangeRepresentation(Representation::Tagged());
+        }
       }
     }
   }
@@ -9106,8 +9110,8 @@
   // The input to the count operation is on top of the expression stack.
   TypeInfo info = expr->type();
   Representation rep = ToRepresentation(info);
-  if (rep.IsTagged()) {
-    rep = Representation::Integer32();
+  if (rep.IsNone() || rep.IsTagged()) {
+    rep = Representation::Smi();
   }

   if (returns_original_input) {
@@ -9116,6 +9120,10 @@
     // phase, so it is not available now to be used as an input to HAdd and
     // as the return value.
HInstruction* number_input = new(zone()) HForceRepresentation(Pop(), rep);
+    if (!rep.IsDouble()) {
+      number_input->SetFlag(HInstruction::kFlexibleRepresentation);
+      number_input->SetFlag(HInstruction::kCannotBeTagged);
+    }
     AddInstruction(number_input);
     Push(number_input);
   }
@@ -9128,10 +9136,7 @@
       : graph()->GetConstantMinus1();
   HValue* context = environment()->LookupContext();
   HInstruction* instr = HAdd::New(zone(), context, Top(), delta);
- // We can't insert a simulate here, because it would break deoptimization,
-  // so the HAdd must not have side effects, so we must freeze its
-  // representation.
-  instr->AssumeRepresentation(rep);
+  instr->SetFlag(HInstruction::kCannotBeTagged);
   instr->ClearAllSideEffects();
   AddInstruction(instr);
   return instr;

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