OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1889 Label* fail, | 1889 Label* fail, |
1890 bool is_heap_object) { | 1890 bool is_heap_object) { |
1891 if (!is_heap_object) { | 1891 if (!is_heap_object) { |
1892 JumpIfSmi(obj, fail); | 1892 JumpIfSmi(obj, fail); |
1893 } | 1893 } |
1894 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); | 1894 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); |
1895 j(not_equal, fail); | 1895 j(not_equal, fail); |
1896 } | 1896 } |
1897 | 1897 |
1898 | 1898 |
| 1899 void MacroAssembler::CheckMaps(Register obj, |
| 1900 ZoneMapList* receiver_maps, |
| 1901 Label* fail, |
| 1902 bool is_heap_object) { |
| 1903 if (!is_heap_object) { |
| 1904 testb(obj, Immediate(kSmiTagMask)); |
| 1905 j(zero, fail); |
| 1906 } |
| 1907 |
| 1908 // Check that the map matches. |
| 1909 if (receiver_maps->length() == 0) { |
| 1910 jmp(fail); |
| 1911 } else if (receiver_maps->length() == 1) { |
| 1912 Cmp(FieldOperand(obj, HeapObject::kMapOffset), receiver_maps->at(0)); |
| 1913 j(not_equal, fail); |
| 1914 } else { |
| 1915 NearLabel map_match; |
| 1916 for (int current = 0; current < receiver_maps->length() - 1; ++current) { |
| 1917 Handle<Map> current_map = receiver_maps->at(current); |
| 1918 Cmp(FieldOperand(obj, HeapObject::kMapOffset), current_map); |
| 1919 j(equal, &map_match); |
| 1920 } |
| 1921 Cmp(FieldOperand(obj, HeapObject::kMapOffset), |
| 1922 receiver_maps->at(receiver_maps->length()-1)); |
| 1923 j(not_equal, fail); |
| 1924 bind(&map_match); |
| 1925 } |
| 1926 } |
| 1927 |
| 1928 |
1899 void MacroAssembler::AbortIfNotNumber(Register object) { | 1929 void MacroAssembler::AbortIfNotNumber(Register object) { |
1900 NearLabel ok; | 1930 NearLabel ok; |
1901 Condition is_smi = CheckSmi(object); | 1931 Condition is_smi = CheckSmi(object); |
1902 j(is_smi, &ok); | 1932 j(is_smi, &ok); |
1903 Cmp(FieldOperand(object, HeapObject::kMapOffset), | 1933 Cmp(FieldOperand(object, HeapObject::kMapOffset), |
1904 isolate()->factory()->heap_number_map()); | 1934 isolate()->factory()->heap_number_map()); |
1905 Assert(equal, "Operand not a number"); | 1935 Assert(equal, "Operand not a number"); |
1906 bind(&ok); | 1936 bind(&ok); |
1907 } | 1937 } |
1908 | 1938 |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2910 CPU::FlushICache(address_, size_); | 2940 CPU::FlushICache(address_, size_); |
2911 | 2941 |
2912 // Check that the code was patched as expected. | 2942 // Check that the code was patched as expected. |
2913 ASSERT(masm_.pc_ == address_ + size_); | 2943 ASSERT(masm_.pc_ == address_ + size_); |
2914 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2944 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2915 } | 2945 } |
2916 | 2946 |
2917 } } // namespace v8::internal | 2947 } } // namespace v8::internal |
2918 | 2948 |
2919 #endif // V8_TARGET_ARCH_X64 | 2949 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |