Reviewers: danno, Kevin Millikin,
Description:
Made the output of the --trace-representation flag a bit more informative
and
centralized its handling.
Please review this at http://codereview.chromium.org/6969034/
SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/
Affected files:
M src/hydrogen.h
M src/hydrogen.cc
Index: src/hydrogen.cc
===================================================================
--- src/hydrogen.cc (revision 7870)
+++ src/hydrogen.cc (working copy)
@@ -4694,11 +4694,12 @@
? graph_->GetConstant1()
: graph_->GetConstantMinus1();
HInstruction* instr = new(zone()) HAdd(value, delta);
- Representation rep = ToRepresentation(oracle()->IncrementType(expr));
+ TypeInfo info = oracle()->IncrementType(expr);
+ Representation rep = ToRepresentation(info);
if (rep.IsTagged()) {
rep = Representation::Integer32();
}
- AssumeRepresentation(instr, rep);
+ AssumeRepresentation(expr->op(), info, instr, rep);
return instr;
}
@@ -4870,15 +4871,12 @@
(right->IsConstant() && HConstant::cast(right)->HasStringValue())))
{
return instr;
}
- if (FLAG_trace_representation) {
- PrintF("Info: %s/%s\n", info.ToString(),
ToRepresentation(info).Mnemonic());
- }
Representation rep = ToRepresentation(info);
// We only generate either int32 or generic tagged bitwise operations.
if (instr->IsBitwiseBinaryOperation() && rep.IsDouble()) {
rep = Representation::Integer32();
}
- AssumeRepresentation(instr, rep);
+ AssumeRepresentation(expr->op(), info, instr, rep);
return instr;
}
@@ -5046,21 +5044,28 @@
}
-void HGraphBuilder::AssumeRepresentation(HValue* value, Representation r) {
- if (value->CheckFlag(HValue::kFlexibleRepresentation)) {
- if (FLAG_trace_representation) {
- PrintF("Assume representation for %s to be %s (%d)\n",
- value->Mnemonic(),
- r.Mnemonic(),
- graph_->GetMaximumValueID());
- }
- value->ChangeRepresentation(r);
- // The representation of the value is dictated by type feedback and
- // will not be changed later.
- value->ClearFlag(HValue::kFlexibleRepresentation);
- } else if (FLAG_trace_representation) {
- PrintF("No representation assumed\n");
+void HGraphBuilder::AssumeRepresentation(Token::Value op,
+ TypeInfo info,
+ HValue* value,
+ Representation rep) {
+ if (!value->CheckFlag(HValue::kFlexibleRepresentation)) {
+ if (FLAG_trace_representation) PrintF("No representation assumed\n");
+ return;
}
+ if (FLAG_trace_representation) {
+ PrintF("Operation %s has type info %s, change representation
assumption "
+ "for %s (ID %d) from %s to %s\n",
+ Token::Name(op),
+ info.ToString(),
+ value->Mnemonic(),
+ graph_->GetMaximumValueID(),
+ value->representation().Mnemonic(),
+ rep.Mnemonic());
+ }
+ value->ChangeRepresentation(rep);
+ // The representation of the value is dictated by type feedback and
+ // will not be changed later.
+ value->ClearFlag(HValue::kFlexibleRepresentation);
}
Index: src/hydrogen.h
===================================================================
--- src/hydrogen.h (revision 7870)
+++ src/hydrogen.h (working copy)
@@ -819,7 +819,10 @@
// to push them as outgoing parameters.
template <int V> HInstruction* PreProcessCall(HCall<V>* call);
- void AssumeRepresentation(HValue* value, Representation r);
+ void AssumeRepresentation(Token::Value op,
+ TypeInfo info,
+ HValue* value,
+ Representation rep);
static Representation ToRepresentation(TypeInfo info);
void SetupScope(Scope* scope);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev