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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 // Check that there are no elements. Register rcx contains the | 889 // Check that there are no elements. Register rcx contains the |
890 // current JS object we've reached through the prototype chain. | 890 // current JS object we've reached through the prototype chain. |
891 __ cmpq(empty_fixed_array_value, | 891 __ cmpq(empty_fixed_array_value, |
892 FieldOperand(rcx, JSObject::kElementsOffset)); | 892 FieldOperand(rcx, JSObject::kElementsOffset)); |
893 __ j(not_equal, &call_runtime); | 893 __ j(not_equal, &call_runtime); |
894 | 894 |
895 // Check that instance descriptors are not empty so that we can | 895 // Check that instance descriptors are not empty so that we can |
896 // check for an enum cache. Leave the map in rbx for the subsequent | 896 // check for an enum cache. Leave the map in rbx for the subsequent |
897 // prototype load. | 897 // prototype load. |
898 __ movq(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); | 898 __ movq(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); |
899 __ movq(rdx, FieldOperand(rbx, Map::kInstanceDescriptorsOffset)); | 899 __ movq(rdx, FieldOperand(rbx, Map::kInstanceDescriptorsOrBitField3Offset)); |
900 __ cmpq(rdx, empty_descriptor_array_value); | 900 __ JumpIfSmi(rdx, &call_runtime); |
901 __ j(equal, &call_runtime); | |
902 | 901 |
903 // Check that there is an enum cache in the non-empty instance | 902 // Check that there is an enum cache in the non-empty instance |
904 // descriptors (rdx). This is the case if the next enumeration | 903 // descriptors (rdx). This is the case if the next enumeration |
905 // index field does not contain a smi. | 904 // index field does not contain a smi. |
906 __ movq(rdx, FieldOperand(rdx, DescriptorArray::kEnumerationIndexOffset)); | 905 __ movq(rdx, FieldOperand(rdx, DescriptorArray::kEnumerationIndexOffset)); |
907 __ JumpIfSmi(rdx, &call_runtime); | 906 __ JumpIfSmi(rdx, &call_runtime); |
908 | 907 |
909 // For all objects but the receiver, check that the cache is empty. | 908 // For all objects but the receiver, check that the cache is empty. |
910 Label check_prototype; | 909 Label check_prototype; |
911 __ cmpq(rcx, rax); | 910 __ cmpq(rcx, rax); |
(...skipping 22 matching lines...) Expand all Loading... |
934 // If we got a map from the runtime call, we can do a fast | 933 // If we got a map from the runtime call, we can do a fast |
935 // modification check. Otherwise, we got a fixed array, and we have | 934 // modification check. Otherwise, we got a fixed array, and we have |
936 // to do a slow check. | 935 // to do a slow check. |
937 Label fixed_array; | 936 Label fixed_array; |
938 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), | 937 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), |
939 Heap::kMetaMapRootIndex); | 938 Heap::kMetaMapRootIndex); |
940 __ j(not_equal, &fixed_array, Label::kNear); | 939 __ j(not_equal, &fixed_array, Label::kNear); |
941 | 940 |
942 // We got a map in register rax. Get the enumeration cache from it. | 941 // We got a map in register rax. Get the enumeration cache from it. |
943 __ bind(&use_cache); | 942 __ bind(&use_cache); |
944 __ movq(rcx, FieldOperand(rax, Map::kInstanceDescriptorsOffset)); | 943 __ LoadInstanceDescriptors(rax, rcx); |
945 __ movq(rcx, FieldOperand(rcx, DescriptorArray::kEnumerationIndexOffset)); | 944 __ movq(rcx, FieldOperand(rcx, DescriptorArray::kEnumerationIndexOffset)); |
946 __ movq(rdx, FieldOperand(rcx, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 945 __ movq(rdx, FieldOperand(rcx, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
947 | 946 |
948 // Setup the four remaining stack slots. | 947 // Setup the four remaining stack slots. |
949 __ push(rax); // Map. | 948 __ push(rax); // Map. |
950 __ push(rdx); // Enumeration cache. | 949 __ push(rdx); // Enumeration cache. |
951 __ movq(rax, FieldOperand(rdx, FixedArray::kLengthOffset)); | 950 __ movq(rax, FieldOperand(rdx, FixedArray::kLengthOffset)); |
952 __ push(rax); // Enumeration cache length (as smi). | 951 __ push(rax); // Enumeration cache length (as smi). |
953 __ Push(Smi::FromInt(0)); // Initial index. | 952 __ Push(Smi::FromInt(0)); // Initial index. |
954 __ jmp(&loop); | 953 __ jmp(&loop); |
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2435 | 2434 |
2436 // Check for fast case object. Generate false result for slow case object. | 2435 // Check for fast case object. Generate false result for slow case object. |
2437 __ movq(rcx, FieldOperand(rax, JSObject::kPropertiesOffset)); | 2436 __ movq(rcx, FieldOperand(rax, JSObject::kPropertiesOffset)); |
2438 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset)); | 2437 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset)); |
2439 __ CompareRoot(rcx, Heap::kHashTableMapRootIndex); | 2438 __ CompareRoot(rcx, Heap::kHashTableMapRootIndex); |
2440 __ j(equal, if_false); | 2439 __ j(equal, if_false); |
2441 | 2440 |
2442 // Look for valueOf symbol in the descriptor array, and indicate false if | 2441 // Look for valueOf symbol in the descriptor array, and indicate false if |
2443 // found. The type is not checked, so if it is a transition it is a false | 2442 // found. The type is not checked, so if it is a transition it is a false |
2444 // negative. | 2443 // negative. |
2445 __ movq(rbx, FieldOperand(rbx, Map::kInstanceDescriptorsOffset)); | 2444 __ LoadInstanceDescriptors(rbx, rbx); |
2446 __ movq(rcx, FieldOperand(rbx, FixedArray::kLengthOffset)); | 2445 __ movq(rcx, FieldOperand(rbx, FixedArray::kLengthOffset)); |
2447 // rbx: descriptor array | 2446 // rbx: descriptor array |
2448 // rcx: length of descriptor array | 2447 // rcx: length of descriptor array |
2449 // Calculate the end of the descriptor array. | 2448 // Calculate the end of the descriptor array. |
2450 SmiIndex index = masm_->SmiToIndex(rdx, rcx, kPointerSizeLog2); | 2449 SmiIndex index = masm_->SmiToIndex(rdx, rcx, kPointerSizeLog2); |
2451 __ lea(rcx, | 2450 __ lea(rcx, |
2452 Operand( | 2451 Operand( |
2453 rbx, index.reg, index.scale, FixedArray::kHeaderSize)); | 2452 rbx, index.reg, index.scale, FixedArray::kHeaderSize)); |
2454 // Calculate location of the first key name. | 2453 // Calculate location of the first key name. |
2455 __ addq(rbx, | 2454 __ addq(rbx, |
(...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4292 __ ret(0); | 4291 __ ret(0); |
4293 } | 4292 } |
4294 | 4293 |
4295 | 4294 |
4296 #undef __ | 4295 #undef __ |
4297 | 4296 |
4298 | 4297 |
4299 } } // namespace v8::internal | 4298 } } // namespace v8::internal |
4300 | 4299 |
4301 #endif // V8_TARGET_ARCH_X64 | 4300 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |