Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index de43f86a3d2b6e154d7535d5719b0114a0149531..2c3b74ff68746a1eb8f3b6d1ca770c904bf0aba9 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -1834,12 +1834,12 @@ int LCodeGen::GetNextEmittedBlock() const { |
template<class InstrType> |
void LCodeGen::EmitBranch(InstrType instr, Condition cc) { |
- int right_block = instr->FalseDestination(chunk_); |
int left_block = instr->TrueDestination(chunk_); |
+ int right_block = instr->FalseDestination(chunk_); |
int next_block = GetNextEmittedBlock(); |
- if (right_block == left_block) { |
+ if (right_block == left_block || cc == no_condition) { |
EmitGoto(left_block); |
} else if (left_block == next_block) { |
__ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); |
@@ -1859,6 +1859,25 @@ void LCodeGen::DoDebugBreak(LDebugBreak* instr) { |
} |
+void LCodeGen::DoIsNumberAndBranch(LIsNumberAndBranch* instr) { |
+ Representation r = instr->hydrogen()->value()->representation(); |
+ if (r.IsSmiOrInteger32() || r.IsDouble()) { |
+ EmitBranch(instr, no_condition); |
+ } else { |
+ ASSERT(r.IsTagged()); |
+ Register reg = ToRegister(instr->value()); |
+ HType type = instr->hydrogen()->value()->type(); |
+ if (type.IsTaggedNumber()) { |
+ EmitBranch(instr, no_condition); |
+ } |
+ __ JumpIfSmi(reg, instr->TrueLabel(chunk_)); |
+ __ CompareRoot(FieldOperand(reg, HeapObject::kMapOffset), |
+ Heap::kHeapNumberMapRootIndex); |
+ EmitBranch(instr, equal); |
+ } |
+} |
+ |
+ |
void LCodeGen::DoBranch(LBranch* instr) { |
Representation r = instr->hydrogen()->value()->representation(); |
if (r.IsInteger32()) { |