Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 46dcec0d8804b66d808c024b75825cb18b23c637..23ca36ae0fa4dc89ff44ca0c2cf232c6476fbe0c 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -2124,14 +2124,16 @@ void LCodeGen::EmitBranch(int left_block, int right_block, Condition cc) { |
void LCodeGen::DoBranch(LBranch* instr) { |
int true_block = chunk_->LookupDestination(instr->true_block_id()); |
int false_block = chunk_->LookupDestination(instr->false_block_id()); |
- CpuFeatureScope scope(masm(), SSE2); |
Representation r = instr->hydrogen()->value()->representation(); |
if (r.IsSmiOrInteger32()) { |
+ ASSERT(!info()->IsStub()); |
Register reg = ToRegister(instr->value()); |
__ test(reg, Operand(reg)); |
EmitBranch(true_block, false_block, not_zero); |
} else if (r.IsDouble()) { |
+ ASSERT(!info()->IsStub()); |
+ CpuFeatureScope scope(masm(), SSE2); |
XMMRegister reg = ToDoubleRegister(instr->value()); |
__ xorps(xmm0, xmm0); |
__ ucomisd(reg, xmm0); |
@@ -2141,9 +2143,11 @@ void LCodeGen::DoBranch(LBranch* instr) { |
Register reg = ToRegister(instr->value()); |
HType type = instr->hydrogen()->value()->type(); |
if (type.IsBoolean()) { |
+ ASSERT(!info()->IsStub()); |
__ cmp(reg, factory()->true_value()); |
EmitBranch(true_block, false_block, equal); |
} else if (type.IsSmi()) { |
+ ASSERT(!info()->IsStub()); |
__ test(reg, Operand(reg)); |
EmitBranch(true_block, false_block, not_equal); |
} else { |
@@ -2227,8 +2231,15 @@ void LCodeGen::DoBranch(LBranch* instr) { |
__ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
factory()->heap_number_map()); |
__ j(not_equal, ¬_heap_number, Label::kNear); |
- __ xorps(xmm0, xmm0); |
- __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); |
+ if (CpuFeatures::IsSafeForSnapshot(SSE2)) { |
+ CpuFeatureScope scope(masm(), SSE2); |
+ __ xorps(xmm0, xmm0); |
+ __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); |
+ } else { |
+ __ fldz(); |
+ __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); |
+ __ FCmp(); |
+ } |
__ j(zero, false_label); |
__ jmp(true_label); |
__ bind(¬_heap_number); |