Reviewers: Jakob,

Description:
Skip canonicalization of packed arrays in HStoreKeyedFastDoubleElement

[email protected]


Please review this at https://chromiumcodereview.appspot.com/10538002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/hydrogen-instructions.h
  M src/hydrogen-instructions.cc
  M src/hydrogen.cc


Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 57a186280b1713b9d9c65d91d4dc6b7bed2bea0a..21d168e030e16bf0b19c092dd9e4960d1ee684f6 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -2189,6 +2189,7 @@ bool HStoreKeyedFastDoubleElement::NeedsCanonicalization() {
   // If value was loaded from unboxed double backing store or
   // converted from an integer then we don't have to canonicalize it.
   if (value()->IsLoadKeyedFastDoubleElement() ||
+      SkipCanonicalization::decode(bit_field_) ||
(value()->IsChange() && HChange::cast(value())->from().IsInteger32())) {
     return false;
   }
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 0f6cb6e473d7454dd9cb1709f3b2faef1f1feaf3..f593bcbc647421dd058003b616ee7f6a6d555c5c 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -4302,8 +4302,11 @@ class HStoreKeyedFastDoubleElement
  public:
   HStoreKeyedFastDoubleElement(HValue* elements,
                                HValue* key,
-                               HValue* val)
-      : index_offset_(0), is_dehoisted_(false) {
+                               HValue* val,
+                               ElementsKind element_kind)
+      : index_offset_(0), bit_field_(0) {
+    bit_field_ = IsDehoisted::encode(false) |
+ SkipCanonicalization::encode(IsFastPackedElementsKind(element_kind));
     SetOperandAt(0, elements);
     SetOperandAt(1, key);
     SetOperandAt(2, val);
@@ -4327,8 +4330,10 @@ class HStoreKeyedFastDoubleElement
void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; }
   HValue* GetKey() { return key(); }
   void SetKey(HValue* key) { SetOperandAt(1, key); }
-  bool IsDehoisted() { return is_dehoisted_; }
-  void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; }
+  bool IsDehoisted() { return IsDehoisted::decode(bit_field_); }
+  void SetDehoisted(bool is_dehoisted) {
+    bit_field_ = IsDehoisted::update(bit_field_, is_dehoisted);
+  }

   bool NeedsWriteBarrier() {
     return StoringValueNeedsWriteBarrier(value());
@@ -4341,8 +4346,11 @@ class HStoreKeyedFastDoubleElement
   DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement)

  private:
+  class IsDehoisted:           public BitField<bool, 0, 1> {};
+  class SkipCanonicalization:  public BitField<bool, 1, 2> {};
+
   uint32_t index_offset_;
-  bool is_dehoisted_;
+  uint32_t bit_field_;
 };


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index d880b02836df33384a97f3dd4cdaf53b0c2a92ae..3447101627d83592287d1d900c13c5722dcb866c 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -4480,9 +4480,11 @@ void HGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
         break;
       case FAST_DOUBLE_ELEMENTS:
       case FAST_HOLEY_DOUBLE_ELEMENTS:
-        AddInstruction(new(zone()) HStoreKeyedFastDoubleElement(elements,
-                                                                key,
-                                                                value));
+        AddInstruction(new(zone()) HStoreKeyedFastDoubleElement(
+            elements,
+            key,
+            value,
+            boilerplate_elements_kind));
         break;
       default:
         UNREACHABLE();
@@ -5296,7 +5298,7 @@ HInstruction* HGraphBuilder::BuildFastElementAccess(HValue* elements,
       case FAST_DOUBLE_ELEMENTS:
       case FAST_HOLEY_DOUBLE_ELEMENTS:
         return new(zone()) HStoreKeyedFastDoubleElement(
-            elements, checked_key, val);
+            elements, checked_key, val, elements_kind);
       case FAST_SMI_ELEMENTS:
       case FAST_HOLEY_SMI_ELEMENTS:
         // Smi-only arrays need a smi check.


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

Reply via email to