Index: src/arm/lithium-codegen-arm.cc |
=================================================================== |
--- src/arm/lithium-codegen-arm.cc (revision 9305) |
+++ src/arm/lithium-codegen-arm.cc (working copy) |
@@ -1749,25 +1749,35 @@ |
} |
-void LCodeGen::DoIsNullAndBranch(LIsNullAndBranch* instr) { |
+void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) { |
Register scratch = scratch0(); |
Register reg = ToRegister(instr->InputAt(0)); |
+ int false_block = chunk_->LookupDestination(instr->false_block_id()); |
- // TODO(fsc): If the expression is known to be a smi, then it's |
- // definitely not null. Jump to the false block. |
+ // If the expression is known to be untagged or a smi, then it's definitely |
+ // not null, and it can't be a an undetectable object. |
+ if (instr->hydrogen()->representation().IsSpecialization() || |
+ instr->hydrogen()->type().IsSmi()) { |
+ EmitGoto(false_block); |
+ return; |
+ } |
int true_block = chunk_->LookupDestination(instr->true_block_id()); |
- int false_block = chunk_->LookupDestination(instr->false_block_id()); |
- |
- __ LoadRoot(ip, Heap::kNullValueRootIndex); |
+ Heap::RootListIndex nil_value = instr->nil() == kNullValue ? |
+ Heap::kNullValueRootIndex : |
+ Heap::kUndefinedValueRootIndex; |
+ __ LoadRoot(ip, nil_value); |
__ cmp(reg, ip); |
- if (instr->is_strict()) { |
+ if (instr->kind() == kStrictEquality) { |
EmitBranch(true_block, false_block, eq); |
} else { |
+ Heap::RootListIndex other_nil_value = instr->nil() == kNullValue ? |
+ Heap::kUndefinedValueRootIndex : |
+ Heap::kNullValueRootIndex; |
Label* true_label = chunk_->GetAssemblyLabel(true_block); |
Label* false_label = chunk_->GetAssemblyLabel(false_block); |
__ b(eq, true_label); |
- __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
+ __ LoadRoot(ip, other_nil_value); |
__ cmp(reg, ip); |
__ b(eq, true_label); |
__ JumpIfSmi(reg, false_label); |