OLD | NEW |
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 Loading... |
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 EmitBranch(true_block, false_block, no_condition); |
| 1924 } else if (type.IsHeapNumber()) { |
| 1925 __ xorps(xmm0, xmm0); |
| 1926 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); |
| 1927 EmitBranch(true_block, false_block, not_equal); |
| 1928 } else if (type.IsString()) { |
| 1929 __ cmpq(FieldOperand(reg, String::kLengthOffset), Immediate(0)); |
| 1930 EmitBranch(true_block, false_block, not_equal); |
1922 } else { | 1931 } else { |
1923 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 1932 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
1924 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1933 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
1925 | 1934 |
1926 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); | 1935 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); |
1927 // Avoid deopts in the case where we've never executed this path before. | 1936 // Avoid deopts in the case where we've never executed this path before. |
1928 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); | 1937 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); |
1929 | 1938 |
1930 if (expected.Contains(ToBooleanStub::UNDEFINED)) { | 1939 if (expected.Contains(ToBooleanStub::UNDEFINED)) { |
1931 // undefined -> false. | 1940 // undefined -> false. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1991 Label not_heap_number; | 2000 Label not_heap_number; |
1992 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); | 2001 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); |
1993 __ j(not_equal, ¬_heap_number, Label::kNear); | 2002 __ j(not_equal, ¬_heap_number, Label::kNear); |
1994 __ xorps(xmm0, xmm0); | 2003 __ xorps(xmm0, xmm0); |
1995 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); | 2004 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); |
1996 __ j(zero, false_label); | 2005 __ j(zero, false_label); |
1997 __ jmp(true_label); | 2006 __ jmp(true_label); |
1998 __ bind(¬_heap_number); | 2007 __ bind(¬_heap_number); |
1999 } | 2008 } |
2000 | 2009 |
2001 // We've seen something for the first time -> deopt. | 2010 if (expected != ToBooleanStub::all_types()) { |
2002 DeoptimizeIf(no_condition, instr->environment()); | 2011 // We've seen something for the first time -> deopt. |
| 2012 DeoptimizeIf(no_condition, instr->environment()); |
| 2013 } |
2003 } | 2014 } |
2004 } | 2015 } |
2005 } | 2016 } |
2006 | 2017 |
2007 | 2018 |
2008 void LCodeGen::EmitGoto(int block) { | 2019 void LCodeGen::EmitGoto(int block) { |
2009 if (!IsNextEmittedBlock(block)) { | 2020 if (!IsNextEmittedBlock(block)) { |
2010 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); | 2021 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); |
2011 } | 2022 } |
2012 } | 2023 } |
(...skipping 3591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5604 FixedArray::kHeaderSize - kPointerSize)); | 5615 FixedArray::kHeaderSize - kPointerSize)); |
5605 __ bind(&done); | 5616 __ bind(&done); |
5606 } | 5617 } |
5607 | 5618 |
5608 | 5619 |
5609 #undef __ | 5620 #undef __ |
5610 | 5621 |
5611 } } // namespace v8::internal | 5622 } } // namespace v8::internal |
5612 | 5623 |
5613 #endif // V8_TARGET_ARCH_X64 | 5624 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |