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 4346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4357 // Value is a data object, and it is white. Mark it black. Since we know | 4357 // Value is a data object, and it is white. Mark it black. Since we know |
4358 // that the object is white we can make it black by flipping one bit. | 4358 // that the object is white we can make it black by flipping one bit. |
4359 or_(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch); | 4359 or_(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch); |
4360 | 4360 |
4361 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); | 4361 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); |
4362 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); | 4362 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); |
4363 | 4363 |
4364 bind(&done); | 4364 bind(&done); |
4365 } | 4365 } |
4366 | 4366 |
| 4367 |
| 4368 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { |
| 4369 Label next; |
| 4370 Register empty_fixed_array_value = r8; |
| 4371 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); |
| 4372 Register empty_descriptor_array_value = r9; |
| 4373 LoadRoot(empty_descriptor_array_value, |
| 4374 Heap::kEmptyDescriptorArrayRootIndex); |
| 4375 movq(rcx, rax); |
| 4376 bind(&next); |
| 4377 |
| 4378 // Check that there are no elements. Register rcx contains the |
| 4379 // current JS object we've reached through the prototype chain. |
| 4380 cmpq(empty_fixed_array_value, |
| 4381 FieldOperand(rcx, JSObject::kElementsOffset)); |
| 4382 j(not_equal, call_runtime); |
| 4383 |
| 4384 // Check that instance descriptors are not empty so that we can |
| 4385 // check for an enum cache. Leave the map in rbx for the subsequent |
| 4386 // prototype load. |
| 4387 movq(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); |
| 4388 movq(rdx, FieldOperand(rbx, Map::kInstanceDescriptorsOrBitField3Offset)); |
| 4389 JumpIfSmi(rdx, call_runtime); |
| 4390 |
| 4391 // Check that there is an enum cache in the non-empty instance |
| 4392 // descriptors (rdx). This is the case if the next enumeration |
| 4393 // index field does not contain a smi. |
| 4394 movq(rdx, FieldOperand(rdx, DescriptorArray::kEnumerationIndexOffset)); |
| 4395 JumpIfSmi(rdx, call_runtime); |
| 4396 |
| 4397 // For all objects but the receiver, check that the cache is empty. |
| 4398 Label check_prototype; |
| 4399 cmpq(rcx, rax); |
| 4400 j(equal, &check_prototype, Label::kNear); |
| 4401 movq(rdx, FieldOperand(rdx, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
| 4402 cmpq(rdx, empty_fixed_array_value); |
| 4403 j(not_equal, call_runtime); |
| 4404 |
| 4405 // Load the prototype from the map and loop if non-null. |
| 4406 bind(&check_prototype); |
| 4407 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
| 4408 cmpq(rcx, null_value); |
| 4409 j(not_equal, &next); |
| 4410 } |
| 4411 |
| 4412 |
4367 } } // namespace v8::internal | 4413 } } // namespace v8::internal |
4368 | 4414 |
4369 #endif // V8_TARGET_ARCH_X64 | 4415 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |