| 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 2880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2891 &fail, | 2891 &fail, |
| 2892 DONT_DO_SMI_CHECK); | 2892 DONT_DO_SMI_CHECK); |
| 2893 movq(descriptors, FieldOperand(temp, TransitionArray::kDescriptorsOffset)); | 2893 movq(descriptors, FieldOperand(temp, TransitionArray::kDescriptorsOffset)); |
| 2894 jmp(&ok); | 2894 jmp(&ok); |
| 2895 bind(&fail); | 2895 bind(&fail); |
| 2896 Move(descriptors, isolate()->factory()->empty_descriptor_array()); | 2896 Move(descriptors, isolate()->factory()->empty_descriptor_array()); |
| 2897 bind(&ok); | 2897 bind(&ok); |
| 2898 } | 2898 } |
| 2899 | 2899 |
| 2900 | 2900 |
| 2901 void MacroAssembler::EnumLength(Register dst, Register map) { |
| 2902 STATIC_ASSERT(Map::EnumLengthBits::kShift == 0); |
| 2903 movq(dst, FieldOperand(map, Map::kBitField3Offset)); |
| 2904 Move(kScratchRegister, Smi::FromInt(Map::EnumLengthBits::kMask)); |
| 2905 and_(dst, kScratchRegister); |
| 2906 } |
| 2907 |
| 2908 |
| 2901 void MacroAssembler::DispatchMap(Register obj, | 2909 void MacroAssembler::DispatchMap(Register obj, |
| 2902 Handle<Map> map, | 2910 Handle<Map> map, |
| 2903 Handle<Code> success, | 2911 Handle<Code> success, |
| 2904 SmiCheckType smi_check_type) { | 2912 SmiCheckType smi_check_type) { |
| 2905 Label fail; | 2913 Label fail; |
| 2906 if (smi_check_type == DO_SMI_CHECK) { | 2914 if (smi_check_type == DO_SMI_CHECK) { |
| 2907 JumpIfSmi(obj, &fail); | 2915 JumpIfSmi(obj, &fail); |
| 2908 } | 2916 } |
| 2909 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); | 2917 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); |
| 2910 j(equal, success, RelocInfo::CODE_TARGET); | 2918 j(equal, success, RelocInfo::CODE_TARGET); |
| (...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4472 or_(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch); | 4480 or_(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch); |
| 4473 | 4481 |
| 4474 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); | 4482 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); |
| 4475 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); | 4483 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); |
| 4476 | 4484 |
| 4477 bind(&done); | 4485 bind(&done); |
| 4478 } | 4486 } |
| 4479 | 4487 |
| 4480 | 4488 |
| 4481 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { | 4489 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { |
| 4482 Label next; | 4490 Label next, start; |
| 4483 Register empty_fixed_array_value = r8; | 4491 Register empty_fixed_array_value = r8; |
| 4484 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); | 4492 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); |
| 4485 Register empty_descriptor_array_value = r9; | |
| 4486 LoadRoot(empty_descriptor_array_value, | |
| 4487 Heap::kEmptyDescriptorArrayRootIndex); | |
| 4488 movq(rcx, rax); | 4493 movq(rcx, rax); |
| 4494 |
| 4495 // Check if the enum length field is properly initialized, indicating that |
| 4496 // there is an enum cache. |
| 4497 movq(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); |
| 4498 |
| 4499 EnumLength(rdx, rbx); |
| 4500 Cmp(rdx, Smi::FromInt(Map::kInvalidEnumCache)); |
| 4501 j(equal, call_runtime); |
| 4502 |
| 4503 jmp(&start); |
| 4504 |
| 4489 bind(&next); | 4505 bind(&next); |
| 4490 | 4506 |
| 4491 // Check that there are no elements. Register rcx contains the | 4507 movq(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); |
| 4492 // current JS object we've reached through the prototype chain. | 4508 |
| 4509 // For all objects but the receiver, check that the cache is empty. |
| 4510 EnumLength(rdx, rbx); |
| 4511 Cmp(rdx, Smi::FromInt(0)); |
| 4512 j(not_equal, call_runtime); |
| 4513 |
| 4514 bind(&start); |
| 4515 |
| 4516 // Check that there are no elements. Register rcx contains the current JS |
| 4517 // object we've reached through the prototype chain. |
| 4493 cmpq(empty_fixed_array_value, | 4518 cmpq(empty_fixed_array_value, |
| 4494 FieldOperand(rcx, JSObject::kElementsOffset)); | 4519 FieldOperand(rcx, JSObject::kElementsOffset)); |
| 4495 j(not_equal, call_runtime); | 4520 j(not_equal, call_runtime); |
| 4496 | 4521 |
| 4497 // Check that instance descriptors are not empty so that we can | |
| 4498 // check for an enum cache. Leave the map in rbx for the subsequent | |
| 4499 // prototype load. | |
| 4500 movq(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); | |
| 4501 movq(rdx, FieldOperand(rbx, Map::kTransitionsOrBackPointerOffset)); | |
| 4502 | |
| 4503 CheckMap(rdx, | |
| 4504 isolate()->factory()->fixed_array_map(), | |
| 4505 call_runtime, | |
| 4506 DONT_DO_SMI_CHECK); | |
| 4507 | |
| 4508 movq(rdx, FieldOperand(rdx, TransitionArray::kDescriptorsOffset)); | |
| 4509 cmpq(rdx, empty_descriptor_array_value); | |
| 4510 j(equal, call_runtime); | |
| 4511 | |
| 4512 // Check that there is an enum cache in the non-empty instance | |
| 4513 // descriptors (rdx). This is the case if the next enumeration | |
| 4514 // index field does not contain a smi. | |
| 4515 movq(rdx, FieldOperand(rdx, DescriptorArray::kEnumCacheOffset)); | |
| 4516 JumpIfSmi(rdx, call_runtime); | |
| 4517 | |
| 4518 // For all objects but the receiver, check that the cache is empty. | |
| 4519 Label check_prototype; | |
| 4520 cmpq(rcx, rax); | |
| 4521 j(equal, &check_prototype, Label::kNear); | |
| 4522 movq(rdx, FieldOperand(rdx, DescriptorArray::kEnumCacheBridgeCacheOffset)); | |
| 4523 cmpq(rdx, empty_fixed_array_value); | |
| 4524 j(not_equal, call_runtime); | |
| 4525 | |
| 4526 // Load the prototype from the map and loop if non-null. | |
| 4527 bind(&check_prototype); | |
| 4528 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4522 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
| 4529 cmpq(rcx, null_value); | 4523 cmpq(rcx, null_value); |
| 4530 j(not_equal, &next); | 4524 j(not_equal, &next); |
| 4531 } | 4525 } |
| 4532 | 4526 |
| 4533 | 4527 |
| 4534 } } // namespace v8::internal | 4528 } } // namespace v8::internal |
| 4535 | 4529 |
| 4536 #endif // V8_TARGET_ARCH_X64 | 4530 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |