Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / v8 / src / compiler / instruction-selector-impl.h
index ac446b3..d00109e 100644 (file)
@@ -25,11 +25,6 @@ class OperandGenerator {
                   UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER));
   }
 
-  InstructionOperand* DefineAsDoubleRegister(Node* node) {
-    return Define(node, new (zone())
-                  UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER));
-  }
-
   InstructionOperand* DefineSameAsFirst(Node* result) {
     return Define(result, new (zone())
                   UnallocatedOperand(UnallocatedOperand::SAME_AS_FIRST_INPUT));
@@ -41,7 +36,7 @@ class OperandGenerator {
                                      Register::ToAllocationIndex(reg)));
   }
 
-  InstructionOperand* DefineAsFixedDouble(Node* node, DoubleRegister reg) {
+  InstructionOperand* DefineAsFixed(Node* node, DoubleRegister reg) {
     return Define(node, new (zone())
                   UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER,
                                      DoubleRegister::ToAllocationIndex(reg)));
@@ -53,8 +48,9 @@ class OperandGenerator {
     return ConstantOperand::Create(node->id(), zone());
   }
 
-  InstructionOperand* DefineAsLocation(Node* node, LinkageLocation location) {
-    return Define(node, ToUnallocatedOperand(location));
+  InstructionOperand* DefineAsLocation(Node* node, LinkageLocation location,
+                                       MachineType type) {
+    return Define(node, ToUnallocatedOperand(location, type));
   }
 
   InstructionOperand* Use(Node* node) {
@@ -69,12 +65,6 @@ class OperandGenerator {
                                   UnallocatedOperand::USED_AT_START));
   }
 
-  InstructionOperand* UseDoubleRegister(Node* node) {
-    return Use(node, new (zone())
-               UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER,
-                                  UnallocatedOperand::USED_AT_START));
-  }
-
   // Use register or operand for the node. If a register is chosen, it won't
   // alias any temporary or output registers.
   InstructionOperand* UseUnique(Node* node) {
@@ -88,20 +78,13 @@ class OperandGenerator {
                UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER));
   }
 
-  // Use a unique double register for the node that does not alias any temporary
-  // or output double registers.
-  InstructionOperand* UseUniqueDoubleRegister(Node* node) {
-    return Use(node, new (zone())
-               UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER));
-  }
-
   InstructionOperand* UseFixed(Node* node, Register reg) {
     return Use(node, new (zone())
                UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER,
                                   Register::ToAllocationIndex(reg)));
   }
 
-  InstructionOperand* UseFixedDouble(Node* node, DoubleRegister reg) {
+  InstructionOperand* UseFixed(Node* node, DoubleRegister reg) {
     return Use(node, new (zone())
                UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER,
                                   DoubleRegister::ToAllocationIndex(reg)));
@@ -112,8 +95,9 @@ class OperandGenerator {
     return ImmediateOperand::Create(index, zone());
   }
 
-  InstructionOperand* UseLocation(Node* node, LinkageLocation location) {
-    return Use(node, ToUnallocatedOperand(location));
+  InstructionOperand* UseLocation(Node* node, LinkageLocation location,
+                                  MachineType type) {
+    return Use(node, ToUnallocatedOperand(location, type));
   }
 
   InstructionOperand* TempRegister() {
@@ -159,16 +143,16 @@ class OperandGenerator {
   static Constant ToConstant(const Node* node) {
     switch (node->opcode()) {
       case IrOpcode::kInt32Constant:
-        return Constant(ValueOf<int32_t>(node->op()));
+        return Constant(OpParameter<int32_t>(node));
       case IrOpcode::kInt64Constant:
-        return Constant(ValueOf<int64_t>(node->op()));
+        return Constant(OpParameter<int64_t>(node));
       case IrOpcode::kNumberConstant:
       case IrOpcode::kFloat64Constant:
-        return Constant(ValueOf<double>(node->op()));
+        return Constant(OpParameter<double>(node));
       case IrOpcode::kExternalConstant:
-        return Constant(ValueOf<ExternalReference>(node->op()));
+        return Constant(OpParameter<ExternalReference>(node));
       case IrOpcode::kHeapConstant:
-        return Constant(ValueOf<Handle<HeapObject> >(node->op()));
+        return Constant(OpParameter<Unique<HeapObject> >(node).handle());
       default:
         break;
     }
@@ -192,7 +176,8 @@ class OperandGenerator {
     return operand;
   }
 
-  UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location) {
+  UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location,
+                                           MachineType type) {
     if (location.location_ == LinkageLocation::ANY_REGISTER) {
       return new (zone())
           UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER);
@@ -201,7 +186,7 @@ class OperandGenerator {
       return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_SLOT,
                                              location.location_);
     }
-    if (location.rep_ == kMachineFloat64) {
+    if (RepresentationOf(type) == kRepFloat64) {
       return new (zone()) UnallocatedOperand(
           UnallocatedOperand::FIXED_DOUBLE_REGISTER, location.location_);
     }
@@ -218,7 +203,7 @@ class OperandGenerator {
 // The whole instruction is treated as a unit by the register allocator, and
 // thus no spills or moves can be introduced between the flags-setting
 // instruction and the branch or set it should be combined with.
-class FlagsContinuation V8_FINAL {
+class FlagsContinuation FINAL {
  public:
   FlagsContinuation() : mode_(kFlags_none) {}
 
@@ -346,22 +331,26 @@ class FlagsContinuation V8_FINAL {
 // TODO(bmeurer): Get rid of the CallBuffer business and make
 // InstructionSelector::VisitCall platform independent instead.
 struct CallBuffer {
-  CallBuffer(Zone* zone, CallDescriptor* descriptor);
+  CallBuffer(Zone* zone, CallDescriptor* descriptor,
+             FrameStateDescriptor* frame_state);
 
-  int output_count;
   CallDescriptor* descriptor;
-  Node** output_nodes;
-  InstructionOperand** outputs;
-  InstructionOperand** fixed_and_control_args;
-  int fixed_count;
-  Node** pushed_nodes;
-  int pushed_count;
+  FrameStateDescriptor* frame_state_descriptor;
+  NodeVector output_nodes;
+  InstructionOperandVector outputs;
+  InstructionOperandVector instruction_args;
+  NodeVector pushed_nodes;
 
-  int input_count() { return descriptor->InputCount(); }
+  size_t input_count() const { return descriptor->InputCount(); }
 
-  int control_count() { return descriptor->CanLazilyDeoptimize() ? 2 : 0; }
+  size_t frame_state_count() const { return descriptor->FrameStateCount(); }
 
-  int fixed_and_control_count() { return fixed_count + control_count(); }
+  size_t frame_state_value_count() const {
+    return (frame_state_descriptor == NULL)
+               ? 0
+               : (frame_state_descriptor->GetTotalSize() +
+                  1);  // Include deopt id.
+  }
 };
 
 }  // namespace compiler