summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2015-07-01 12:56:46 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2015-07-01 13:54:32 +0100
commit9fdb31e12023d94c710a766a54d8a57c91a196f9 (patch)
tree22be0afa06ceca65cb4d1ed457c0ea720845e9a4 /compiler/optimizing
parent3b0667c1d68ba88c71b031757b757dca659afd69 (diff)
Do not do a type check when setting null to an array.
Change-Id: I7387d45aea697d4a3de273335647220a815a992b
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/code_generator_x86.cc4
-rw-r--r--compiler/optimizing/instruction_simplifier.cc4
2 files changed, 6 insertions, 2 deletions
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index 6c82fe99c7..931d751db0 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -3856,7 +3856,7 @@ void InstructionCodeGeneratorX86::VisitArraySet(HArraySet* instruction) {
} else {
DCHECK(value.IsConstant()) << value;
__ movl(Address(obj, offset),
- Immediate(value.GetConstant()->AsIntConstant()->GetValue()));
+ Immediate(CodeGenerator::GetInt32ValueOf(value.GetConstant())));
}
} else {
DCHECK(index.IsRegister()) << index;
@@ -3866,7 +3866,7 @@ void InstructionCodeGeneratorX86::VisitArraySet(HArraySet* instruction) {
} else {
DCHECK(value.IsConstant()) << value;
__ movl(Address(obj, index.AsRegister<Register>(), TIMES_4, data_offset),
- Immediate(value.GetConstant()->AsIntConstant()->GetValue()));
+ Immediate(CodeGenerator::GetInt32ValueOf(value.GetConstant())));
}
}
codegen_->MaybeRecordImplicitNullCheck(instruction);
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc
index e375f7b1d3..62f90c2f5e 100644
--- a/compiler/optimizing/instruction_simplifier.cc
+++ b/compiler/optimizing/instruction_simplifier.cc
@@ -398,6 +398,10 @@ void InstructionSimplifierVisitor::VisitArraySet(HArraySet* instruction) {
}
}
+ if (value->IsNullConstant()) {
+ instruction->ClearNeedsTypeCheck();
+ }
+
if (!value->CanBeNull()) {
instruction->ClearValueCanBeNull();
}