Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Unified Diff: src/hydrogen-instructions.cc

Issue 9584006: Inline ordered relative compares of mixed double/undefined values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 074054ce1d0c414ce12c6e8230400a1acd798cba..2805d3983fb4af7473fd53c7730d269559ebf514 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -1457,7 +1457,17 @@ void HGoto::PrintDataTo(StringStream* stream) {
void HCompareIDAndBranch::SetInputRepresentation(Representation r) {
input_representation_ = r;
if (r.IsDouble()) {
- SetFlag(kDeoptimizeOnUndefined);
+ // ==, === and != have special handling of undefined, specifically undeifned
fschneider 2012/03/02 12:39:15 s/undeifned/undefined
danno 2012/03/02 13:28:45 Done.
+ // == undefined is 'true' but the standard Crankshaft tagged-to-double
+ // conversion to ensure the HCompareIDAndBranch's inputs, including
+ // undefined values, are doubles will convert undefined to NaN, and NaN ==
+ // NaN is 'false'. So all comparisons that aren't explicitly defined by the
+ // spec to call ToPrimitive() (i.e. anything not an ordered relational
+ // comparison) must deopt when one of the arguments is undefined.
+ // See v8:1434
fschneider 2012/03/02 12:39:15 I'd also refer to the corresponding sections in th
danno 2012/03/02 13:28:45 Done.
+ if (!Token::IsOrderedCompareOp(token_)) {
fschneider 2012/03/02 12:39:15 maybe rename to IsRelationalCompareOp.
danno 2012/03/02 13:28:45 Done.
+ SetFlag(kDeoptimizeOnUndefined);
+ }
} else {
ASSERT(r.IsInteger32());
}
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | src/ia32/ic-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698