Revision: 7890
Author:   [email protected]
Date:     Fri May 13 06:29:02 2011
Log: Removed a "feature envy" bad smell: Moved AssumeRepresentation method to where
it belongs.
Review URL: http://codereview.chromium.org/7015039
http://code.google.com/p/v8/source/detail?r=7890

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 Wed May 11 02:19:28 2011 +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Fri May 13 06:29:02 2011
@@ -65,6 +65,16 @@
       return NULL;
   }
 }
+
+
+void HValue::AssumeRepresentation(Representation r) {
+  if (CheckFlag(kFlexibleRepresentation)) {
+    ChangeRepresentation(r);
+    // The representation of the value is dictated by type feedback and
+    // will not be changed later.
+    ClearFlag(kFlexibleRepresentation);
+  }
+}


 static int32_t ConvertAndSetOverflow(int64_t result, bool* overflow) {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Thu May 12 07:56:56 2011 +++ /branches/bleeding_edge/src/hydrogen-instructions.h Fri May 13 06:29:02 2011
@@ -557,6 +557,7 @@
     RepresentationChanged(r);
     representation_ = r;
   }
+  void AssumeRepresentation(Representation r);

   virtual bool IsConvertibleToInteger() const { return true; }

=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Fri May 13 01:21:35 2011
+++ /branches/bleeding_edge/src/hydrogen.cc     Fri May 13 06:29:02 2011
@@ -4636,7 +4636,7 @@
   TypeInfo info = oracle()->UnaryType(expr);
   Representation rep = ToRepresentation(info);
   TraceRepresentation(expr->op(), info, instr, rep);
-  AssumeRepresentation(instr, rep);
+  instr->AssumeRepresentation(rep);
   ast_context()->ReturnInstruction(instr, expr->id());
 }

@@ -4707,7 +4707,7 @@
     rep = Representation::Integer32();
   }
   TraceRepresentation(expr->op(), info, instr, rep);
-  AssumeRepresentation(instr, rep);
+  instr->AssumeRepresentation(rep);
   return instr;
 }

@@ -4885,7 +4885,7 @@
     rep = Representation::Integer32();
   }
   TraceRepresentation(expr->op(), info, instr, rep);
-  AssumeRepresentation(instr, rep);
+  instr->AssumeRepresentation(rep);
   return instr;
 }

@@ -5071,16 +5071,6 @@
          value->representation().Mnemonic(),
          rep.Mnemonic());
 }
-
-
-void HGraphBuilder::AssumeRepresentation(HValue* value, Representation rep) {
-  if (value->CheckFlag(HValue::kFlexibleRepresentation)) {
-    value->ChangeRepresentation(rep);
-    // The representation of the value is dictated by type feedback and
-    // will not be changed later.
-    value->ClearFlag(HValue::kFlexibleRepresentation);
-  }
-}


 Representation HGraphBuilder::ToRepresentation(TypeInfo info) {

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to