Revision: 11540
Author:   [email protected]
Date:     Thu May 10 14:25:49 2012
Log:      Fix compose-discard crasher from 11524 - port to x64, ARM, MIPS.
This is now bug 2123.
TBR=mstarzinger
Review URL: https://chromiumcodereview.appspot.com/10391061
http://code.google.com/p/v8/source/detail?r=11540

Modified:
 /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
 /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
 /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Apr 30 07:59:13 2012 +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Thu May 10 14:25:49 2012
@@ -2589,8 +2589,7 @@
   Register scratch = scratch0();
   int map_count = instr->hydrogen()->types()->length();
   Handle<String> name = instr->hydrogen()->name();
-  if (map_count == 0) {
-    ASSERT(instr->hydrogen()->need_generic());
+  if (map_count == 0 && instr->hydrogen()->need_generic()) {
     __ mov(r2, Operand(name));
     Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
     CallCode(ic, RelocInfo::CODE_TARGET, instr);
@@ -2606,20 +2605,28 @@
       __ b(&done);
       __ bind(&next);
     }
-    Handle<Map> map = instr->hydrogen()->types()->last();
-    __ cmp(scratch, Operand(map));
     if (instr->hydrogen()->need_generic()) {
-      Label generic;
-      __ b(ne, &generic);
-      EmitLoadFieldOrConstantFunction(result, object, map, name);
-      __ b(&done);
-      __ bind(&generic);
+      if (map_count != 0) {
+        Handle<Map> map = instr->hydrogen()->types()->last();
+        __ cmp(scratch, Operand(map));
+        Label generic;
+        __ b(ne, &generic);
+        EmitLoadFieldOrConstantFunction(result, object, map, name);
+        __ b(&done);
+        __ bind(&generic);
+      }
       __ mov(r2, Operand(name));
       Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
       CallCode(ic, RelocInfo::CODE_TARGET, instr);
     } else {
-      DeoptimizeIf(ne, instr->environment());
-      EmitLoadFieldOrConstantFunction(result, object, map, name);
+      if (map_count != 0) {
+        Handle<Map> map = instr->hydrogen()->types()->last();
+        __ cmp(scratch, Operand(map));
+        DeoptimizeIf(ne, instr->environment());
+        EmitLoadFieldOrConstantFunction(result, object, map, name);
+      } else {
+        DeoptimizeIf(al, instr->environment());
+      }
     }
     __ bind(&done);
   }
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Mon May 7 10:31:14 2012 +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Thu May 10 14:25:49 2012
@@ -2345,8 +2345,7 @@
   Register scratch = scratch0();
   int map_count = instr->hydrogen()->types()->length();
   Handle<String> name = instr->hydrogen()->name();
-  if (map_count == 0) {
-    ASSERT(instr->hydrogen()->need_generic());
+  if (map_count == 0 && instr->hydrogen()->need_generic()) {
     __ li(a2, Operand(name));
     Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
     CallCode(ic, RelocInfo::CODE_TARGET, instr);
@@ -2361,19 +2360,26 @@
       __ Branch(&done);
       __ bind(&next);
     }
-    Handle<Map> map = instr->hydrogen()->types()->last();
     if (instr->hydrogen()->need_generic()) {
-      Label generic;
-      __ Branch(&generic, ne, scratch, Operand(map));
-      EmitLoadFieldOrConstantFunction(result, object, map, name);
-      __ Branch(&done);
-      __ bind(&generic);
+      if (map_count != 0) {
+        Handle<Map> map = instr->hydrogen()->types()->last();
+        Label generic;
+        __ Branch(&generic, ne, scratch, Operand(map));
+        EmitLoadFieldOrConstantFunction(result, object, map, name);
+        __ Branch(&done);
+        __ bind(&generic);
+      }
       __ li(a2, Operand(name));
       Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
       CallCode(ic, RelocInfo::CODE_TARGET, instr);
     } else {
-      DeoptimizeIf(ne, instr->environment(), scratch, Operand(map));
-      EmitLoadFieldOrConstantFunction(result, object, map, name);
+      if (map_count != 0) {
+        Handle<Map> map = instr->hydrogen()->types()->last();
+        DeoptimizeIf(ne, instr->environment(), scratch, Operand(map));
+        EmitLoadFieldOrConstantFunction(result, object, map, name);
+      } else {
+ DeoptimizeIf(al, instr->environment(), zero_reg, Operand(zero_reg));
+      }
     }
     __ bind(&done);
   }
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon Apr 30 07:59:13 2012 +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Thu May 10 14:25:49 2012
@@ -2225,8 +2225,7 @@
   int map_count = instr->hydrogen()->types()->length();
   Handle<String> name = instr->hydrogen()->name();

-  if (map_count == 0) {
-    ASSERT(instr->hydrogen()->need_generic());
+  if (map_count == 0 && instr->hydrogen()->need_generic()) {
     __ Move(rcx, instr->hydrogen()->name());
     Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
     CallCode(ic, RelocInfo::CODE_TARGET, instr);
@@ -2241,20 +2240,28 @@
       __ jmp(&done, Label::kNear);
       __ bind(&next);
     }
-    Handle<Map> map = instr->hydrogen()->types()->last();
-    __ Cmp(FieldOperand(object, HeapObject::kMapOffset), map);
     if (instr->hydrogen()->need_generic()) {
-      Label generic;
-      __ j(not_equal, &generic, Label::kNear);
-      EmitLoadFieldOrConstantFunction(result, object, map, name);
-      __ jmp(&done, Label::kNear);
-      __ bind(&generic);
+      if (map_count != 0) {
+        Handle<Map> map = instr->hydrogen()->types()->last();
+        __ Cmp(FieldOperand(object, HeapObject::kMapOffset), map);
+        Label generic;
+        __ j(not_equal, &generic, Label::kNear);
+        EmitLoadFieldOrConstantFunction(result, object, map, name);
+        __ jmp(&done, Label::kNear);
+        __ bind(&generic);
+      }
       __ Move(rcx, instr->hydrogen()->name());
       Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
       CallCode(ic, RelocInfo::CODE_TARGET, instr);
     } else {
-      DeoptimizeIf(not_equal, instr->environment());
-      EmitLoadFieldOrConstantFunction(result, object, map, name);
+      if (map_count != 0) {
+        Handle<Map> map = instr->hydrogen()->types()->last();
+        __ Cmp(FieldOperand(object, HeapObject::kMapOffset), map);
+        DeoptimizeIf(not_equal, instr->environment());
+        EmitLoadFieldOrConstantFunction(result, object, map, name);
+      } else {
+        DeoptimizeIf(no_condition, instr->environment());
+      }
     }
     __ bind(&done);
   }

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

Reply via email to