summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.h
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r--compiler/optimizing/nodes.h32
1 files changed, 30 insertions, 2 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 486968cf9e..d52f5927de 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -1644,17 +1644,34 @@ class ReferenceTypeInfo : ValueObject {
bool IsValid() const SHARED_REQUIRES(Locks::mutator_lock_) {
return IsValidHandle(type_handle_);
}
+
bool IsExact() const { return is_exact_; }
bool IsObjectClass() const SHARED_REQUIRES(Locks::mutator_lock_) {
DCHECK(IsValid());
return GetTypeHandle()->IsObjectClass();
}
+
+ bool IsObjectArray() const SHARED_REQUIRES(Locks::mutator_lock_) {
+ DCHECK(IsValid());
+ return IsArrayClass() && GetTypeHandle()->GetComponentType()->IsObjectClass();
+ }
+
bool IsInterface() const SHARED_REQUIRES(Locks::mutator_lock_) {
DCHECK(IsValid());
return GetTypeHandle()->IsInterface();
}
+ bool IsArrayClass() const SHARED_REQUIRES(Locks::mutator_lock_) {
+ return GetTypeHandle()->IsArrayClass();
+ }
+
+ bool CanArrayHold(ReferenceTypeInfo rti) const SHARED_REQUIRES(Locks::mutator_lock_) {
+ if (!IsExact()) return false;
+ if (!IsArrayClass()) return false;
+ return GetTypeHandle()->GetComponentType()->IsAssignableFrom(rti.GetTypeHandle().Get());
+ }
+
Handle<mirror::Class> GetTypeHandle() const { return type_handle_; }
bool IsSupertypeOf(ReferenceTypeInfo rti) const SHARED_REQUIRES(Locks::mutator_lock_) {
@@ -2222,7 +2239,9 @@ class HIntConstant : public HConstant {
public:
int32_t GetValue() const { return value_; }
- uint64_t GetValueAsUint64() const OVERRIDE { return static_cast<uint64_t>(value_); }
+ uint64_t GetValueAsUint64() const OVERRIDE {
+ return static_cast<uint64_t>(static_cast<uint32_t>(value_));
+ }
bool InstructionDataEquals(HInstruction* other) const OVERRIDE {
DCHECK(other->IsIntConstant());
@@ -4312,7 +4331,8 @@ class HArraySet : public HTemplateInstruction<3> {
SideEffectsForArchRuntimeCalls(value->GetType())), dex_pc),
expected_component_type_(expected_component_type),
needs_type_check_(value->GetType() == Primitive::kPrimNot),
- value_can_be_null_(true) {
+ value_can_be_null_(true),
+ static_type_of_array_is_object_array_(false) {
SetRawInputAt(0, array);
SetRawInputAt(1, index);
SetRawInputAt(2, value);
@@ -4341,8 +4361,13 @@ class HArraySet : public HTemplateInstruction<3> {
value_can_be_null_ = false;
}
+ void SetStaticTypeOfArrayIsObjectArray() {
+ static_type_of_array_is_object_array_ = true;
+ }
+
bool GetValueCanBeNull() const { return value_can_be_null_; }
bool NeedsTypeCheck() const { return needs_type_check_; }
+ bool StaticTypeOfArrayIsObjectArray() const { return static_type_of_array_is_object_array_; }
HInstruction* GetArray() const { return InputAt(0); }
HInstruction* GetIndex() const { return InputAt(1); }
@@ -4369,6 +4394,9 @@ class HArraySet : public HTemplateInstruction<3> {
const Primitive::Type expected_component_type_;
bool needs_type_check_;
bool value_can_be_null_;
+ // Cached information for the reference_type_info_ so that codegen
+ // does not need to inspect the static type.
+ bool static_type_of_array_is_object_array_;
DISALLOW_COPY_AND_ASSIGN(HArraySet);
};