Refactored HInferRepresenation::TryChange a bit, making the heuristics a bit clearer.
Removed an unneeded check for phis: There are never HValues in the work list which are not convertible to integer and are not a phi. (But even if they were, ignoring IsConvertibleToInteger() then looks like the wrong thing to do.) Review URL: http://codereview.chromium.org/7857033 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9225 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
faa82f6363
commit
baab04283d
@ -1649,18 +1649,20 @@ Representation HInferRepresentation::TryChange(HValue* value) {
|
||||
int non_tagged_count = double_count + int32_count;
|
||||
|
||||
// If a non-loop phi has tagged uses, don't convert it to untagged.
|
||||
if (value->IsPhi() && !value->block()->IsLoopHeader()) {
|
||||
if (tagged_count > 0) return Representation::None();
|
||||
if (value->IsPhi() && !value->block()->IsLoopHeader() && tagged_count > 0) {
|
||||
return Representation::None();
|
||||
}
|
||||
|
||||
if (non_tagged_count >= tagged_count) {
|
||||
if (int32_count > 0) {
|
||||
if (!value->IsPhi() || value->IsConvertibleToInteger()) {
|
||||
return Representation::Integer32();
|
||||
}
|
||||
}
|
||||
if (double_count > 0) return Representation::Double();
|
||||
// Prefer unboxing over boxing, the latter is more expensive.
|
||||
if (tagged_count > non_tagged_count) Representation::None();
|
||||
|
||||
// Prefer Integer32 over Double, if possible.
|
||||
if (int32_count > 0 && value->IsConvertibleToInteger()) {
|
||||
return Representation::Integer32();
|
||||
}
|
||||
|
||||
if (double_count > 0) return Representation::Double();
|
||||
|
||||
return Representation::None();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user