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 2850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2861 &fail, | 2861 &fail, |
2862 DONT_DO_SMI_CHECK); | 2862 DONT_DO_SMI_CHECK); |
2863 movq(descriptors, FieldOperand(temp, TransitionArray::kDescriptorsOffset)); | 2863 movq(descriptors, FieldOperand(temp, TransitionArray::kDescriptorsOffset)); |
2864 jmp(&ok); | 2864 jmp(&ok); |
2865 bind(&fail); | 2865 bind(&fail); |
2866 Move(descriptors, isolate()->factory()->empty_descriptor_array()); | 2866 Move(descriptors, isolate()->factory()->empty_descriptor_array()); |
2867 bind(&ok); | 2867 bind(&ok); |
2868 } | 2868 } |
2869 | 2869 |
2870 | 2870 |
| 2871 void MacroAssembler::EnumLength(Register dst, Register map) { |
| 2872 movq(dst, FieldOperand(map, Map::kBitField3Offset)); |
| 2873 DecodeField<Map::EnumLengthBits>(dst); |
| 2874 } |
| 2875 |
| 2876 |
2871 void MacroAssembler::DispatchMap(Register obj, | 2877 void MacroAssembler::DispatchMap(Register obj, |
2872 Handle<Map> map, | 2878 Handle<Map> map, |
2873 Handle<Code> success, | 2879 Handle<Code> success, |
2874 SmiCheckType smi_check_type) { | 2880 SmiCheckType smi_check_type) { |
2875 Label fail; | 2881 Label fail; |
2876 if (smi_check_type == DO_SMI_CHECK) { | 2882 if (smi_check_type == DO_SMI_CHECK) { |
2877 JumpIfSmi(obj, &fail); | 2883 JumpIfSmi(obj, &fail); |
2878 } | 2884 } |
2879 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); | 2885 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); |
2880 j(equal, success, RelocInfo::CODE_TARGET); | 2886 j(equal, success, RelocInfo::CODE_TARGET); |
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4438 or_(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch); | 4444 or_(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch); |
4439 | 4445 |
4440 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); | 4446 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); |
4441 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); | 4447 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); |
4442 | 4448 |
4443 bind(&done); | 4449 bind(&done); |
4444 } | 4450 } |
4445 | 4451 |
4446 | 4452 |
4447 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { | 4453 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { |
4448 Label next; | 4454 Label next, start; |
4449 Register empty_fixed_array_value = r8; | 4455 Register empty_fixed_array_value = r8; |
4450 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); | 4456 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); |
4451 Register empty_descriptor_array_value = r9; | |
4452 LoadRoot(empty_descriptor_array_value, | |
4453 Heap::kEmptyDescriptorArrayRootIndex); | |
4454 movq(rcx, rax); | 4457 movq(rcx, rax); |
| 4458 |
| 4459 // Check if the enum length field is properly initialized, indicating that |
| 4460 // there is an enum cache. |
| 4461 movq(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); |
| 4462 |
| 4463 EnumLength(rdx, rbx); |
| 4464 cmpq(rdx, Immediate(Map::kInvalidEnumCache)); |
| 4465 j(equal, call_runtime); |
| 4466 |
| 4467 jmp(&start); |
| 4468 |
4455 bind(&next); | 4469 bind(&next); |
4456 | 4470 |
4457 // Check that there are no elements. Register rcx contains the | 4471 movq(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); |
4458 // current JS object we've reached through the prototype chain. | 4472 |
| 4473 // For all objects but the receiver, check that the cache is empty. |
| 4474 EnumLength(rdx, rbx); |
| 4475 cmpq(rdx, Immediate(0)); |
| 4476 j(not_equal, call_runtime); |
| 4477 |
| 4478 bind(&start); |
| 4479 |
| 4480 // Check that there are no elements. Register rcx contains the current JS |
| 4481 // object we've reached through the prototype chain. |
4459 cmpq(empty_fixed_array_value, | 4482 cmpq(empty_fixed_array_value, |
4460 FieldOperand(rcx, JSObject::kElementsOffset)); | 4483 FieldOperand(rcx, JSObject::kElementsOffset)); |
4461 j(not_equal, call_runtime); | 4484 j(not_equal, call_runtime); |
4462 | 4485 |
4463 // Check that instance descriptors are not empty so that we can | |
4464 // check for an enum cache. Leave the map in rbx for the subsequent | |
4465 // prototype load. | |
4466 movq(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); | |
4467 movq(rdx, FieldOperand(rbx, Map::kTransitionsOrBackPointerOffset)); | |
4468 | |
4469 CheckMap(rdx, | |
4470 isolate()->factory()->fixed_array_map(), | |
4471 call_runtime, | |
4472 DONT_DO_SMI_CHECK); | |
4473 | |
4474 movq(rdx, FieldOperand(rdx, TransitionArray::kDescriptorsOffset)); | |
4475 cmpq(rdx, empty_descriptor_array_value); | |
4476 j(equal, call_runtime); | |
4477 | |
4478 // Check that there is an enum cache in the non-empty instance | |
4479 // descriptors (rdx). This is the case if the next enumeration | |
4480 // index field does not contain a smi. | |
4481 movq(rdx, FieldOperand(rdx, DescriptorArray::kEnumCacheOffset)); | |
4482 JumpIfSmi(rdx, call_runtime); | |
4483 | |
4484 // For all objects but the receiver, check that the cache is empty. | |
4485 Label check_prototype; | |
4486 cmpq(rcx, rax); | |
4487 j(equal, &check_prototype, Label::kNear); | |
4488 movq(rdx, FieldOperand(rdx, DescriptorArray::kEnumCacheBridgeCacheOffset)); | |
4489 cmpq(rdx, empty_fixed_array_value); | |
4490 j(not_equal, call_runtime); | |
4491 | |
4492 // Load the prototype from the map and loop if non-null. | |
4493 bind(&check_prototype); | |
4494 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4486 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
4495 cmpq(rcx, null_value); | 4487 cmpq(rcx, null_value); |
4496 j(not_equal, &next); | 4488 j(not_equal, &next); |
4497 } | 4489 } |
4498 | 4490 |
4499 | 4491 |
4500 } } // namespace v8::internal | 4492 } } // namespace v8::internal |
4501 | 4493 |
4502 #endif // V8_TARGET_ARCH_X64 | 4494 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |