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

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
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2189 if (r.IsInteger32() || r.IsSmi()) { 2189 if (r.IsInteger32() || r.IsSmi()) {
2190 ASSERT(!info()->IsStub()); 2190 ASSERT(!info()->IsStub());
2191 Register reg = ToRegister(instr->value()); 2191 Register reg = ToRegister(instr->value());
2192 __ cmp(reg, Operand::Zero()); 2192 __ cmp(reg, Operand::Zero());
2193 EmitBranch(instr, ne); 2193 EmitBranch(instr, ne);
2194 } else if (r.IsDouble()) { 2194 } else if (r.IsDouble()) {
2195 ASSERT(!info()->IsStub()); 2195 ASSERT(!info()->IsStub());
2196 DwVfpRegister reg = ToDoubleRegister(instr->value()); 2196 DwVfpRegister reg = ToDoubleRegister(instr->value());
2197 // Test the double value. Zero and NaN are false. 2197 // Test the double value. Zero and NaN are false.
2198 __ VFPCompareAndSetFlags(reg, 0.0); 2198 __ VFPCompareAndSetFlags(reg, 0.0);
2199 __ cmp(r0, r0, vs); // If NaN, set the Z flag. 2199 __ cmp(r0, r0, vs); // If NaN, set the Z flag. (NaN -> false)
2200 EmitBranch(instr, ne); 2200 EmitBranch(instr, ne);
2201 } else { 2201 } else {
2202 ASSERT(r.IsTagged()); 2202 ASSERT(r.IsTagged());
2203 Register reg = ToRegister(instr->value()); 2203 Register reg = ToRegister(instr->value());
2204 HType type = instr->hydrogen()->value()->type(); 2204 HType type = instr->hydrogen()->value()->type();
2205 if (type.IsBoolean()) { 2205 if (type.IsBoolean()) {
2206 ASSERT(!info()->IsStub()); 2206 ASSERT(!info()->IsStub());
2207 __ CompareRoot(reg, Heap::kTrueValueRootIndex); 2207 __ CompareRoot(reg, Heap::kTrueValueRootIndex);
2208 EmitBranch(instr, eq); 2208 EmitBranch(instr, eq);
2209 } else if (type.IsSmi()) { 2209 } else if (type.IsSmi()) {
2210 ASSERT(!info()->IsStub()); 2210 ASSERT(!info()->IsStub());
2211 __ cmp(reg, Operand::Zero()); 2211 __ cmp(reg, Operand::Zero());
2212 EmitBranch(instr, ne); 2212 EmitBranch(instr, ne);
2213 } else if (type.IsJSArray()) {
2214 ASSERT(!info()->IsStub());
2215 EmitBranch(instr, al);
2216 } else if (type.IsHeapNumber()) {
2217 ASSERT(!info()->IsStub());
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(instr, ne);
2224 } else if (type.IsString()) {
2225 ASSERT(!info()->IsStub());
2226 __ ldr(ip, FieldMemOperand(reg, String::kLengthOffset));
2227 __ cmp(ip, Operand::Zero());
2228 EmitBranch(instr, ne);
2213 } else { 2229 } else {
2214 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); 2230 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types();
2215 // Avoid deopts in the case where we've never executed this path before. 2231 // Avoid deopts in the case where we've never executed this path before.
2216 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); 2232 if (expected.IsEmpty()) expected = ToBooleanStub::Types::Generic();
2217 2233
2218 if (expected.Contains(ToBooleanStub::UNDEFINED)) { 2234 if (expected.Contains(ToBooleanStub::UNDEFINED)) {
2219 // undefined -> false. 2235 // undefined -> false.
2220 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); 2236 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex);
2221 __ b(eq, instr->FalseLabel(chunk_)); 2237 __ b(eq, instr->FalseLabel(chunk_));
2222 } 2238 }
2223 if (expected.Contains(ToBooleanStub::BOOLEAN)) { 2239 if (expected.Contains(ToBooleanStub::BOOLEAN)) {
2224 // Boolean -> its value. 2240 // Boolean -> its value.
2225 __ CompareRoot(reg, Heap::kTrueValueRootIndex); 2241 __ CompareRoot(reg, Heap::kTrueValueRootIndex);
2226 __ b(eq, instr->TrueLabel(chunk_)); 2242 __ b(eq, instr->TrueLabel(chunk_));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); 2303 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex);
2288 __ b(ne, &not_heap_number); 2304 __ b(ne, &not_heap_number);
2289 __ vldr(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); 2305 __ vldr(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset));
2290 __ VFPCompareAndSetFlags(dbl_scratch, 0.0); 2306 __ VFPCompareAndSetFlags(dbl_scratch, 0.0);
2291 __ cmp(r0, r0, vs); // NaN -> false. 2307 __ cmp(r0, r0, vs); // NaN -> false.
2292 __ b(eq, instr->FalseLabel(chunk_)); // +0, -0 -> false. 2308 __ b(eq, instr->FalseLabel(chunk_)); // +0, -0 -> false.
2293 __ b(instr->TrueLabel(chunk_)); 2309 __ b(instr->TrueLabel(chunk_));
2294 __ bind(&not_heap_number); 2310 __ bind(&not_heap_number);
2295 } 2311 }
2296 2312
2297 // We've seen something for the first time -> deopt. 2313 if (!expected.IsGeneric()) {
2298 DeoptimizeIf(al, instr->environment()); 2314 // We've seen something for the first time -> deopt.
2315 // This can only happen if we are not generic already.
2316 DeoptimizeIf(al, instr->environment());
2317 }
2299 } 2318 }
2300 } 2319 }
2301 } 2320 }
2302 2321
2303 2322
2304 void LCodeGen::EmitGoto(int block) { 2323 void LCodeGen::EmitGoto(int block) {
2305 if (!IsNextEmittedBlock(block)) { 2324 if (!IsNextEmittedBlock(block)) {
2306 __ jmp(chunk_->GetAssemblyLabel(LookupDestination(block))); 2325 __ jmp(chunk_->GetAssemblyLabel(LookupDestination(block)));
2307 } 2326 }
2308 } 2327 }
(...skipping 3596 matching lines...) Expand 10 before | Expand all | Expand 10 after
5905 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5924 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5906 __ ldr(result, FieldMemOperand(scratch, 5925 __ ldr(result, FieldMemOperand(scratch,
5907 FixedArray::kHeaderSize - kPointerSize)); 5926 FixedArray::kHeaderSize - kPointerSize));
5908 __ bind(&done); 5927 __ bind(&done);
5909 } 5928 }
5910 5929
5911 5930
5912 #undef __ 5931 #undef __
5913 5932
5914 } } // namespace v8::internal 5933 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698