Reviewers: danno, Kevin Millikin,
Description:
Removed a "feature envy" bad smell: Moved AssumeRepresentation method to
where
it belongs.
Please review this at http://codereview.chromium.org/7015039/
SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/
Affected files:
M src/hydrogen-instructions.h
M src/hydrogen-instructions.cc
M src/hydrogen.cc
Index: src/hydrogen-instructions.cc
===================================================================
--- src/hydrogen-instructions.cc (revision 7884)
+++ src/hydrogen-instructions.cc (working copy)
@@ -67,6 +67,16 @@
}
+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) {
if (result > kMaxInt) {
*overflow = true;
Index: src/hydrogen-instructions.h
===================================================================
--- src/hydrogen-instructions.h (revision 7884)
+++ src/hydrogen-instructions.h (working copy)
@@ -557,6 +557,7 @@
RepresentationChanged(r);
representation_ = r;
}
+ void AssumeRepresentation(Representation r);
virtual bool IsConvertibleToInteger() const { return true; }
Index: src/hydrogen.cc
===================================================================
--- src/hydrogen.cc (revision 7884)
+++ src/hydrogen.cc (working copy)
@@ -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;
}
@@ -5073,16 +5073,6 @@
}
-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) {
if (info.IsSmi()) return Representation::Integer32();
if (info.IsInteger32()) return Representation::Integer32();
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev