Commit c417df74 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Update representation-from-uses to support smi.

R=jkummerow@chromium.org

Review URL: https://chromiumcodereview.appspot.com/15692004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14801 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7aa74c3d
......@@ -108,10 +108,12 @@ Representation HValue::RepresentationFromUses() {
int tagged_count = use_count[Representation::kTagged];
int double_count = use_count[Representation::kDouble];
int int32_count = use_count[Representation::kInteger32];
int smi_count = use_count[Representation::kSmi];
if (tagged_count > 0) return Representation::Tagged();
if (double_count > 0) return Representation::Double();
if (int32_count > 0) return Representation::Integer32();
if (smi_count > 0) return Representation::Smi();
return Representation::None();
}
......@@ -1909,8 +1911,9 @@ void HPhi::PrintTo(StringStream* stream) {
value->PrintNameTo(stream);
stream->Add(" ");
}
stream->Add(" uses:%d_%di_%dd_%dt",
stream->Add(" uses:%d_%ds_%di_%dd_%dt",
UseCount(),
smi_non_phi_uses() + smi_indirect_uses(),
int32_non_phi_uses() + int32_indirect_uses(),
double_non_phi_uses() + double_indirect_uses(),
tagged_non_phi_uses() + tagged_indirect_uses());
......@@ -1989,8 +1992,9 @@ void HPhi::InitRealUses(int phi_id) {
void HPhi::AddNonPhiUsesFrom(HPhi* other) {
if (FLAG_trace_representation) {
PrintF("adding to #%d Phi uses of #%d Phi: i%d d%d t%d\n",
PrintF("adding to #%d Phi uses of #%d Phi: s%d i%d d%d t%d\n",
id(), other->id(),
other->non_phi_uses_[Representation::kSmi],
other->non_phi_uses_[Representation::kInteger32],
other->non_phi_uses_[Representation::kDouble],
other->non_phi_uses_[Representation::kTagged]);
......@@ -3546,21 +3550,24 @@ void HPhi::InferRepresentation(HInferRepresentation* h_infer) {
Representation HPhi::RepresentationFromInputs() {
bool double_occurred = false;
bool int32_occurred = false;
bool smi_occurred = false;
for (int i = 0; i < OperandCount(); ++i) {
HValue* value = OperandAt(i);
if (value->IsUnknownOSRValue()) {
HPhi* hint_value = HUnknownOSRValue::cast(value)->incoming_value();
if (hint_value != NULL) {
Representation hint = hint_value->representation();
if (hint.IsSmiOrTagged()) return hint;
if (hint.IsTagged()) return hint;
if (hint.IsDouble()) double_occurred = true;
if (hint.IsInteger32()) int32_occurred = true;
if (hint.IsSmi()) smi_occurred = true;
}
continue;
}
if (value->representation().IsDouble()) double_occurred = true;
if (value->representation().IsInteger32()) int32_occurred = true;
if (value->representation().IsSmiOrTagged()) {
if (value->representation().IsSmi()) smi_occurred = true;
if (value->representation().IsTagged()) {
if (value->IsConstant()) {
HConstant* constant = HConstant::cast(value);
if (constant->IsConvertibleToInteger()) {
......@@ -3579,8 +3586,8 @@ Representation HPhi::RepresentationFromInputs() {
}
if (double_occurred) return Representation::Double();
if (int32_occurred) return Representation::Integer32();
if (smi_occurred) return Representation::Smi();
return Representation::None();
}
......
......@@ -3000,6 +3000,9 @@ class HPhi: public HValue {
int tagged_non_phi_uses() const {
return non_phi_uses_[Representation::kTagged];
}
int smi_non_phi_uses() const {
return non_phi_uses_[Representation::kSmi];
}
int int32_non_phi_uses() const {
return non_phi_uses_[Representation::kInteger32];
}
......@@ -3009,6 +3012,9 @@ class HPhi: public HValue {
int tagged_indirect_uses() const {
return indirect_uses_[Representation::kTagged];
}
int smi_indirect_uses() const {
return indirect_uses_[Representation::kSmi];
}
int int32_indirect_uses() const {
return indirect_uses_[Representation::kInteger32];
}
......
......@@ -252,6 +252,14 @@ void StringStream::Add(const char* format, FmtElm arg0, FmtElm arg1,
}
void StringStream::Add(const char* format, FmtElm arg0, FmtElm arg1,
FmtElm arg2, FmtElm arg3, FmtElm arg4) {
const char argc = 5;
FmtElm argv[argc] = { arg0, arg1, arg2, arg3, arg4 };
Add(CStrVector(format), Vector<FmtElm>(argv, argc));
}
SmartArrayPointer<const char> StringStream::ToCString() const {
char* str = NewArray<char>(length_ + 1);
OS::MemCopy(str, buffer_, length_);
......
......@@ -137,6 +137,12 @@ class StringStream {
FmtElm arg1,
FmtElm arg2,
FmtElm arg3);
void Add(const char* format,
FmtElm arg0,
FmtElm arg1,
FmtElm arg2,
FmtElm arg3,
FmtElm arg4);
// Getting the message out.
void OutputToFile(FILE* out);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment