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

Unified Diff: src/ia32/codegen-ia32.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 | « no previous file | src/runtime.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/codegen-ia32.cc
===================================================================
--- src/ia32/codegen-ia32.cc (revision 4966)
+++ src/ia32/codegen-ia32.cc (working copy)
@@ -11686,16 +11686,18 @@
__ Set(eax, Immediate(Smi::FromInt(EQUAL)));
__ ret(0);
} else {
- Label return_equal;
Label heap_number;
- // If it's not a heap number, then return equal.
__ cmp(FieldOperand(edx, HeapObject::kMapOffset),
Immediate(Factory::heap_number_map()));
- __ j(equal, &heap_number);
- __ bind(&return_equal);
- __ Set(eax, Immediate(Smi::FromInt(EQUAL)));
- __ ret(0);
-
+ if (cc_ == equal) {
+ __ j(equal, &heap_number);
+ // Identical objects are equal for operators ==, !=, and ===.
+ __ Set(eax, Immediate(Smi::FromInt(EQUAL)));
+ __ ret(0);
+ } else {
+ // Identical objects must call ToPrimitive for <, <=, >, and >=.
+ __ j(not_equal, &not_identical);
+ }
__ bind(&heap_number);
// It is a heap number, so return non-equal if it's NaN and equal if
// it's not NaN.
« no previous file with comments | « no previous file | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698