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

Unified Diff: src/x64/codegen-x64.cc

Issue 2834022: Ensure that ToPrimitive is called on all objects involved in comparisons <, <... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 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
« no previous file with comments | « src/runtime.js ('k') | test/mjsunit/to_number_order.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/codegen-x64.cc
===================================================================
--- src/x64/codegen-x64.cc (revision 4966)
+++ src/x64/codegen-x64.cc (working copy)
@@ -8959,23 +8959,32 @@
// Test for NaN. Sadly, we can't just compare to Factory::nan_value(),
// so we do the second best thing - test it ourselves.
// Note: if cc_ != equal, never_nan_nan_ is not used.
- __ Set(rax, EQUAL);
+ // We cannot set rax to EQUAL until just before return because
+ // rax must be unchanged on jump to not_identical.
+
if (never_nan_nan_ && (cc_ == equal)) {
+ __ Set(rax, EQUAL);
__ ret(0);
} else {
Label heap_number;
- // If it's not a heap number, then return equal.
+ // If it's not a heap number, then return equal for (in)equality operator.
__ Cmp(FieldOperand(rdx, HeapObject::kMapOffset),
Factory::heap_number_map());
- __ j(equal, &heap_number);
- __ ret(0);
+ if (cc_ == equal) {
+ __ j(equal, &heap_number);
+ __ Set(rax, EQUAL);
+ __ ret(0);
+ } else {
+ // Identical objects must still be converted to primitive for < and >.
+ __ j(not_equal, &not_identical);
+ }
__ bind(&heap_number);
// It is a heap number, so return equal if it's not NaN.
// For NaN, return 1 for every condition except greater and
// greater-equal. Return -1 for them, so the comparison yields
// false for all conditions except not-equal.
-
+ __ Set(rax, EQUAL);
__ movsd(xmm0, FieldOperand(rdx, HeapNumber::kValueOffset));
__ ucomisd(xmm0, xmm0);
__ setcc(parity_even, rax);
« no previous file with comments | « src/runtime.js ('k') | test/mjsunit/to_number_order.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698