Reviewers: danno,

Description:
Use a fixed input register where we require a byte register.

Currently we can't specify a set of registers as a register constraint.
This change forces a fixed register (eax) in places that need
a byte register.

BUG=77752

Please review this at http://codereview.chromium.org/6708109/

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

Affected files:
  M     src/ia32/lithium-ia32.cc
  M     src/x64/lithium-x64.cc


Index: src/ia32/lithium-ia32.cc
===================================================================
--- src/ia32/lithium-ia32.cc    (revision 7408)
+++ src/ia32/lithium-ia32.cc    (working copy)
@@ -1905,7 +1905,6 @@
   ASSERT(instr->key()->representation().IsInteger32());

   LOperand* external_pointer = UseRegister(instr->external_pointer());
-  LOperand* val = UseRegister(instr->value());
   LOperand* key = UseRegister(instr->key());
   LOperand* temp = NULL;

@@ -1916,6 +1915,15 @@
     temp = FixedTemp(eax);
   }

+  LOperand* val = NULL;
+  if (array_type == kExternalByteArray ||
+      array_type == kExternalUnsignedByteArray) {
+    // We need a byte register in this case for the value.
+    val = UseFixed(instr->value(), eax);
+  } else {
+    val = UseRegister(instr->value());
+  }
+
   return new LStoreKeyedSpecializedArrayElement(external_pointer,
                                                 key,
                                                 val,
Index: src/x64/lithium-x64.cc
===================================================================
--- src/x64/lithium-x64.cc      (revision 7402)
+++ src/x64/lithium-x64.cc      (working copy)
@@ -1873,11 +1873,22 @@
   ASSERT(instr->key()->representation().IsInteger32());

   LOperand* external_pointer = UseRegister(instr->external_pointer());
-  bool val_is_temp_register = array_type == kExternalPixelArray ||
-      array_type == kExternalFloatArray;
-  LOperand* val = val_is_temp_register
-      ? UseTempRegister(instr->value())
-      : UseRegister(instr->key());
+  LOperand* val = NULL;
+  switch (array_type) {
+    case kExternalPixelArray:
+    case kExternalByteArray:
+    case kExternalUnsignedByteArray:
+      // We need a byte register in these cases.
+      val = UseFixed(instr->value(), rax);
+      break;
+    case kExternalFloatArray:
+      // We need a writable register here.
+      val = UseTempRegister(instr->value());
+      break;
+    default:
+      val = UseRegister(instr->value());
+      break;
+  }
   LOperand* key = UseRegister(instr->key());

   return new LStoreKeyedSpecializedArrayElement(external_pointer,


--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to