| Index: src/x64/lithium-codegen-x64.cc
|
| diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
|
| index 1dd27ac9bd7c7cdde01f51f4ac63778fcd9c187e..2359191e220ea48d400237758fdd404ee9f47e08 100644
|
| --- a/src/x64/lithium-codegen-x64.cc
|
| +++ b/src/x64/lithium-codegen-x64.cc
|
| @@ -1919,13 +1919,25 @@ void LCodeGen::DoBranch(LBranch* instr) {
|
| ASSERT(!info()->IsStub());
|
| __ SmiCompare(reg, Smi::FromInt(0));
|
| EmitBranch(true_block, false_block, not_equal);
|
| + } else if (type.IsJSArray()) {
|
| + ASSERT(!info()->IsStub());
|
| + EmitBranch(true_block, false_block, no_condition);
|
| + } else if (type.IsHeapNumber()) {
|
| + ASSERT(!info()->IsStub());
|
| + __ xorps(xmm0, xmm0);
|
| + __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset));
|
| + EmitBranch(true_block, false_block, not_equal);
|
| + } else if (type.IsString()) {
|
| + ASSERT(!info()->IsStub());
|
| + __ cmpq(FieldOperand(reg, String::kLengthOffset), Immediate(0));
|
| + EmitBranch(true_block, false_block, not_equal);
|
| } else {
|
| Label* true_label = chunk_->GetAssemblyLabel(true_block);
|
| Label* false_label = chunk_->GetAssemblyLabel(false_block);
|
|
|
| ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types();
|
| // Avoid deopts in the case where we've never executed this path before.
|
| - if (expected.IsEmpty()) expected = ToBooleanStub::all_types();
|
| + if (expected.IsEmpty()) expected = ToBooleanStub::Types::Generic();
|
|
|
| if (expected.Contains(ToBooleanStub::UNDEFINED)) {
|
| // undefined -> false.
|
| @@ -1998,8 +2010,11 @@ void LCodeGen::DoBranch(LBranch* instr) {
|
| __ bind(¬_heap_number);
|
| }
|
|
|
| - // We've seen something for the first time -> deopt.
|
| - DeoptimizeIf(no_condition, instr->environment());
|
| + if (!expected.IsGeneric()) {
|
| + // We've seen something for the first time -> deopt.
|
| + // This can only happen if we are not generic already.
|
| + DeoptimizeIf(no_condition, instr->environment());
|
| + }
|
| }
|
| }
|
| }
|
|
|