Revision: 19205
Author:   [email protected]
Date:     Fri Feb  7 16:25:45 2014 UTC
Log:      A64: Fix handling of Smis in lithium Load/Store.

BUG=
[email protected], [email protected]

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

Modified:
 /branches/experimental/a64/src/a64/lithium-a64.cc
 /branches/experimental/a64/src/a64/lithium-codegen-a64.cc

=======================================
--- /branches/experimental/a64/src/a64/lithium-a64.cc Fri Feb 7 15:10:05 2014 UTC +++ /branches/experimental/a64/src/a64/lithium-a64.cc Fri Feb 7 16:25:45 2014 UTC
@@ -1653,7 +1653,8 @@
           ? AssignEnvironment(DefineAsRegister(result))
           : DefineAsRegister(result);
     } else {
-      ASSERT(instr->representation().IsSmiOrTagged());
+      ASSERT(instr->representation().IsSmiOrTagged() ||
+             instr->representation().IsInteger32());
       LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister();
       LLoadKeyedFixed* result =
           new(zone()) LLoadKeyedFixed(elements, key, temp);
@@ -2136,7 +2137,8 @@
     return new(zone()) LStoreKeyedFixedDouble(elements, key, val, temp);
   } else {
     ASSERT(instr->elements()->representation().IsTagged());
-    ASSERT(instr->value()->representation().IsSmiOrTagged());
+    ASSERT(instr->value()->representation().IsSmiOrTagged() ||
+           instr->value()->representation().IsInteger32());

     temp = TempRegister();
     return new(zone()) LStoreKeyedFixed(elements, key, val, temp);
=======================================
--- /branches/experimental/a64/src/a64/lithium-codegen-a64.cc Fri Feb 7 15:10:05 2014 UTC +++ /branches/experimental/a64/src/a64/lithium-codegen-a64.cc Fri Feb 7 16:25:45 2014 UTC
@@ -3472,7 +3472,17 @@
                                instr->hydrogen()->elements_kind());
     offset = FixedArray::OffsetOfElementAt(instr->additional_index());
   }
-  __ Ldr(result, FieldMemOperand(load_base, offset));
+  Representation representation = instr->hydrogen()->representation();
+
+  if (representation.IsInteger32() &&
+      instr->hydrogen()->elements_kind() == FAST_SMI_ELEMENTS) {
+    STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0);
+    __ Load(result, UntagSmiFieldMemOperand(load_base, offset),
+            Representation::Integer32());
+  } else {
+    __ Load(result, FieldMemOperand(load_base, offset),
+            representation);
+  }

   if (instr->hydrogen()->RequiresHoleCheck()) {
     if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
@@ -3526,6 +3536,7 @@
   if (access.representation().IsSmi() &&
       instr->hydrogen()->representation().IsInteger32()) {
     // Read int value directly from upper half of the smi.
+    STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0);
     __ Load(result, UntagSmiFieldMemOperand(source, offset),
             Representation::Integer32());
   } else {
@@ -4914,7 +4925,16 @@
                                instr->hydrogen()->elements_kind());
     offset = FixedArray::OffsetOfElementAt(instr->additional_index());
   }
-  __ Str(value, FieldMemOperand(store_base, offset));
+ Representation representation = instr->hydrogen()->value()->representation();
+  if (representation.IsInteger32()) {
+    ASSERT(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY);
+    ASSERT(instr->hydrogen()->elements_kind() == FAST_SMI_ELEMENTS);
+    STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0);
+    __ Store(value, UntagSmiFieldMemOperand(store_base, offset),
+             Representation::Integer32());
+  } else {
+    __ Store(value, FieldMemOperand(store_base, offset), representation);
+  }

   if (instr->hydrogen()->NeedsWriteBarrier()) {
     SmiCheck check_needed =
@@ -5003,7 +5023,16 @@
     __ Ldr(temp0, FieldMemOperand(object, JSObject::kPropertiesOffset));
     destination = temp0;
   }
-  __ Store(value, FieldMemOperand(destination, offset), representation);
+
+  if (representation.IsSmi() &&
+      instr->hydrogen()->value()->representation().IsInteger32()) {
+    ASSERT(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY);
+    STATIC_ASSERT(kSmiValueSize == 32 && kSmiShift == 32 && kSmiTag == 0);
+    __ Store(value, UntagSmiFieldMemOperand(destination, offset),
+             Representation::Integer32());
+  } else {
+    __ Store(value, FieldMemOperand(destination, offset), representation);
+  }
   if (instr->hydrogen()->NeedsWriteBarrier()) {
     __ RecordWriteField(destination,
                         offset,

--
--
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