Revision: 12087
Author:   [email protected]
Date:     Mon Jul 16 02:49:00 2012
Log: Make it clear that HInstruction's position is a write-once variable.

Review URL: https://chromiumcodereview.appspot.com/10782010
http://code.google.com/p/v8/source/detail?r=12087

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

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Wed Jul 11 09:17:02 2012 +++ /branches/bleeding_edge/src/hydrogen-instructions.h Mon Jul 16 02:49:00 2012
@@ -857,9 +857,14 @@
   void InsertBefore(HInstruction* next);
   void InsertAfter(HInstruction* previous);

+  // The position is a write-once variable.
   int position() const { return position_; }
   bool has_position() const { return position_ != RelocInfo::kNoPosition; }
-  void set_position(int position) { position_ = position; }
+  void set_position(int position) {
+    ASSERT(!has_position());
+    ASSERT(position != RelocInfo::kNoPosition);
+    position_ = position;
+  }

   bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); }

=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Fri Jul 13 00:14:28 2012
+++ /branches/bleeding_edge/src/hydrogen.cc     Mon Jul 16 02:49:00 2012
@@ -5940,7 +5940,9 @@
     if (consolidated_load != NULL) {
       AddInstruction(consolidated_load);
       *has_side_effects |= consolidated_load->HasObservableSideEffects();
-      consolidated_load->set_position(position);
+      if (position != RelocInfo::kNoPosition) {
+        consolidated_load->set_position(position);
+      }
       return consolidated_load;
     }
   }
@@ -6006,7 +6008,7 @@
           object, key, val, transition, untransitionable_map, is_store));
     }
     *has_side_effects |= instr->HasObservableSideEffects();
-    instr->set_position(position);
+    if (position != RelocInfo::kNoPosition) instr->set_position(position);
     return is_store ? NULL : instr;
   }

@@ -6108,7 +6110,7 @@
             external_elements, checked_key, val, elements_kind, is_store));
       }
       *has_side_effects |= access->HasObservableSideEffects();
-      access->set_position(position);
+ if (position != RelocInfo::kNoPosition) access->set_position(position);
       if (!is_store) {
         Push(access);
       }
@@ -6155,7 +6157,7 @@
       instr = BuildLoadKeyedGeneric(obj, key);
     }
   }
-  instr->set_position(position);
+  if (position != RelocInfo::kNoPosition) instr->set_position(position);
   AddInstruction(instr);
   *has_side_effects = instr->HasObservableSideEffects();
   return instr;
@@ -7507,7 +7509,6 @@
     int argument_count = expr->arguments()->length();
     HCallRuntime* call =
         new(zone()) HCallRuntime(context, name, function, argument_count);
-    call->set_position(RelocInfo::kNoPosition);
     Drop(argument_count);
     return ast_context()->ReturnInstruction(call, expr->id());
   }

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

Reply via email to