summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.h
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-10-31 14:24:05 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-10-31 14:24:06 +0000
commita9014f977ae90373f5bad4cf812c2bda810b10f8 (patch)
tree40f4bc76cb5e7cf9c95fced70b1ad5c2c2d39f4e /compiler/optimizing/nodes.h
parent8b557af85871e5086589afd2b3a17089d0f67df8 (diff)
parentb5f62b3dc5ac2731ba8ad53cdf3d9bdb14fbf86b (diff)
Merge "Support for CONST_STRING in optimizing compiler."
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r--compiler/optimizing/nodes.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 86c36b8313..33bfe19081 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -489,10 +489,11 @@ class HBasicBlock : public ArenaObject {
M(IntConstant, Constant) \
M(InvokeStatic, Invoke) \
M(InvokeVirtual, Invoke) \
- M(LoadClass, Instruction) \
M(LessThan, Condition) \
M(LessThanOrEqual, Condition) \
+ M(LoadClass, Instruction) \
M(LoadLocal, Instruction) \
+ M(LoadString, Instruction) \
M(Local, Instruction) \
M(LongConstant, Constant) \
M(Mul, BinaryOperation) \
@@ -2022,7 +2023,8 @@ class HSuspendCheck : public HTemplateInstruction<0> {
};
// TODO: Make this class handle the case the load is null (dex cache
-// is null).
+// is null). This will be required when using it for other things than
+// initialization check.
/**
* Instruction to load a Class object.
*/
@@ -2064,6 +2066,34 @@ class HLoadClass : public HExpression<0> {
DISALLOW_COPY_AND_ASSIGN(HLoadClass);
};
+class HLoadString : public HExpression<0> {
+ public:
+ HLoadString(uint32_t string_index, uint32_t dex_pc)
+ : HExpression(Primitive::kPrimNot, SideEffects::None()),
+ string_index_(string_index),
+ dex_pc_(dex_pc) {}
+
+ bool InstructionDataEquals(HInstruction* other) const OVERRIDE {
+ return other->AsLoadString()->string_index_ == string_index_;
+ }
+
+ size_t ComputeHashCode() const OVERRIDE { return string_index_; }
+
+ uint32_t GetDexPc() const { return dex_pc_; }
+ uint32_t GetStringIndex() const { return string_index_; }
+
+ // TODO: Can we deopt or debug when we resolve a string?
+ bool NeedsEnvironment() const OVERRIDE { return false; }
+
+ DECLARE_INSTRUCTION(LoadString);
+
+ private:
+ const uint32_t string_index_;
+ const uint32_t dex_pc_;
+
+ DISALLOW_COPY_AND_ASSIGN(HLoadString);
+};
+
// TODO: Pass this check to HInvokeStatic nodes.
/**
* Performs an initialization check on its Class object input.