Revision: 6349
Author: [email protected]
Date: Mon Jan 17 04:54:52 2011
Log: Add UseAny to create a LOperand without register preference.

The result can be a register, a stack slot or a constant operand.

Right now it is only used for enviroment uses.

Review URL: http://codereview.chromium.org/6348003
http://code.google.com/p/v8/source/detail?r=6349

Modified:
 /branches/bleeding_edge/src/arm/lithium-arm.cc
 /branches/bleeding_edge/src/arm/lithium-arm.h
 /branches/bleeding_edge/src/ia32/lithium-ia32.cc
 /branches/bleeding_edge/src/ia32/lithium-ia32.h
 /branches/bleeding_edge/src/x64/lithium-x64.cc
 /branches/bleeding_edge/src/x64/lithium-x64.h

=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc      Mon Jan 17 00:11:03 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc      Mon Jan 17 04:54:52 2011
@@ -574,6 +574,13 @@
       ? chunk_->DefineConstantOperand(HConstant::cast(value))
       : UseRegisterAtStart(value);
 }
+
+
+LOperand* LChunkBuilder::UseAny(HValue* value) {
+  return value->IsConstant()
+      ? chunk_->DefineConstantOperand(HConstant::cast(value))
+      :  Use(value, new LUnallocated(LUnallocated::ANY));
+}


 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) {
@@ -907,11 +914,7 @@
     } else if (value->IsPushArgument()) {
       op = new LArgument(argument_index++);
     } else {
-      op = UseOrConstant(value);
-      if (op->IsUnallocated()) {
-        LUnallocated* unalloc = LUnallocated::cast(op);
-        unalloc->set_policy(LUnallocated::ANY);
-      }
+      op = UseAny(value);
     }
     result->AddValue(op, value->representation());
   }
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h       Mon Jan 17 00:11:03 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.h       Mon Jan 17 04:54:52 2011
@@ -1887,15 +1887,25 @@
   LOperand* UseRegister(HValue* value);
   LOperand* UseRegisterAtStart(HValue* value);

-  // A value in a register that may be trashed.
+  // An input operand in a register that may be trashed.
   LOperand* UseTempRegister(HValue* value);
+
+  // An input operand in a register or stack slot.
   LOperand* Use(HValue* value);
   LOperand* UseAtStart(HValue* value);
+
+  // An input operand in a register, stack slot or a constant operand.
   LOperand* UseOrConstant(HValue* value);
   LOperand* UseOrConstantAtStart(HValue* value);
+
+  // An input operand in a register or a constant operand.
   LOperand* UseRegisterOrConstant(HValue* value);
   LOperand* UseRegisterOrConstantAtStart(HValue* value);

+  // An input operand in register, stack slot or a constant operand.
+  // Will not be moved to a register even if one is freely available.
+  LOperand* UseAny(HValue* value);
+
   // Methods for setting up define-use relationships.
   // Return the same instruction that they are passed.
   LInstruction* Define(LInstruction* instr, LUnallocated* result);
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Mon Jan 17 04:22:31 2011 +++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Mon Jan 17 04:54:52 2011
@@ -572,6 +572,13 @@
       ? chunk_->DefineConstantOperand(HConstant::cast(value))
       : UseRegisterAtStart(value);
 }
+
+
+LOperand* LChunkBuilder::UseAny(HValue* value) {
+  return value->IsConstant()
+      ? chunk_->DefineConstantOperand(HConstant::cast(value))
+      :  Use(value, new LUnallocated(LUnallocated::ANY));
+}


 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) {
@@ -934,11 +941,7 @@
     } else if (value->IsPushArgument()) {
       op = new LArgument(argument_index++);
     } else {
-      op = UseOrConstant(value);
-      if (op->IsUnallocated()) {
-        LUnallocated* unalloc = LUnallocated::cast(op);
-        unalloc->set_policy(LUnallocated::ANY);
-      }
+      op = UseAny(value);
     }
     result->AddValue(op, value->representation());
   }
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h     Mon Jan 17 04:22:31 2011
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h     Mon Jan 17 04:54:52 2011
@@ -1897,15 +1897,25 @@
   MUST_USE_RESULT LOperand* UseRegister(HValue* value);
   MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);

-  // A value in a register that may be trashed.
+  // An input operand in a register that may be trashed.
   MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
+
+  // An input operand in a register or stack slot.
   MUST_USE_RESULT LOperand* Use(HValue* value);
   MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
+
+  // An input operand in a register, stack slot or a constant operand.
   MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
   MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
+
+  // An input operand in a register or a constant operand.
   MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
   MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);

+  // An input operand in register, stack slot or a constant operand.
+  // Will not be moved to a register even if one is freely available.
+  MUST_USE_RESULT LOperand* UseAny(HValue* value);
+
   // Temporary operand that must be in a register.
   MUST_USE_RESULT LUnallocated* TempRegister();
   MUST_USE_RESULT LOperand* FixedTemp(Register reg);
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc      Mon Jan 17 00:11:03 2011
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc      Mon Jan 17 04:54:52 2011
@@ -569,6 +569,13 @@
       ? chunk_->DefineConstantOperand(HConstant::cast(value))
       : UseRegisterAtStart(value);
 }
+
+
+LOperand* LChunkBuilder::UseAny(HValue* value) {
+  return value->IsConstant()
+      ? chunk_->DefineConstantOperand(HConstant::cast(value))
+      :  Use(value, new LUnallocated(LUnallocated::ANY));
+}


 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) {
@@ -863,11 +870,7 @@
     } else if (value->IsPushArgument()) {
       op = new LArgument(argument_index++);
     } else {
-      op = UseOrConstant(value);
-      if (op->IsUnallocated()) {
-        LUnallocated* unalloc = LUnallocated::cast(op);
-        unalloc->set_policy(LUnallocated::ANY);
-      }
+      op = UseAny(value);
     }
     result->AddValue(op, value->representation());
   }
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h       Mon Jan 17 00:11:03 2011
+++ /branches/bleeding_edge/src/x64/lithium-x64.h       Mon Jan 17 04:54:52 2011
@@ -1969,15 +1969,25 @@
   LOperand* UseRegister(HValue* value);
   LOperand* UseRegisterAtStart(HValue* value);

-  // A value in a register that may be trashed.
+  // An operand value in a register that may be trashed.
   LOperand* UseTempRegister(HValue* value);
+
+  // An operand value in a register or stack slot.
   LOperand* Use(HValue* value);
   LOperand* UseAtStart(HValue* value);
+
+  // An operand value in a register, stack slot or a constant operand.
   LOperand* UseOrConstant(HValue* value);
   LOperand* UseOrConstantAtStart(HValue* value);
+
+  // An operand value in a register or a constant operand.
   LOperand* UseRegisterOrConstant(HValue* value);
   LOperand* UseRegisterOrConstantAtStart(HValue* value);

+  // An operand value in register, stack slot or a constant operand.
+  // Will not be moved to a register even if one is freely available.
+  LOperand* UseAny(HValue* value);
+
   // Methods for setting up define-use relationships.
   // Return the same instruction that they are passed.
   template<int I, int T>

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

Reply via email to