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

Side by Side Diff: src/x64/lithium-codegen-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 Register reg = ToRegister(instr->value()); 1912 Register reg = ToRegister(instr->value());
1913 HType type = instr->hydrogen()->value()->type(); 1913 HType type = instr->hydrogen()->value()->type();
1914 if (type.IsBoolean()) { 1914 if (type.IsBoolean()) {
1915 ASSERT(!info()->IsStub()); 1915 ASSERT(!info()->IsStub());
1916 __ CompareRoot(reg, Heap::kTrueValueRootIndex); 1916 __ CompareRoot(reg, Heap::kTrueValueRootIndex);
1917 EmitBranch(true_block, false_block, equal); 1917 EmitBranch(true_block, false_block, equal);
1918 } else if (type.IsSmi()) { 1918 } else if (type.IsSmi()) {
1919 ASSERT(!info()->IsStub()); 1919 ASSERT(!info()->IsStub());
1920 __ SmiCompare(reg, Smi::FromInt(0)); 1920 __ SmiCompare(reg, Smi::FromInt(0));
1921 EmitBranch(true_block, false_block, not_equal); 1921 EmitBranch(true_block, false_block, not_equal);
1922 } else if (type.IsJSArray()) {
1923 ASSERT(!info()->IsStub());
1924 EmitBranch(true_block, false_block, no_condition);
1925 } else if (type.IsHeapNumber()) {
1926 ASSERT(!info()->IsStub());
1927 __ xorps(xmm0, xmm0);
1928 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset));
1929 EmitBranch(true_block, false_block, not_equal);
1930 } else if (type.IsString()) {
1931 ASSERT(!info()->IsStub());
1932 __ cmpq(FieldOperand(reg, String::kLengthOffset), Immediate(0));
1933 EmitBranch(true_block, false_block, not_equal);
1922 } else { 1934 } else {
1923 Label* true_label = chunk_->GetAssemblyLabel(true_block); 1935 Label* true_label = chunk_->GetAssemblyLabel(true_block);
1924 Label* false_label = chunk_->GetAssemblyLabel(false_block); 1936 Label* false_label = chunk_->GetAssemblyLabel(false_block);
1925 1937
1926 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); 1938 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types();
1927 // Avoid deopts in the case where we've never executed this path before. 1939 // Avoid deopts in the case where we've never executed this path before.
1928 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); 1940 if (expected.IsEmpty()) expected = ToBooleanStub::Types::Generic();
1929 1941
1930 if (expected.Contains(ToBooleanStub::UNDEFINED)) { 1942 if (expected.Contains(ToBooleanStub::UNDEFINED)) {
1931 // undefined -> false. 1943 // undefined -> false.
1932 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); 1944 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex);
1933 __ j(equal, false_label); 1945 __ j(equal, false_label);
1934 } 1946 }
1935 if (expected.Contains(ToBooleanStub::BOOLEAN)) { 1947 if (expected.Contains(ToBooleanStub::BOOLEAN)) {
1936 // true -> true. 1948 // true -> true.
1937 __ CompareRoot(reg, Heap::kTrueValueRootIndex); 1949 __ CompareRoot(reg, Heap::kTrueValueRootIndex);
1938 __ j(equal, true_label); 1950 __ j(equal, true_label);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 Label not_heap_number; 2003 Label not_heap_number;
1992 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); 2004 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex);
1993 __ j(not_equal, &not_heap_number, Label::kNear); 2005 __ j(not_equal, &not_heap_number, Label::kNear);
1994 __ xorps(xmm0, xmm0); 2006 __ xorps(xmm0, xmm0);
1995 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); 2007 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset));
1996 __ j(zero, false_label); 2008 __ j(zero, false_label);
1997 __ jmp(true_label); 2009 __ jmp(true_label);
1998 __ bind(&not_heap_number); 2010 __ bind(&not_heap_number);
1999 } 2011 }
2000 2012
2001 // We've seen something for the first time -> deopt. 2013 if (!expected.IsGeneric()) {
2002 DeoptimizeIf(no_condition, instr->environment()); 2014 // We've seen something for the first time -> deopt.
2015 // This can only happen if we are not generic already.
2016 DeoptimizeIf(no_condition, instr->environment());
2017 }
2003 } 2018 }
2004 } 2019 }
2005 } 2020 }
2006 2021
2007 2022
2008 void LCodeGen::EmitGoto(int block) { 2023 void LCodeGen::EmitGoto(int block) {
2009 if (!IsNextEmittedBlock(block)) { 2024 if (!IsNextEmittedBlock(block)) {
2010 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); 2025 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block)));
2011 } 2026 }
2012 } 2027 }
(...skipping 3591 matching lines...) Expand 10 before | Expand all | Expand 10 after
5604 FixedArray::kHeaderSize - kPointerSize)); 5619 FixedArray::kHeaderSize - kPointerSize));
5605 __ bind(&done); 5620 __ bind(&done);
5606 } 5621 }
5607 5622
5608 5623
5609 #undef __ 5624 #undef __
5610 5625
5611 } } // namespace v8::internal 5626 } } // namespace v8::internal
5612 5627
5613 #endif // V8_TARGET_ARCH_X64 5628 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/arm/lithium-arm.cc ('K') | « src/ia32/lithium-ia32.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698