OLD | NEW |
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 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1824 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1825 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1825 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1826 | 1826 |
1827 __ test(FieldOperand(input, String::kHashFieldOffset), | 1827 __ test(FieldOperand(input, String::kHashFieldOffset), |
1828 Immediate(String::kContainsCachedArrayIndexMask)); | 1828 Immediate(String::kContainsCachedArrayIndexMask)); |
1829 EmitBranch(true_block, false_block, equal); | 1829 EmitBranch(true_block, false_block, equal); |
1830 } | 1830 } |
1831 | 1831 |
1832 | 1832 |
1833 // Branches to a label or falls through with the answer in the z flag. Trashes | 1833 // Branches to a label or falls through with the answer in the z flag. Trashes |
1834 // the temp registers, but not the input. Only input and temp2 may alias. | 1834 // the temp registers, but not the input. |
1835 void LCodeGen::EmitClassOfTest(Label* is_true, | 1835 void LCodeGen::EmitClassOfTest(Label* is_true, |
1836 Label* is_false, | 1836 Label* is_false, |
1837 Handle<String>class_name, | 1837 Handle<String>class_name, |
1838 Register input, | 1838 Register input, |
1839 Register temp, | 1839 Register temp, |
1840 Register temp2) { | 1840 Register temp2) { |
1841 ASSERT(!input.is(temp)); | 1841 ASSERT(!input.is(temp)); |
1842 ASSERT(!temp.is(temp2)); // But input and temp2 may be the same register. | 1842 ASSERT(!input.is(temp2)); |
| 1843 ASSERT(!temp.is(temp2)); |
1843 __ JumpIfSmi(input, is_false); | 1844 __ JumpIfSmi(input, is_false); |
1844 | 1845 |
1845 if (class_name->IsEqualTo(CStrVector("Function"))) { | 1846 if (class_name->IsEqualTo(CStrVector("Function"))) { |
1846 // Assuming the following assertions, we can use the same compares to test | 1847 // Assuming the following assertions, we can use the same compares to test |
1847 // for both being a function type and being in the object type range. | 1848 // for both being a function type and being in the object type range. |
1848 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 1849 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
1849 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 1850 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
1850 FIRST_SPEC_OBJECT_TYPE + 1); | 1851 FIRST_SPEC_OBJECT_TYPE + 1); |
1851 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 1852 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
1852 LAST_SPEC_OBJECT_TYPE - 1); | 1853 LAST_SPEC_OBJECT_TYPE - 1); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1892 // comparison. | 1893 // comparison. |
1893 __ cmp(temp, class_name); | 1894 __ cmp(temp, class_name); |
1894 // End with the answer in the z flag. | 1895 // End with the answer in the z flag. |
1895 } | 1896 } |
1896 | 1897 |
1897 | 1898 |
1898 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) { | 1899 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) { |
1899 Register input = ToRegister(instr->InputAt(0)); | 1900 Register input = ToRegister(instr->InputAt(0)); |
1900 Register temp = ToRegister(instr->TempAt(0)); | 1901 Register temp = ToRegister(instr->TempAt(0)); |
1901 Register temp2 = ToRegister(instr->TempAt(1)); | 1902 Register temp2 = ToRegister(instr->TempAt(1)); |
1902 if (input.is(temp)) { | 1903 |
1903 // Swap. | |
1904 Register swapper = temp; | |
1905 temp = temp2; | |
1906 temp2 = swapper; | |
1907 } | |
1908 Handle<String> class_name = instr->hydrogen()->class_name(); | 1904 Handle<String> class_name = instr->hydrogen()->class_name(); |
1909 | 1905 |
1910 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1906 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1911 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1907 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1912 | 1908 |
1913 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 1909 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
1914 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1910 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
1915 | 1911 |
1916 EmitClassOfTest(true_label, false_label, class_name, input, temp, temp2); | 1912 EmitClassOfTest(true_label, false_label, class_name, input, temp, temp2); |
1917 | 1913 |
(...skipping 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4621 this, pointers, Safepoint::kLazyDeopt); | 4617 this, pointers, Safepoint::kLazyDeopt); |
4622 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4618 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4623 } | 4619 } |
4624 | 4620 |
4625 | 4621 |
4626 #undef __ | 4622 #undef __ |
4627 | 4623 |
4628 } } // namespace v8::internal | 4624 } } // namespace v8::internal |
4629 | 4625 |
4630 #endif // V8_TARGET_ARCH_IA32 | 4626 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |