Revision: 16865
Author:   [email protected]
Date:     Fri Sep 20 12:32:31 2013 UTC
Log: Use Unique<Cell> and Unique<PropertyCell> in LoadGlobalCell and StoreGlobalCell.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/24072016
http://code.google.com/p/v8/source/detail?r=16865

Modified:
 /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
 /branches/bleeding_edge/src/hydrogen-instructions.cc
 /branches/bleeding_edge/src/hydrogen-instructions.h
 /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
 /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
 /branches/bleeding_edge/src/unique.h
 /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Fri Sep 20 09:57:58 2013 UTC +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Fri Sep 20 12:32:31 2013 UTC
@@ -2954,7 +2954,7 @@

 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
   Register result = ToRegister(instr->result());
-  __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell())));
+  __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell().handle())));
   __ ldr(result, FieldMemOperand(ip, Cell::kValueOffset));
   if (instr->hydrogen()->RequiresHoleCheck()) {
     __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
@@ -2981,7 +2981,7 @@
   Register cell = scratch0();

   // Load the cell.
-  __ mov(cell, Operand(instr->hydrogen()->cell()));
+  __ mov(cell, Operand(instr->hydrogen()->cell().handle()));

   // If the cell we are storing to contains the hole it could have
   // been deleted from the property dictionary. In that case, we need
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Fri Sep 20 12:25:00 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Fri Sep 20 12:32:31 2013 UTC
@@ -3145,7 +3145,7 @@


 void HLoadGlobalCell::PrintDataTo(StringStream* stream) {
-  stream->Add("[%p]", *cell());
+  stream->Add("[%p]", *cell().handle());
   if (!details_.IsDontDelete()) stream->Add(" (deleteable)");
   if (details_.IsReadOnly()) stream->Add(" (read-only)");
 }
@@ -3173,7 +3173,7 @@


 void HStoreGlobalCell::PrintDataTo(StringStream* stream) {
-  stream->Add("[%p] = ", *cell());
+  stream->Add("[%p] = ", *cell().handle());
   value()->PrintNameTo(stream);
   if (!details_.IsDontDelete()) stream->Add(" (deleteable)");
   if (details_.IsReadOnly()) stream->Add(" (read-only)");
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Fri Sep 20 12:25:00 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.h Fri Sep 20 12:32:31 2013 UTC
@@ -5122,23 +5122,23 @@
 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> {
  public:
   HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details)
-      : cell_(cell), details_(details), unique_id_() {
+    : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) {
     set_representation(Representation::Tagged());
     SetFlag(kUseGVN);
     SetGVNFlag(kDependsOnGlobalVars);
   }

-  Handle<Cell> cell() const { return cell_; }
+  Unique<Cell> cell() const { return cell_; }
   bool RequiresHoleCheck() const;

   virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;

   virtual intptr_t Hashcode() V8_OVERRIDE {
-    return unique_id_.Hashcode();
+    return cell_.Hashcode();
   }

   virtual void FinalizeUniqueValueId() V8_OVERRIDE {
-    unique_id_ = UniqueValueId(cell_);
+    cell_ = Unique<Cell>(cell_.handle());
   }

virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
@@ -5149,16 +5149,14 @@

  protected:
   virtual bool DataEquals(HValue* other) V8_OVERRIDE {
-    HLoadGlobalCell* b = HLoadGlobalCell::cast(other);
-    return unique_id_ == b->unique_id_;
+    return cell_ == HLoadGlobalCell::cast(other)->cell_;
   }

  private:
virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); }

-  Handle<Cell> cell_;
+  Unique<Cell> cell_;
   PropertyDetails details_;
-  UniqueValueId unique_id_;
 };


@@ -5429,13 +5427,17 @@
   DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*,
                                  Handle<PropertyCell>, PropertyDetails);

-  Handle<PropertyCell> cell() const { return cell_; }
+  Unique<PropertyCell> cell() const { return cell_; }
   bool RequiresHoleCheck() {
     return !details_.IsDontDelete() || details_.IsReadOnly();
   }
   bool NeedsWriteBarrier() {
     return StoringValueNeedsWriteBarrier(value());
   }
+
+  virtual void FinalizeUniqueValueId() V8_OVERRIDE {
+    cell_ = Unique<PropertyCell>(cell_.handle());
+  }

virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
     return Representation::Tagged();
@@ -5449,12 +5451,12 @@
                    Handle<PropertyCell> cell,
                    PropertyDetails details)
       : HUnaryOperation(value),
-        cell_(cell),
+        cell_(Unique<PropertyCell>::CreateUninitialized(cell)),
         details_(details) {
     SetGVNFlag(kChangesGlobalVars);
   }

-  Handle<PropertyCell> cell_;
+  Unique<PropertyCell> cell_;
   PropertyDetails details_;
 };

=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Fri Sep 20 12:25:00 2013 UTC +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Fri Sep 20 12:32:31 2013 UTC
@@ -3151,7 +3151,7 @@

 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
   Register result = ToRegister(instr->result());
-  __ mov(result, Operand::ForCell(instr->hydrogen()->cell()));
+  __ mov(result, Operand::ForCell(instr->hydrogen()->cell().handle()));
   if (instr->hydrogen()->RequiresHoleCheck()) {
     __ cmp(result, factory()->the_hole_value());
     DeoptimizeIf(equal, instr->environment());
@@ -3174,7 +3174,7 @@

 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
   Register value = ToRegister(instr->value());
-  Handle<PropertyCell> cell_handle = instr->hydrogen()->cell();
+  Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle();

   // If the cell we are storing to contains the hole it could have
   // been deleted from the property dictionary. In that case, we need
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Thu Sep 19 15:38:51 2013 UTC +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Fri Sep 20 12:32:31 2013 UTC
@@ -2805,7 +2805,7 @@

 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
   Register result = ToRegister(instr->result());
-  __ li(at, Operand(Handle<Object>(instr->hydrogen()->cell())));
+  __ li(at, Operand(Handle<Object>(instr->hydrogen()->cell().handle())));
   __ lw(result, FieldMemOperand(at, Cell::kValueOffset));
   if (instr->hydrogen()->RequiresHoleCheck()) {
     __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
@@ -2831,7 +2831,7 @@
   Register cell = scratch0();

   // Load the cell.
-  __ li(cell, Operand(instr->hydrogen()->cell()));
+  __ li(cell, Operand(instr->hydrogen()->cell().handle()));

   // If the cell we are storing to contains the hole it could have
   // been deleted from the property dictionary. In that case, we need
=======================================
--- /branches/bleeding_edge/src/unique.h        Thu Sep 19 17:02:57 2013 UTC
+++ /branches/bleeding_edge/src/unique.h        Fri Sep 20 12:32:31 2013 UTC
@@ -90,34 +90,34 @@
   }

   template <typename U>
-  bool operator==(const Unique<U>& other) const {
+  inline bool operator==(const Unique<U>& other) const {
     ASSERT(IsInitialized() && other.IsInitialized());
     return raw_address_ == other.raw_address_;
   }

   template <typename U>
-  bool operator!=(const Unique<U>& other) const {
+  inline bool operator!=(const Unique<U>& other) const {
     ASSERT(IsInitialized() && other.IsInitialized());
     return raw_address_ != other.raw_address_;
   }

-  intptr_t Hashcode() const {
+  inline intptr_t Hashcode() const {
     ASSERT(IsInitialized());
     return reinterpret_cast<intptr_t>(raw_address_);
   }

-  bool IsNull() const {
+  inline bool IsNull() const {
     ASSERT(IsInitialized());
     return raw_address_ == NULL;
   }

   // Extract the handle from this Unique in order to dereference it.
   // WARNING: Only do this if you have access to the heap.
-  Handle<T> handle() const {
+  inline Handle<T> handle() const {
     return handle_;
   }

-  bool IsInitialized() const {
+  inline bool IsInitialized() const {
     return raw_address_ != NULL || handle_.is_null();
   }

=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Fri Sep 20 06:01:25 2013 UTC +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Fri Sep 20 12:32:31 2013 UTC
@@ -2668,7 +2668,7 @@

 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
   Register result = ToRegister(instr->result());
-  __ LoadGlobalCell(result, instr->hydrogen()->cell());
+  __ LoadGlobalCell(result, instr->hydrogen()->cell().handle());
   if (instr->hydrogen()->RequiresHoleCheck()) {
     __ CompareRoot(result, Heap::kTheHoleValueRootIndex);
     DeoptimizeIf(equal, instr->environment());
@@ -2690,7 +2690,7 @@

 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
   Register value = ToRegister(instr->value());
-  Handle<Cell> cell_handle = instr->hydrogen()->cell();
+  Handle<Cell> cell_handle = instr->hydrogen()->cell().handle();

   // If the cell we are storing to contains the hole it could have
   // been deleted from the property dictionary. In that case, we need

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to