Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(962)

Unified Diff: src/arm/lithium-codegen-arm.cc

Issue 17082003: Let NaN flow as double into HBranch (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index ef860e0d8774771c00378fc6b7bc8129726d49d6..2f3c522d2b1fe51a0638316a4386f969bef05c43 100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -2198,7 +2198,7 @@ void LCodeGen::DoBranch(LBranch* instr) {
DwVfpRegister reg = ToDoubleRegister(instr->value());
// Test the double value. Zero and NaN are false.
__ VFPCompareAndSetFlags(reg, 0.0);
- __ cmp(r0, r0, vs); // If NaN, set the Z flag.
+ __ cmp(r0, r0, vs); // If NaN, set the Z flag. (NaN -> false)
EmitBranch(true_block, false_block, ne);
} else {
ASSERT(r.IsTagged());
@@ -2212,6 +2212,19 @@ void LCodeGen::DoBranch(LBranch* instr) {
ASSERT(!info()->IsStub());
__ cmp(reg, Operand::Zero());
EmitBranch(true_block, false_block, ne);
+ } else if (type.IsJSArray()) {
+ EmitBranch(true_block, false_block, al);
+ } else if (type.IsHeapNumber()) {
+ DwVfpRegister dbl_scratch = double_scratch0();
+ __ vldr(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset));
+ // Test the double value. Zero and NaN are false.
+ __ VFPCompareAndSetFlags(dbl_scratch, 0.0);
+ __ cmp(r0, r0, vs); // If NaN, set the Z flag. (NaN)
+ EmitBranch(true_block, false_block, ne);
+ } else if (type.IsString()) {
+ __ ldr(ip, FieldMemOperand(reg, String::kLengthOffset));
+ __ cmp(ip, Operand::Zero());
+ EmitBranch(true_block, false_block, ne);
} else {
Label* true_label = chunk_->GetAssemblyLabel(true_block);
Label* false_label = chunk_->GetAssemblyLabel(false_block);
@@ -2299,8 +2312,10 @@ void LCodeGen::DoBranch(LBranch* instr) {
__ bind(&not_heap_number);
}
- // We've seen something for the first time -> deopt.
- DeoptimizeIf(al, instr->environment());
+ if (expected != ToBooleanStub::all_types()) {
+ // We've seen something for the first time -> deopt.
+ DeoptimizeIf(al, instr->environment());
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698