Revision: 5000
Author: [email protected]
Date: Thu Jul  1 08:18:07 2010
Log: Let relational comparison operators quickly compare a string with itself.
Review URL: http://codereview.chromium.org/2802028
http://code.google.com/p/v8/source/detail?r=5000

Modified:
 /branches/bleeding_edge/src/ia32/codegen-ia32.cc
 /branches/bleeding_edge/src/x64/codegen-x64.cc

=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc Wed Jun 30 06:24:47 2010 +++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc Thu Jul 1 08:18:07 2010
@@ -11689,15 +11689,15 @@
       Label heap_number;
       __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
              Immediate(Factory::heap_number_map()));
-      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);
-      }
+      __ j(equal, &heap_number);
+      if (cc_ != equal) {
+        // Call runtime on identical JSObjects.  Otherwise return equal.
+        __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx);
+        __ j(above_equal, &not_identical);
+      }
+      __ Set(eax, Immediate(Smi::FromInt(EQUAL)));
+      __ ret(0);
+
       __ bind(&heap_number);
       // It is a heap number, so return non-equal if it's NaN and equal if
       // it's not NaN.
=======================================
--- /branches/bleeding_edge/src/x64/codegen-x64.cc      Thu Jul  1 06:19:32 2010
+++ /branches/bleeding_edge/src/x64/codegen-x64.cc      Thu Jul  1 08:18:07 2010
@@ -9077,14 +9077,14 @@
// If it's not a heap number, then return equal for (in)equality operator.
       __ Cmp(FieldOperand(rdx, HeapObject::kMapOffset),
              Factory::heap_number_map());
-      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);
-      }
+      __ j(equal, &heap_number);
+      if (cc_ != equal) {
+        // Call runtime on identical JSObjects.  Otherwise return equal.
+        __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx);
+        __ j(above_equal, &not_identical);
+      }
+      __ Set(rax, EQUAL);
+      __ ret(0);

       __ bind(&heap_number);
       // It is a heap number, so return  equal if it's not NaN.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to