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 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1892 | 1892 |
1893 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { | 1893 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { |
1894 __ int3(); | 1894 __ int3(); |
1895 } | 1895 } |
1896 | 1896 |
1897 | 1897 |
1898 void LCodeGen::DoBranch(LBranch* instr) { | 1898 void LCodeGen::DoBranch(LBranch* instr) { |
1899 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1899 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1900 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1900 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1901 | 1901 |
| 1902 FOR_ASSERT(bool considered_typefeedback = false); |
1902 Representation r = instr->hydrogen()->value()->representation(); | 1903 Representation r = instr->hydrogen()->value()->representation(); |
1903 if (r.IsInteger32()) { | 1904 if (r.IsInteger32()) { |
1904 Register reg = ToRegister(instr->value()); | 1905 Register reg = ToRegister(instr->value()); |
1905 __ testl(reg, reg); | 1906 __ testl(reg, reg); |
1906 EmitBranch(true_block, false_block, not_zero); | 1907 EmitBranch(true_block, false_block, not_zero); |
1907 } else if (r.IsSmi()) { | 1908 } else if (r.IsSmi()) { |
1908 Register reg = ToRegister(instr->value()); | 1909 Register reg = ToRegister(instr->value()); |
1909 __ testq(reg, reg); | 1910 __ testq(reg, reg); |
1910 EmitBranch(true_block, false_block, not_zero); | 1911 EmitBranch(true_block, false_block, not_zero); |
1911 } else if (r.IsDouble()) { | 1912 } else if (r.IsDouble()) { |
1912 XMMRegister reg = ToDoubleRegister(instr->value()); | 1913 XMMRegister reg = ToDoubleRegister(instr->value()); |
1913 __ xorps(xmm0, xmm0); | 1914 __ xorps(xmm0, xmm0); |
1914 __ ucomisd(reg, xmm0); | 1915 __ ucomisd(reg, xmm0); |
1915 EmitBranch(true_block, false_block, not_equal); | 1916 EmitBranch(true_block, false_block, not_equal); |
1916 } else { | 1917 } else { |
1917 ASSERT(r.IsTagged()); | 1918 ASSERT(r.IsTagged()); |
1918 Register reg = ToRegister(instr->value()); | 1919 Register reg = ToRegister(instr->value()); |
1919 HType type = instr->hydrogen()->value()->type(); | 1920 HType type = instr->hydrogen()->value()->type(); |
1920 if (type.IsBoolean()) { | 1921 if (type.IsBoolean()) { |
1921 __ CompareRoot(reg, Heap::kTrueValueRootIndex); | 1922 __ CompareRoot(reg, Heap::kTrueValueRootIndex); |
1922 EmitBranch(true_block, false_block, equal); | 1923 EmitBranch(true_block, false_block, equal); |
1923 } else if (type.IsSmi()) { | 1924 } else if (type.IsSmi()) { |
1924 __ SmiCompare(reg, Smi::FromInt(0)); | 1925 __ SmiCompare(reg, Smi::FromInt(0)); |
1925 EmitBranch(true_block, false_block, not_equal); | 1926 EmitBranch(true_block, false_block, not_equal); |
1926 } else { | 1927 } else { |
1927 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 1928 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
1928 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1929 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
1929 | 1930 |
| 1931 FOR_ASSERT(considered_typefeedback = true); |
1930 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); | 1932 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); |
1931 // Avoid deopts in the case where we've never executed this path before. | 1933 // Avoid deopts in the case where we've never executed this path before. |
1932 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); | 1934 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); |
1933 | 1935 |
1934 if (expected.Contains(ToBooleanStub::UNDEFINED)) { | 1936 if (expected.Contains(ToBooleanStub::UNDEFINED)) { |
1935 // undefined -> false. | 1937 // undefined -> false. |
1936 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); | 1938 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); |
1937 __ j(equal, false_label); | 1939 __ j(equal, false_label); |
1938 } | 1940 } |
1939 if (expected.Contains(ToBooleanStub::BOOLEAN)) { | 1941 if (expected.Contains(ToBooleanStub::BOOLEAN)) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1999 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); | 2001 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); |
2000 __ j(zero, false_label); | 2002 __ j(zero, false_label); |
2001 __ jmp(true_label); | 2003 __ jmp(true_label); |
2002 __ bind(¬_heap_number); | 2004 __ bind(¬_heap_number); |
2003 } | 2005 } |
2004 | 2006 |
2005 // We've seen something for the first time -> deopt. | 2007 // We've seen something for the first time -> deopt. |
2006 DeoptimizeIf(no_condition, instr->environment()); | 2008 DeoptimizeIf(no_condition, instr->environment()); |
2007 } | 2009 } |
2008 } | 2010 } |
| 2011 // Make sure not to poison the stub cache. |
| 2012 ASSERT(info()->IsStub() ? considered_typefeedback : true); |
2009 } | 2013 } |
2010 | 2014 |
2011 | 2015 |
2012 void LCodeGen::EmitGoto(int block) { | 2016 void LCodeGen::EmitGoto(int block) { |
2013 if (!IsNextEmittedBlock(block)) { | 2017 if (!IsNextEmittedBlock(block)) { |
2014 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); | 2018 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); |
2015 } | 2019 } |
2016 } | 2020 } |
2017 | 2021 |
2018 | 2022 |
(...skipping 3654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5673 FixedArray::kHeaderSize - kPointerSize)); | 5677 FixedArray::kHeaderSize - kPointerSize)); |
5674 __ bind(&done); | 5678 __ bind(&done); |
5675 } | 5679 } |
5676 | 5680 |
5677 | 5681 |
5678 #undef __ | 5682 #undef __ |
5679 | 5683 |
5680 } } // namespace v8::internal | 5684 } } // namespace v8::internal |
5681 | 5685 |
5682 #endif // V8_TARGET_ARCH_X64 | 5686 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |