Implement array creation related DEX instructions.
Implement new-array, filled-new-array, and fill-array-data.
Change-Id: I405560d66777a57d881e384265322617ac5d3ce3
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 7c933aa..9b7ff88 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -507,6 +507,7 @@
M(Neg, UnaryOperation) \
M(FloatConstant, Constant) \
M(DoubleConstant, Constant) \
+ M(NewArray, Instruction) \
#define FOR_EACH_INSTRUCTION(M) \
FOR_EACH_CONCRETE_INSTRUCTION(M) \
@@ -1608,6 +1609,30 @@
DISALLOW_COPY_AND_ASSIGN(HNeg);
};
+class HNewArray : public HExpression<1> {
+ public:
+ HNewArray(HInstruction* length, uint32_t dex_pc, uint16_t type_index)
+ : HExpression(Primitive::kPrimNot, SideEffects::None()),
+ dex_pc_(dex_pc),
+ type_index_(type_index) {
+ SetRawInputAt(0, length);
+ }
+
+ uint32_t GetDexPc() const { return dex_pc_; }
+ uint16_t GetTypeIndex() const { return type_index_; }
+
+ // Calls runtime so needs an environment.
+ virtual bool NeedsEnvironment() const { return true; }
+
+ DECLARE_INSTRUCTION(NewArray);
+
+ private:
+ const uint32_t dex_pc_;
+ const uint16_t type_index_;
+
+ DISALLOW_COPY_AND_ASSIGN(HNewArray);
+};
+
class HAdd : public HBinaryOperation {
public:
HAdd(Primitive::Type result_type, HInstruction* left, HInstruction* right)