Index: src/x64/lithium-codegen-x64.cc |
=================================================================== |
--- src/x64/lithium-codegen-x64.cc (revision 9305) |
+++ src/x64/lithium-codegen-x64.cc (working copy) |
@@ -1583,30 +1583,33 @@ |
} |
-void LCodeGen::DoIsNullAndBranch(LIsNullAndBranch* instr) { |
+void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) { |
Register reg = ToRegister(instr->InputAt(0)); |
- |
int false_block = chunk_->LookupDestination(instr->false_block_id()); |
+ // 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()) { |
- // If the expression is known to untagged or smi, then it's definitely |
- // not null, and it can't be a an undetectable object. |
- // Jump directly to the false block. |
EmitGoto(false_block); |
return; |
} |
int true_block = chunk_->LookupDestination(instr->true_block_id()); |
- |
- __ CompareRoot(reg, Heap::kNullValueRootIndex); |
- if (instr->is_strict()) { |
+ Heap::RootListIndex nil_value = instr->nil() == kNullValue ? |
+ Heap::kNullValueRootIndex : |
+ Heap::kUndefinedValueRootIndex; |
+ __ CompareRoot(reg, nil_value); |
+ if (instr->kind() == kStrictEquality) { |
EmitBranch(true_block, false_block, equal); |
} 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); |
__ j(equal, true_label); |
- __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); |
+ __ CompareRoot(reg, other_nil_value); |
__ j(equal, true_label); |
__ JumpIfSmi(reg, false_label); |
// Check for undetectable objects by looking in the bit field in |