Revision: 23677
Author:   [email protected]
Date:     Thu Sep  4 09:37:25 2014 UTC
Log:      [turbofan] Make sure Operator is really immutable.

Make Operator const-correct in preparation for allocating sharing
Operators across different isolates (using LazyInstance).

TEST=cctest,compiler-unittests,mjsunit
[email protected]

Review URL: https://codereview.chromium.org/539933002
https://code.google.com/p/v8/source/detail?r=23677

Modified:
 /branches/bleeding_edge/src/compiler/common-operator.h
 /branches/bleeding_edge/src/compiler/graph-replay.cc
 /branches/bleeding_edge/src/compiler/graph-replay.h
 /branches/bleeding_edge/src/compiler/js-inlining.cc
 /branches/bleeding_edge/src/compiler/node-matchers.h
 /branches/bleeding_edge/src/compiler/node.h
 /branches/bleeding_edge/src/compiler/operator-properties-inl.h
 /branches/bleeding_edge/src/compiler/operator-properties.h
 /branches/bleeding_edge/src/compiler/operator.h
 /branches/bleeding_edge/src/compiler/simplified-operator.h
 /branches/bleeding_edge/src/compiler/verifier.cc
/branches/bleeding_edge/test/cctest/compiler/test-js-context-specialization.cc

=======================================
--- /branches/bleeding_edge/src/compiler/common-operator.h Wed Sep 3 10:13:21 2014 UTC +++ /branches/bleeding_edge/src/compiler/common-operator.h Thu Sep 4 09:37:25 2014 UTC
@@ -191,37 +191,37 @@
 template <typename T>
 struct CommonOperatorTraits {
   static inline bool Equals(T a, T b);
-  static inline bool HasValue(Operator* op);
-  static inline T ValueOf(Operator* op);
+  static inline bool HasValue(const Operator* op);
+  static inline T ValueOf(const Operator* op);
 };

 template <>
 struct CommonOperatorTraits<int32_t> {
   static inline bool Equals(int32_t a, int32_t b) { return a == b; }
-  static inline bool HasValue(Operator* op) {
+  static inline bool HasValue(const Operator* op) {
     return op->opcode() == IrOpcode::kInt32Constant ||
            op->opcode() == IrOpcode::kNumberConstant;
   }
-  static inline int32_t ValueOf(Operator* op) {
+  static inline int32_t ValueOf(const Operator* op) {
     if (op->opcode() == IrOpcode::kNumberConstant) {
       // TODO(titzer): cache the converted int32 value in NumberConstant.
- return FastD2I(reinterpret_cast<Operator1<double>*>(op)->parameter());
+      return FastD2I(OpParameter<double>(op));
     }
     CHECK_EQ(IrOpcode::kInt32Constant, op->opcode());
-    return static_cast<Operator1<int32_t>*>(op)->parameter();
+    return OpParameter<int32_t>(op);
   }
 };

 template <>
 struct CommonOperatorTraits<uint32_t> {
   static inline bool Equals(uint32_t a, uint32_t b) { return a == b; }
-  static inline bool HasValue(Operator* op) {
+  static inline bool HasValue(const Operator* op) {
     return CommonOperatorTraits<int32_t>::HasValue(op);
   }
-  static inline uint32_t ValueOf(Operator* op) {
+  static inline uint32_t ValueOf(const Operator* op) {
     if (op->opcode() == IrOpcode::kNumberConstant) {
       // TODO(titzer): cache the converted uint32 value in NumberConstant.
- return FastD2UI(reinterpret_cast<Operator1<double>*>(op)->parameter());
+      return FastD2UI(OpParameter<double>(op));
     }
return static_cast<uint32_t>(CommonOperatorTraits<int32_t>::ValueOf(op));
   }
@@ -230,27 +230,27 @@
 template <>
 struct CommonOperatorTraits<int64_t> {
   static inline bool Equals(int64_t a, int64_t b) { return a == b; }
-  static inline bool HasValue(Operator* op) {
+  static inline bool HasValue(const Operator* op) {
     return op->opcode() == IrOpcode::kInt32Constant ||
            op->opcode() == IrOpcode::kInt64Constant ||
            op->opcode() == IrOpcode::kNumberConstant;
   }
-  static inline int64_t ValueOf(Operator* op) {
+  static inline int64_t ValueOf(const Operator* op) {
     if (op->opcode() == IrOpcode::kInt32Constant) {
return static_cast<int64_t>(CommonOperatorTraits<int32_t>::ValueOf(op));
     }
     CHECK_EQ(IrOpcode::kInt64Constant, op->opcode());
-    return static_cast<Operator1<int64_t>*>(op)->parameter();
+    return OpParameter<int64_t>(op);
   }
 };

 template <>
 struct CommonOperatorTraits<uint64_t> {
   static inline bool Equals(uint64_t a, uint64_t b) { return a == b; }
-  static inline bool HasValue(Operator* op) {
+  static inline bool HasValue(const Operator* op) {
     return CommonOperatorTraits<int64_t>::HasValue(op);
   }
-  static inline uint64_t ValueOf(Operator* op) {
+  static inline uint64_t ValueOf(const Operator* op) {
return static_cast<uint64_t>(CommonOperatorTraits<int64_t>::ValueOf(op));
   }
 };
@@ -260,15 +260,15 @@
   static inline bool Equals(double a, double b) {
     return DoubleRepresentation(a).bits == DoubleRepresentation(b).bits;
   }
-  static inline bool HasValue(Operator* op) {
+  static inline bool HasValue(const Operator* op) {
     return op->opcode() == IrOpcode::kFloat64Constant ||
            op->opcode() == IrOpcode::kInt32Constant ||
            op->opcode() == IrOpcode::kNumberConstant;
   }
-  static inline double ValueOf(Operator* op) {
+  static inline double ValueOf(const Operator* op) {
     if (op->opcode() == IrOpcode::kFloat64Constant ||
         op->opcode() == IrOpcode::kNumberConstant) {
-      return reinterpret_cast<Operator1<double>*>(op)->parameter();
+      return OpParameter<double>(op);
     }
     return static_cast<double>(CommonOperatorTraits<int32_t>::ValueOf(op));
   }
@@ -279,43 +279,44 @@
   static inline bool Equals(ExternalReference a, ExternalReference b) {
     return a == b;
   }
-  static inline bool HasValue(Operator* op) {
+  static inline bool HasValue(const Operator* op) {
     return op->opcode() == IrOpcode::kExternalConstant;
   }
-  static inline ExternalReference ValueOf(Operator* op) {
+  static inline ExternalReference ValueOf(const Operator* op) {
     CHECK_EQ(IrOpcode::kExternalConstant, op->opcode());
-    return static_cast<Operator1<ExternalReference>*>(op)->parameter();
+    return OpParameter<ExternalReference>(op);
   }
 };

 template <typename T>
 struct CommonOperatorTraits<PrintableUnique<T> > {
-  static inline bool HasValue(Operator* op) {
+  static inline bool HasValue(const Operator* op) {
     return op->opcode() == IrOpcode::kHeapConstant;
   }
-  static inline PrintableUnique<T> ValueOf(Operator* op) {
+  static inline PrintableUnique<T> ValueOf(const Operator* op) {
     CHECK_EQ(IrOpcode::kHeapConstant, op->opcode());
-    return static_cast<Operator1<PrintableUnique<T> >*>(op)->parameter();
+    return OpParameter<PrintableUnique<T> >(op);
   }
 };

 template <typename T>
 struct CommonOperatorTraits<Handle<T> > {
-  static inline bool HasValue(Operator* op) {
+  static inline bool HasValue(const Operator* op) {
     return CommonOperatorTraits<PrintableUnique<T> >::HasValue(op);
   }
-  static inline Handle<T> ValueOf(Operator* op) {
+  static inline Handle<T> ValueOf(const Operator* op) {
     return CommonOperatorTraits<PrintableUnique<T> >::ValueOf(op).handle();
   }
 };


 template <typename T>
-inline T ValueOf(Operator* op) {
+inline T ValueOf(const Operator* op) {
   return CommonOperatorTraits<T>::ValueOf(op);
 }
-}
-}
-}  // namespace v8::internal::compiler
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8

 #endif  // V8_COMPILER_COMMON_OPERATOR_H_
=======================================
--- /branches/bleeding_edge/src/compiler/graph-replay.cc Wed Jul 30 13:54:45 2014 UTC +++ /branches/bleeding_edge/src/compiler/graph-replay.cc Thu Sep 4 09:37:25 2014 UTC
@@ -40,7 +40,7 @@
 }


-void GraphReplayPrinter::PrintReplayOpCreator(Operator* op) {
+void GraphReplayPrinter::PrintReplayOpCreator(const Operator* op) {
   IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
   const char* builder =
       IrOpcode::IsCommonOpcode(opcode) ? "common_builder" : "js_builder";
=======================================
--- /branches/bleeding_edge/src/compiler/graph-replay.h Wed Jul 30 13:54:45 2014 UTC +++ /branches/bleeding_edge/src/compiler/graph-replay.h Thu Sep 4 09:37:25 2014 UTC
@@ -5,21 +5,19 @@
 #ifndef V8_COMPILER_GRAPH_REPLAY_H_
 #define V8_COMPILER_GRAPH_REPLAY_H_

-#include "src/v8.h"
-
 #include "src/compiler/node.h"

 namespace v8 {
 namespace internal {
 namespace compiler {

+// Forward declarations.
 class Graph;
-class Operator;

// Helper class to print a full replay of a graph. This replay can be used to // materialize the same graph within a C++ unit test and hence test subsequent // optimization passes on a graph without going through the construction steps.
-class GraphReplayPrinter : public NullNodeVisitor {
+class GraphReplayPrinter FINAL : public NullNodeVisitor {
  public:
 #ifdef DEBUG
   static void PrintReplay(Graph* graph);
@@ -33,12 +31,13 @@
  private:
   GraphReplayPrinter() {}

-  static void PrintReplayOpCreator(Operator* op);
+  static void PrintReplayOpCreator(const Operator* op);

   DISALLOW_COPY_AND_ASSIGN(GraphReplayPrinter);
 };
-}
-}
-}  // namespace v8::internal::compiler
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8

 #endif  // V8_COMPILER_GRAPH_REPLAY_H_
=======================================
--- /branches/bleeding_edge/src/compiler/js-inlining.cc Thu Aug 28 12:18:25 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-inlining.cc Thu Sep 4 09:37:25 2014 UTC
@@ -184,7 +184,7 @@
     Node* use = *iter;
     switch (use->opcode()) {
       case IrOpcode::kParameter: {
- int index = 1 + static_cast<Operator1<int>*>(use->op())->parameter();
+        int index = 1 + OpParameter<int>(use->op());
         if (index < inliner_inputs && index < inlinee_context_index) {
           // There is an input from the call, and the index is a value
           // projection but not the context, so rewire the input.
=======================================
--- /branches/bleeding_edge/src/compiler/node-matchers.h Tue Sep 2 07:07:52 2014 UTC +++ /branches/bleeding_edge/src/compiler/node-matchers.h Thu Sep 4 09:37:25 2014 UTC
@@ -17,7 +17,7 @@
   explicit NodeMatcher(Node* node) : node_(node) {}

   Node* node() const { return node_; }
-  Operator* op() const { return node()->op(); }
+  const Operator* op() const { return node()->op(); }
   IrOpcode::Value opcode() const { return node()->opcode(); }

   bool HasProperty(Operator::Property property) const {
=======================================
--- /branches/bleeding_edge/src/compiler/node.h Thu Sep  4 09:22:10 2014 UTC
+++ /branches/bleeding_edge/src/compiler/node.h Thu Sep  4 09:37:25 2014 UTC
@@ -23,8 +23,8 @@

 class NodeData {
  public:
-  Operator* op() const { return op_; }
-  void set_op(Operator* op) { op_ = op; }
+  const Operator* op() const { return op_; }
+  void set_op(const Operator* op) { op_ = op; }

   IrOpcode::Value opcode() const {
     DCHECK(op_->opcode() <= IrOpcode::kLast);
@@ -34,7 +34,7 @@
   Bounds bounds() { return bounds_; }

  protected:
-  Operator* op_;
+  const Operator* op_;
   Bounds bounds_;
   explicit NodeData(Zone* zone) : bounds_(Bounds(Type::None(zone))) {}

@@ -47,12 +47,12 @@
 // during compilation, e.g. during lowering passes.  Other information that
 // needs to be associated with Nodes during compilation must be stored
 // out-of-line indexed by the Node's id.
-class Node : public GenericNode<NodeData, Node> {
+class Node FINAL : public GenericNode<NodeData, Node> {
  public:
   Node(GenericGraphBase* graph, int input_count)
       : GenericNode<NodeData, Node>(graph, input_count) {}

-  void Initialize(Operator* op) { set_op(op); }
+  void Initialize(const Operator* op) { set_op(op); }
   void Kill();

   void CollectProjections(ZoneVector<Node*>* projections);
@@ -78,20 +78,14 @@
 typedef Node::Uses::iterator UseIter;
 typedef Node::Inputs::iterator InputIter;

-// Helper to extract parameters from Operator1<*> operator.
-template <typename T>
-static inline T OpParameter(Operator* op) {
-  return reinterpret_cast<Operator1<T>*>(op)->parameter();
-}
-
-
 // Helper to extract parameters from Operator1<*> nodes.
 template <typename T>
-static inline T OpParameter(Node* node) {
+static inline T OpParameter(const Node* node) {
   return OpParameter<T>(node->op());
 }
-}
-}
-}  // namespace v8::internal::compiler
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8

 #endif  // V8_COMPILER_NODE_H_
=======================================
--- /branches/bleeding_edge/src/compiler/operator-properties-inl.h Wed Sep 3 14:10:20 2014 UTC +++ /branches/bleeding_edge/src/compiler/operator-properties-inl.h Thu Sep 4 09:37:25 2014 UTC
@@ -14,24 +14,24 @@
 namespace internal {
 namespace compiler {

-inline bool OperatorProperties::HasValueInput(Operator* op) {
+inline bool OperatorProperties::HasValueInput(const Operator* op) {
   return OperatorProperties::GetValueInputCount(op) > 0;
 }

-inline bool OperatorProperties::HasContextInput(Operator* op) {
+inline bool OperatorProperties::HasContextInput(const Operator* op) {
   IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
   return IrOpcode::IsJsOpcode(opcode);
 }

-inline bool OperatorProperties::HasEffectInput(Operator* op) {
+inline bool OperatorProperties::HasEffectInput(const Operator* op) {
   return OperatorProperties::GetEffectInputCount(op) > 0;
 }

-inline bool OperatorProperties::HasControlInput(Operator* op) {
+inline bool OperatorProperties::HasControlInput(const Operator* op) {
   return OperatorProperties::GetControlInputCount(op) > 0;
 }

-inline bool OperatorProperties::HasFrameStateInput(Operator* op) {
+inline bool OperatorProperties::HasFrameStateInput(const Operator* op) {
   if (!FLAG_turbo_deoptimization) {
     return false;
   }
@@ -40,8 +40,7 @@
     case IrOpcode::kFrameState:
       return true;
     case IrOpcode::kJSCallRuntime: {
-      Runtime::FunctionId function =
- reinterpret_cast<Operator1<Runtime::FunctionId>*>(op)->parameter();
+      Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(op);
       return Linkage::NeedsFrameState(function);
     }

@@ -85,29 +84,29 @@
   }
 }

-inline int OperatorProperties::GetValueInputCount(Operator* op) {
+inline int OperatorProperties::GetValueInputCount(const Operator* op) {
   return op->InputCount();
 }

-inline int OperatorProperties::GetContextInputCount(Operator* op) {
+inline int OperatorProperties::GetContextInputCount(const Operator* op) {
   return OperatorProperties::HasContextInput(op) ? 1 : 0;
 }

-inline int OperatorProperties::GetFrameStateInputCount(Operator* op) {
+inline int OperatorProperties::GetFrameStateInputCount(const Operator* op) {
   return OperatorProperties::HasFrameStateInput(op) ? 1 : 0;
 }

-inline int OperatorProperties::GetEffectInputCount(Operator* op) {
+inline int OperatorProperties::GetEffectInputCount(const Operator* op) {
   if (op->opcode() == IrOpcode::kEffectPhi ||
       op->opcode() == IrOpcode::kFinish) {
-    return static_cast<Operator1<int>*>(op)->parameter();
+    return OpParameter<int>(op);
   }
if (op->HasProperty(Operator::kNoRead) && op->HasProperty(Operator::kNoWrite))
     return 0;  // no effects.
   return 1;
 }

-inline int OperatorProperties::GetControlInputCount(Operator* op) {
+inline int OperatorProperties::GetControlInputCount(const Operator* op) {
   switch (op->opcode()) {
     case IrOpcode::kPhi:
     case IrOpcode::kEffectPhi:
@@ -116,7 +115,7 @@
 #define OPCODE_CASE(x) case IrOpcode::k##x:
       CONTROL_OP_LIST(OPCODE_CASE)
 #undef OPCODE_CASE
-      return static_cast<ControlOperator*>(op)->ControlInputCount();
+ return reinterpret_cast<const ControlOperator*>(op)->ControlInputCount();
     default:
       // Operators that have write effects must have a control
       // dependency. Effect dependencies only ensure the correct order of
@@ -128,7 +127,7 @@
   return 0;
 }

-inline int OperatorProperties::GetTotalInputCount(Operator* op) {
+inline int OperatorProperties::GetTotalInputCount(const Operator* op) {
   return GetValueInputCount(op) + GetContextInputCount(op) +
          GetFrameStateInputCount(op) + GetEffectInputCount(op) +
          GetControlInputCount(op);
@@ -137,38 +136,38 @@
// -----------------------------------------------------------------------------
 // Output properties.

-inline bool OperatorProperties::HasValueOutput(Operator* op) {
+inline bool OperatorProperties::HasValueOutput(const Operator* op) {
   return GetValueOutputCount(op) > 0;
 }

-inline bool OperatorProperties::HasEffectOutput(Operator* op) {
+inline bool OperatorProperties::HasEffectOutput(const Operator* op) {
   return op->opcode() == IrOpcode::kStart ||
          op->opcode() == IrOpcode::kControlEffect ||
          op->opcode() == IrOpcode::kValueEffect ||
(op->opcode() != IrOpcode::kFinish && GetEffectInputCount(op) > 0);
 }

-inline bool OperatorProperties::HasControlOutput(Operator* op) {
+inline bool OperatorProperties::HasControlOutput(const Operator* op) {
   IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
   return (opcode != IrOpcode::kEnd && IrOpcode::IsControlOpcode(opcode));
 }


-inline int OperatorProperties::GetValueOutputCount(Operator* op) {
+inline int OperatorProperties::GetValueOutputCount(const Operator* op) {
   return op->OutputCount();
 }

-inline int OperatorProperties::GetEffectOutputCount(Operator* op) {
+inline int OperatorProperties::GetEffectOutputCount(const Operator* op) {
   return HasEffectOutput(op) ? 1 : 0;
 }

-inline int OperatorProperties::GetControlOutputCount(Operator* node) {
+inline int OperatorProperties::GetControlOutputCount(const Operator* node) { return node->opcode() == IrOpcode::kBranch ? 2 : HasControlOutput(node) ? 1 : 0;
 }


-inline bool OperatorProperties::IsBasicBlockBegin(Operator* op) {
+inline bool OperatorProperties::IsBasicBlockBegin(const Operator* op) {
   uint8_t opcode = op->opcode();
   return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd ||
          opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop ||
@@ -176,8 +175,8 @@
          opcode == IrOpcode::kIfFalse;
 }

-}
-}
-}  // namespace v8::internal::compiler
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8

 #endif  // V8_COMPILER_OPERATOR_PROPERTIES_INL_H_
=======================================
--- /branches/bleeding_edge/src/compiler/operator-properties.h Mon Sep 1 09:31:14 2014 UTC +++ /branches/bleeding_edge/src/compiler/operator-properties.h Thu Sep 4 09:37:25 2014 UTC
@@ -5,8 +5,6 @@
 #ifndef V8_COMPILER_OPERATOR_PROPERTIES_H_
 #define V8_COMPILER_OPERATOR_PROPERTIES_H_

-#include "src/v8.h"
-
 namespace v8 {
 namespace internal {
 namespace compiler {
@@ -15,31 +13,32 @@

 class OperatorProperties {
  public:
-  static inline bool HasValueInput(Operator* node);
-  static inline bool HasContextInput(Operator* node);
-  static inline bool HasEffectInput(Operator* node);
-  static inline bool HasControlInput(Operator* node);
-  static inline bool HasFrameStateInput(Operator* node);
+  static inline bool HasValueInput(const Operator* op);
+  static inline bool HasContextInput(const Operator* op);
+  static inline bool HasEffectInput(const Operator* op);
+  static inline bool HasControlInput(const Operator* op);
+  static inline bool HasFrameStateInput(const Operator* op);

-  static inline int GetValueInputCount(Operator* op);
-  static inline int GetContextInputCount(Operator* op);
-  static inline int GetEffectInputCount(Operator* op);
-  static inline int GetControlInputCount(Operator* op);
-  static inline int GetFrameStateInputCount(Operator* op);
-  static inline int GetTotalInputCount(Operator* op);
+  static inline int GetValueInputCount(const Operator* op);
+  static inline int GetContextInputCount(const Operator* op);
+  static inline int GetEffectInputCount(const Operator* op);
+  static inline int GetControlInputCount(const Operator* op);
+  static inline int GetFrameStateInputCount(const Operator* op);
+  static inline int GetTotalInputCount(const Operator* op);

-  static inline bool HasValueOutput(Operator* op);
-  static inline bool HasEffectOutput(Operator* op);
-  static inline bool HasControlOutput(Operator* op);
+  static inline bool HasValueOutput(const Operator* op);
+  static inline bool HasEffectOutput(const Operator* op);
+  static inline bool HasControlOutput(const Operator* op);

-  static inline int GetValueOutputCount(Operator* op);
-  static inline int GetEffectOutputCount(Operator* op);
-  static inline int GetControlOutputCount(Operator* op);
+  static inline int GetValueOutputCount(const Operator* op);
+  static inline int GetEffectOutputCount(const Operator* op);
+  static inline int GetControlOutputCount(const Operator* op);

-  static inline bool IsBasicBlockBegin(Operator* op);
+  static inline bool IsBasicBlockBegin(const Operator* op);
 };
-}
-}
-}  // namespace v8::internal::compiler
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8

 #endif  // V8_COMPILER_OPERATOR_PROPERTIES_H_
=======================================
--- /branches/bleeding_edge/src/compiler/operator.h Tue Sep 2 11:36:55 2014 UTC +++ /branches/bleeding_edge/src/compiler/operator.h Thu Sep 4 09:37:25 2014 UTC
@@ -268,6 +268,13 @@

 // Type definitions for operators with specific types of parameters.
 typedef Operator1<PrintableUnique<Name> > NameOperator;
+
+
+// Helper to extract parameters from Operator1<*> operator.
+template <typename T>
+static inline T OpParameter(const Operator* op) {
+  return reinterpret_cast<const Operator1<T>*>(op)->parameter();
+}

 }  // namespace compiler
 }  // namespace internal
=======================================
--- /branches/bleeding_edge/src/compiler/simplified-operator.h Tue Sep 2 11:36:55 2014 UTC +++ /branches/bleeding_edge/src/compiler/simplified-operator.h Thu Sep 4 09:37:25 2014 UTC
@@ -81,17 +81,17 @@
 };


-inline const FieldAccess FieldAccessOf(Operator* op) {
+inline const FieldAccess FieldAccessOf(const Operator* op) {
   DCHECK(op->opcode() == IrOpcode::kLoadField ||
          op->opcode() == IrOpcode::kStoreField);
-  return static_cast<Operator1<FieldAccess>*>(op)->parameter();
+  return OpParameter<FieldAccess>(op);
 }


-inline const ElementAccess ElementAccessOf(Operator* op) {
+inline const ElementAccess ElementAccessOf(const Operator* op) {
   DCHECK(op->opcode() == IrOpcode::kLoadElement ||
          op->opcode() == IrOpcode::kStoreElement);
-  return static_cast<Operator1<ElementAccess>*>(op)->parameter();
+  return OpParameter<ElementAccess>(op);
 }


=======================================
--- /branches/bleeding_edge/src/compiler/verifier.cc Wed Sep 3 14:10:20 2014 UTC +++ /branches/bleeding_edge/src/compiler/verifier.cc Thu Sep 4 09:37:25 2014 UTC
@@ -174,7 +174,7 @@
       CHECK_EQ(IrOpcode::kStart,
                NodeProperties::GetValueInput(node, 0)->opcode());
       // Parameter has an input that produces enough values.
-      int index = static_cast<Operator1<int>*>(node->op())->parameter();
+      int index = OpParameter<int>(node);
       Node* input = NodeProperties::GetValueInput(node, 0);
       // Currently, parameter indices start at -1 instead of 0.
CHECK_GT(OperatorProperties::GetValueOutputCount(input->op()), index + 1);
@@ -213,7 +213,7 @@
       break;
     case IrOpcode::kProjection: {
       // Projection has an input that produces enough values.
-      int index = static_cast<Operator1<int>*>(node->op())->parameter();
+      int index = OpParameter<int>(node);
       Node* input = NodeProperties::GetValueInput(node, 0);
CHECK_GT(OperatorProperties::GetValueOutputCount(input->op()), index);
       break;
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/test-js-context-specialization.cc Fri Aug 8 11:05:31 2014 UTC +++ /branches/bleeding_edge/test/cctest/compiler/test-js-context-specialization.cc Thu Sep 4 09:37:25 2014 UTC
@@ -95,8 +95,7 @@
     CHECK_EQ(IrOpcode::kHeapConstant, new_context_input->opcode());
     ValueMatcher<Handle<Context> > match(new_context_input);
     CHECK_EQ(*native, *match.Value());
-    ContextAccess access = static_cast<Operator1<ContextAccess>*>(
-                               r.replacement()->op())->parameter();
+    ContextAccess access = OpParameter<ContextAccess>(r.replacement());
     CHECK_EQ(Context::GLOBAL_EVAL_FUN_INDEX, access.index());
     CHECK_EQ(0, access.depth());
     CHECK_EQ(false, access.immutable());
@@ -176,8 +175,7 @@
     CHECK_EQ(IrOpcode::kHeapConstant, new_context_input->opcode());
     ValueMatcher<Handle<Context> > match(new_context_input);
     CHECK_EQ(*native, *match.Value());
-    ContextAccess access = static_cast<Operator1<ContextAccess>*>(
-                               r.replacement()->op())->parameter();
+    ContextAccess access = OpParameter<ContextAccess>(r.replacement());
     CHECK_EQ(Context::GLOBAL_EVAL_FUN_INDEX, access.index());
     CHECK_EQ(0, access.depth());
     CHECK_EQ(false, access.immutable());

--
--
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/d/optout.

Reply via email to