Don't take UnkownOSRValues into account when infering Phi's representation.

For DIV with uninitialized result assume double result representation.

R=fschneider@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11041 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
vegorov@chromium.org 2012-03-14 12:59:49 +00:00
parent 4663039353
commit 966ebf8f55
5 changed files with 50 additions and 14 deletions

View File

@ -2257,6 +2257,38 @@ void HIn::PrintDataTo(StringStream* stream) {
}
Representation HPhi::InferredRepresentation() {
bool double_occurred = false;
bool int32_occurred = false;
for (int i = 0; i < OperandCount(); ++i) {
HValue* value = OperandAt(i);
if (value->IsUnknownOSRValue()) continue;
if (value->representation().IsDouble()) double_occurred = true;
if (value->representation().IsInteger32()) int32_occurred = true;
if (value->representation().IsTagged()) {
if (value->IsConstant()) {
HConstant* constant = HConstant::cast(value);
if (constant->IsConvertibleToInteger()) {
int32_occurred = true;
} else if (constant->HasNumberValue()) {
double_occurred = true;
} else {
return Representation::Tagged();
}
} else {
return Representation::Tagged();
}
}
}
if (double_occurred) return Representation::Double();
if (int32_occurred) return Representation::Integer32();
return Representation::None();
}
// Node-specific verification code is only included in debug mode.
#ifdef DEBUG

View File

@ -2261,20 +2261,7 @@ class HPhi: public HValue {
SetFlag(kFlexibleRepresentation);
}
virtual Representation InferredRepresentation() {
bool double_occurred = false;
bool int32_occurred = false;
for (int i = 0; i < OperandCount(); ++i) {
HValue* value = OperandAt(i);
if (value->representation().IsDouble()) double_occurred = true;
if (value->representation().IsInteger32()) int32_occurred = true;
if (value->representation().IsTagged()) return Representation::Tagged();
}
if (double_occurred) return Representation::Double();
if (int32_occurred) return Representation::Integer32();
return Representation::None();
}
virtual Representation InferredRepresentation();
virtual Range* InferRange(Zone* zone);
virtual Representation RequiredInputRepresentation(int index) {

View File

@ -1766,6 +1766,12 @@ void HInferRepresentation::InferBasedOnInputs(HValue* current) {
ASSERT(current->CheckFlag(HValue::kFlexibleRepresentation));
Representation inferred = current->InferredRepresentation();
if (inferred.IsSpecialization()) {
if (FLAG_trace_representation) {
PrintF("Changing #%d representation %s -> %s based on inputs\n",
current->id(),
r.Mnemonic(),
inferred.Mnemonic());
}
current->ChangeRepresentation(inferred);
AddDependantsToWorklist(current);
}
@ -1793,6 +1799,12 @@ void HInferRepresentation::InferBasedOnUses(HValue* value) {
Representation new_rep = TryChange(value);
if (!new_rep.IsNone()) {
if (!value->representation().Equals(new_rep)) {
if (FLAG_trace_representation) {
PrintF("Changing #%d representation %s -> %s based on uses\n",
value->id(),
r.Mnemonic(),
new_rep.Mnemonic());
}
value->ChangeRepresentation(new_rep);
AddDependantsToWorklist(value);
}

View File

@ -13324,6 +13324,7 @@ void Runtime::PerformGC(Object* result) {
if (isolate->heap()->new_space()->AddFreshPage()) {
return;
}
// Try to do a garbage collection; ignore it if it fails. The C
// entry stub will throw an out-of-memory exception in that case.
isolate->heap()->CollectGarbage(failure->allocation_space(),

View File

@ -382,6 +382,10 @@ TypeInfo TypeFeedbackOracle::BinaryType(BinaryOperation* expr) {
case BinaryOpIC::SMI:
switch (result_type) {
case BinaryOpIC::UNINITIALIZED:
if (expr->op() == Token::DIV) {
return TypeInfo::Double();
}
return TypeInfo::Smi();
case BinaryOpIC::SMI:
return TypeInfo::Smi();
case BinaryOpIC::INT32: