Comment #2 on issue 3670 by [email protected]: typeof comparison with
undefined causes incorrect type inferences
https://code.google.com/p/v8/issues/detail?id=3670
Ugh. Yeah.
In SSA form, this function becomes:
function repro(x0, y0) {
if (typeof y0 != 'undefined') {
y1 = y0 | 0;
}
y2 = phi(y0, y1);
if (typeof y2 == 'undefined') {
y3 = 0;
}
y4 = phi(y2, y3);
return 1 - y4;
}
y2 has an input that's clearly int32, and an indirect (via y4) use that's
only ever seen int type feedback, so it decides to have int32
representation. However, at this point in the program we still may have to
represent the value |undefined|, so the to-int conversion deopts. FWIW,
an "else" branch instead of the second "if" would have avoided the issue.
I can fix it with the following patch, but I'll have to run more tests to
make sure this doesn't regress anything else:
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 3dcdf58..7b62480 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -5311,6 +5311,12 @@ class HParameter FINAL : public
HTemplateInstruction<0> {
return Representation::None();
}
+ virtual Representation KnownOptimalRepresentation() OVERRIDE {
+ // If a parameter is an input to a phi, that phi should not
+ // choose any more optimistic representation than Tagged.
+ return Representation::Tagged();
+ }
+
DECLARE_CONCRETE_INSTRUCTION(Parameter)
private:
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.