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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 bool is_heap_object) { | 196 bool is_heap_object) { |
197 if (!is_heap_object) { | 197 if (!is_heap_object) { |
198 test(obj, Immediate(kSmiTagMask)); | 198 test(obj, Immediate(kSmiTagMask)); |
199 j(zero, fail); | 199 j(zero, fail); |
200 } | 200 } |
201 cmp(FieldOperand(obj, HeapObject::kMapOffset), Immediate(map)); | 201 cmp(FieldOperand(obj, HeapObject::kMapOffset), Immediate(map)); |
202 j(not_equal, fail); | 202 j(not_equal, fail); |
203 } | 203 } |
204 | 204 |
205 | 205 |
| 206 void MacroAssembler::CheckMaps(Register obj, |
| 207 ZoneMapList* receiver_maps, |
| 208 Label* fail, |
| 209 bool is_heap_object) { |
| 210 if (!is_heap_object) { |
| 211 test(obj, Immediate(kSmiTagMask)); |
| 212 j(zero, fail); |
| 213 } |
| 214 |
| 215 // Check that the map matches. |
| 216 if (receiver_maps->length() == 0) { |
| 217 jmp(fail); |
| 218 } else if (receiver_maps->length() == 1) { |
| 219 cmp(FieldOperand(obj, HeapObject::kMapOffset), |
| 220 Immediate(Handle<Map>(receiver_maps->at(0)))); |
| 221 j(not_equal, fail, not_taken); |
| 222 } else { |
| 223 NearLabel map_match; |
| 224 for (int current = 0; current < receiver_maps->length() - 1; ++current) { |
| 225 cmp(FieldOperand(obj, HeapObject::kMapOffset), |
| 226 Immediate(Handle<Map>(receiver_maps->at(current)))); |
| 227 j(equal, &map_match, not_taken); |
| 228 } |
| 229 cmp(FieldOperand(obj, HeapObject::kMapOffset), |
| 230 Immediate(Handle<Map>(receiver_maps->at(receiver_maps->length()-1)))); |
| 231 j(not_equal, fail, not_taken); |
| 232 bind(&map_match); |
| 233 } |
| 234 } |
| 235 |
| 236 |
206 Condition MacroAssembler::IsObjectStringType(Register heap_object, | 237 Condition MacroAssembler::IsObjectStringType(Register heap_object, |
207 Register map, | 238 Register map, |
208 Register instance_type) { | 239 Register instance_type) { |
209 mov(map, FieldOperand(heap_object, HeapObject::kMapOffset)); | 240 mov(map, FieldOperand(heap_object, HeapObject::kMapOffset)); |
210 movzx_b(instance_type, FieldOperand(map, Map::kInstanceTypeOffset)); | 241 movzx_b(instance_type, FieldOperand(map, Map::kInstanceTypeOffset)); |
211 ASSERT(kNotStringTag != 0); | 242 ASSERT(kNotStringTag != 0); |
212 test(instance_type, Immediate(kIsNotStringMask)); | 243 test(instance_type, Immediate(kIsNotStringMask)); |
213 return zero; | 244 return zero; |
214 } | 245 } |
215 | 246 |
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 | 2065 |
2035 // Check that the code was patched as expected. | 2066 // Check that the code was patched as expected. |
2036 ASSERT(masm_.pc_ == address_ + size_); | 2067 ASSERT(masm_.pc_ == address_ + size_); |
2037 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2068 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2038 } | 2069 } |
2039 | 2070 |
2040 | 2071 |
2041 } } // namespace v8::internal | 2072 } } // namespace v8::internal |
2042 | 2073 |
2043 #endif // V8_TARGET_ARCH_IA32 | 2074 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |