From 9fdb31e12023d94c710a766a54d8a57c91a196f9 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Wed, 1 Jul 2015 12:56:46 +0100 Subject: Do not do a type check when setting null to an array. Change-Id: I7387d45aea697d4a3de273335647220a815a992b --- compiler/optimizing/code_generator_x86.cc | 4 ++-- compiler/optimizing/instruction_simplifier.cc | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'compiler/optimizing') 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(), 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(); } -- cgit v1.2.3-59-g8ed1b