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(instr, equal); | 1917 EmitBranch(instr, 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(instr, not_equal); | 1921 EmitBranch(instr, not_equal); |
| 1922 } else if (type.IsJSArray()) { |
| 1923 ASSERT(!info()->IsStub()); |
| 1924 EmitBranch(instr, no_condition); |
| 1925 } else if (type.IsHeapNumber()) { |
| 1926 ASSERT(!info()->IsStub()); |
| 1927 __ xorps(xmm0, xmm0); |
| 1928 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); |
| 1929 EmitBranch(instr, not_equal); |
| 1930 } else if (type.IsString()) { |
| 1931 ASSERT(!info()->IsStub()); |
| 1932 __ cmpq(FieldOperand(reg, String::kLengthOffset), Immediate(0)); |
| 1933 EmitBranch(instr, not_equal); |
1922 } else { | 1934 } else { |
1923 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); | 1935 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); |
1924 // 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. |
1925 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); | 1937 if (expected.IsEmpty()) expected = ToBooleanStub::Types::Generic(); |
1926 | 1938 |
1927 if (expected.Contains(ToBooleanStub::UNDEFINED)) { | 1939 if (expected.Contains(ToBooleanStub::UNDEFINED)) { |
1928 // undefined -> false. | 1940 // undefined -> false. |
1929 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); | 1941 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); |
1930 __ j(equal, instr->FalseLabel(chunk_)); | 1942 __ j(equal, instr->FalseLabel(chunk_)); |
1931 } | 1943 } |
1932 if (expected.Contains(ToBooleanStub::BOOLEAN)) { | 1944 if (expected.Contains(ToBooleanStub::BOOLEAN)) { |
1933 // true -> true. | 1945 // true -> true. |
1934 __ CompareRoot(reg, Heap::kTrueValueRootIndex); | 1946 __ CompareRoot(reg, Heap::kTrueValueRootIndex); |
1935 __ j(equal, instr->TrueLabel(chunk_)); | 1947 __ j(equal, instr->TrueLabel(chunk_)); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 Label not_heap_number; | 2000 Label not_heap_number; |
1989 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); | 2001 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); |
1990 __ j(not_equal, ¬_heap_number, Label::kNear); | 2002 __ j(not_equal, ¬_heap_number, Label::kNear); |
1991 __ xorps(xmm0, xmm0); | 2003 __ xorps(xmm0, xmm0); |
1992 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); | 2004 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); |
1993 __ j(zero, instr->FalseLabel(chunk_)); | 2005 __ j(zero, instr->FalseLabel(chunk_)); |
1994 __ jmp(instr->TrueLabel(chunk_)); | 2006 __ jmp(instr->TrueLabel(chunk_)); |
1995 __ bind(¬_heap_number); | 2007 __ bind(¬_heap_number); |
1996 } | 2008 } |
1997 | 2009 |
1998 // We've seen something for the first time -> deopt. | 2010 if (!expected.IsGeneric()) { |
1999 DeoptimizeIf(no_condition, instr->environment()); | 2011 // We've seen something for the first time -> deopt. |
| 2012 // This can only happen if we are not generic already. |
| 2013 DeoptimizeIf(no_condition, instr->environment()); |
| 2014 } |
2000 } | 2015 } |
2001 } | 2016 } |
2002 } | 2017 } |
2003 | 2018 |
2004 | 2019 |
2005 void LCodeGen::EmitGoto(int block) { | 2020 void LCodeGen::EmitGoto(int block) { |
2006 if (!IsNextEmittedBlock(block)) { | 2021 if (!IsNextEmittedBlock(block)) { |
2007 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); | 2022 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); |
2008 } | 2023 } |
2009 } | 2024 } |
(...skipping 3636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5646 FixedArray::kHeaderSize - kPointerSize)); | 5661 FixedArray::kHeaderSize - kPointerSize)); |
5647 __ bind(&done); | 5662 __ bind(&done); |
5648 } | 5663 } |
5649 | 5664 |
5650 | 5665 |
5651 #undef __ | 5666 #undef __ |
5652 | 5667 |
5653 } } // namespace v8::internal | 5668 } } // namespace v8::internal |
5654 | 5669 |
5655 #endif // V8_TARGET_ARCH_X64 | 5670 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |