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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 if (r.IsInteger32() || r.IsSmi()) { 2191 if (r.IsInteger32() || r.IsSmi()) {
2192 ASSERT(!info()->IsStub()); 2192 ASSERT(!info()->IsStub());
2193 Register reg = ToRegister(instr->value()); 2193 Register reg = ToRegister(instr->value());
2194 __ cmp(reg, Operand::Zero()); 2194 __ cmp(reg, Operand::Zero());
2195 EmitBranch(true_block, false_block, ne); 2195 EmitBranch(true_block, false_block, ne);
2196 } else if (r.IsDouble()) { 2196 } else if (r.IsDouble()) {
2197 ASSERT(!info()->IsStub()); 2197 ASSERT(!info()->IsStub());
2198 DwVfpRegister reg = ToDoubleRegister(instr->value()); 2198 DwVfpRegister reg = ToDoubleRegister(instr->value());
2199 // Test the double value. Zero and NaN are false. 2199 // Test the double value. Zero and NaN are false.
2200 __ VFPCompareAndSetFlags(reg, 0.0); 2200 __ VFPCompareAndSetFlags(reg, 0.0);
2201 __ cmp(r0, r0, vs); // If NaN, set the Z flag. 2201 __ cmp(r0, r0, vs); // If NaN, set the Z flag. (NaN -> false)
2202 EmitBranch(true_block, false_block, ne); 2202 EmitBranch(true_block, false_block, ne);
2203 } else { 2203 } else {
2204 ASSERT(r.IsTagged()); 2204 ASSERT(r.IsTagged());
2205 Register reg = ToRegister(instr->value()); 2205 Register reg = ToRegister(instr->value());
2206 HType type = instr->hydrogen()->value()->type(); 2206 HType type = instr->hydrogen()->value()->type();
2207 if (type.IsBoolean()) { 2207 if (type.IsBoolean()) {
2208 ASSERT(!info()->IsStub()); 2208 ASSERT(!info()->IsStub());
2209 __ CompareRoot(reg, Heap::kTrueValueRootIndex); 2209 __ CompareRoot(reg, Heap::kTrueValueRootIndex);
2210 EmitBranch(true_block, false_block, eq); 2210 EmitBranch(true_block, false_block, eq);
2211 } else if (type.IsSmi()) { 2211 } else if (type.IsSmi()) {
2212 ASSERT(!info()->IsStub()); 2212 ASSERT(!info()->IsStub());
2213 __ cmp(reg, Operand::Zero()); 2213 __ cmp(reg, Operand::Zero());
2214 EmitBranch(true_block, false_block, ne); 2214 EmitBranch(true_block, false_block, ne);
2215 } else if (type.IsJSArray()) {
2216 EmitBranch(true_block, false_block, al);
2217 } else if (type.IsHeapNumber()) {
2218 DwVfpRegister dbl_scratch = double_scratch0();
2219 __ vldr(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset));
2220 // Test the double value. Zero and NaN are false.
2221 __ VFPCompareAndSetFlags(dbl_scratch, 0.0);
2222 __ cmp(r0, r0, vs); // If NaN, set the Z flag. (NaN)
2223 EmitBranch(true_block, false_block, ne);
2224 } else if (type.IsString()) {
2225 __ ldr(ip, FieldMemOperand(reg, String::kLengthOffset));
2226 __ cmp(ip, Operand::Zero());
2227 EmitBranch(true_block, false_block, ne);
2215 } else { 2228 } else {
2216 Label* true_label = chunk_->GetAssemblyLabel(true_block); 2229 Label* true_label = chunk_->GetAssemblyLabel(true_block);
2217 Label* false_label = chunk_->GetAssemblyLabel(false_block); 2230 Label* false_label = chunk_->GetAssemblyLabel(false_block);
2218 2231
2219 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); 2232 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types();
2220 // Avoid deopts in the case where we've never executed this path before. 2233 // Avoid deopts in the case where we've never executed this path before.
2221 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); 2234 if (expected.IsEmpty()) expected = ToBooleanStub::all_types();
2222 2235
2223 if (expected.Contains(ToBooleanStub::UNDEFINED)) { 2236 if (expected.Contains(ToBooleanStub::UNDEFINED)) {
2224 // undefined -> false. 2237 // undefined -> false.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2292 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); 2305 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex);
2293 __ b(ne, &not_heap_number); 2306 __ b(ne, &not_heap_number);
2294 __ vldr(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); 2307 __ vldr(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset));
2295 __ VFPCompareAndSetFlags(dbl_scratch, 0.0); 2308 __ VFPCompareAndSetFlags(dbl_scratch, 0.0);
2296 __ cmp(r0, r0, vs); // NaN -> false. 2309 __ cmp(r0, r0, vs); // NaN -> false.
2297 __ b(eq, false_label); // +0, -0 -> false. 2310 __ b(eq, false_label); // +0, -0 -> false.
2298 __ b(true_label); 2311 __ b(true_label);
2299 __ bind(&not_heap_number); 2312 __ bind(&not_heap_number);
2300 } 2313 }
2301 2314
2302 // We've seen something for the first time -> deopt. 2315 if (expected != ToBooleanStub::all_types()) {
2303 DeoptimizeIf(al, instr->environment()); 2316 // We've seen something for the first time -> deopt.
2317 DeoptimizeIf(al, instr->environment());
2318 }
2304 } 2319 }
2305 } 2320 }
2306 } 2321 }
2307 2322
2308 2323
2309 void LCodeGen::EmitGoto(int block) { 2324 void LCodeGen::EmitGoto(int block) {
2310 if (!IsNextEmittedBlock(block)) { 2325 if (!IsNextEmittedBlock(block)) {
2311 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); 2326 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block)));
2312 } 2327 }
2313 } 2328 }
(...skipping 3566 matching lines...) Expand 10 before | Expand all | Expand 10 after
5880 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5895 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5881 __ ldr(result, FieldMemOperand(scratch, 5896 __ ldr(result, FieldMemOperand(scratch,
5882 FixedArray::kHeaderSize - kPointerSize)); 5897 FixedArray::kHeaderSize - kPointerSize));
5883 __ bind(&done); 5898 __ bind(&done);
5884 } 5899 }
5885 5900
5886 5901
5887 #undef __ 5902 #undef __
5888 5903
5889 } } // namespace v8::internal 5904 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698