Revision: 8709
Author:   [email protected]
Date:     Thu Jul 21 05:01:51 2011
Log:      Fix deopts caused by misplaced COW checks.

TEST=Performance of pixel-array-blur back to normal.

Review URL: http://codereview.chromium.org/7471034
http://code.google.com/p/v8/source/detail?r=8709

Modified:
 /branches/bleeding_edge/src/hydrogen-instructions.h
 /branches/bleeding_edge/src/hydrogen.cc

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Wed Jul 20 07:43:10 2011 +++ /branches/bleeding_edge/src/hydrogen-instructions.h Thu Jul 21 05:01:51 2011
@@ -1898,10 +1898,14 @@
 };


-class HCheckMap: public HUnaryOperation {
+class HCheckMap: public HTemplateInstruction<2> {
  public:
-  HCheckMap(HValue* value, Handle<Map> map)
-      : HUnaryOperation(value), map_(map) {
+  HCheckMap(HValue* value, Handle<Map> map, HValue* typecheck = NULL)
+      : map_(map) {
+    SetOperandAt(0, value);
+ // If callers don't depend on a typecheck, they can pass in NULL. In that
+    // case we use a copy of the |value| argument as a dummy value.
+    SetOperandAt(1, typecheck != NULL ? typecheck : value);
     set_representation(Representation::Tagged());
     SetFlag(kUseGVN);
     SetFlag(kDependsOnMaps);
@@ -1913,6 +1917,7 @@
   virtual void PrintDataTo(StringStream* stream);
   virtual HType CalculateInferredType();

+  HValue* value() { return OperandAt(0); }
   Handle<Map> map() const { return map_; }

   DECLARE_CONCRETE_INSTRUCTION(CheckMap)
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Wed Jul 20 07:43:10 2011
+++ /branches/bleeding_edge/src/hydrogen.cc     Thu Jul 21 05:01:51 2011
@@ -3911,7 +3911,7 @@
HInstruction* mapcheck = AddInstruction(new(zone()) HCheckMap(object, map)); HInstruction* elements = AddInstruction(new(zone()) HLoadElements(object));
   bool fast_double_elements = map->has_fast_double_elements();
-  if (is_store && !fast_double_elements) {
+  if (is_store && map->has_fast_elements()) {
     AddInstruction(new(zone()) HCheckMap(
         elements, isolate()->factory()->fixed_array_map()));
   }
@@ -4022,9 +4022,10 @@
           elements_kind == JSObject::FAST_DOUBLE_ELEMENTS) {
         bool fast_double_elements =
             elements_kind == JSObject::FAST_DOUBLE_ELEMENTS;
-        if (is_store && !fast_double_elements) {
+        if (is_store && elements_kind == JSObject::FAST_ELEMENTS) {
           AddInstruction(new(zone()) HCheckMap(
-              elements, isolate()->factory()->fixed_array_map()));
+              elements, isolate()->factory()->fixed_array_map(),
+              elements_kind_branch));
         }
         HBasicBlock* if_jsarray = graph()->CreateBasicBlock();
         HBasicBlock* if_fastobject = graph()->CreateBasicBlock();

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

Reply via email to