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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 // Check that there are no elements. Register ecx contains the | 880 // Check that there are no elements. Register ecx contains the |
881 // current JS object we've reached through the prototype chain. | 881 // current JS object we've reached through the prototype chain. |
882 __ cmp(FieldOperand(ecx, JSObject::kElementsOffset), | 882 __ cmp(FieldOperand(ecx, JSObject::kElementsOffset), |
883 isolate()->factory()->empty_fixed_array()); | 883 isolate()->factory()->empty_fixed_array()); |
884 __ j(not_equal, &call_runtime); | 884 __ j(not_equal, &call_runtime); |
885 | 885 |
886 // Check that instance descriptors are not empty so that we can | 886 // Check that instance descriptors are not empty so that we can |
887 // check for an enum cache. Leave the map in ebx for the subsequent | 887 // check for an enum cache. Leave the map in ebx for the subsequent |
888 // prototype load. | 888 // prototype load. |
889 __ mov(ebx, FieldOperand(ecx, HeapObject::kMapOffset)); | 889 __ mov(ebx, FieldOperand(ecx, HeapObject::kMapOffset)); |
890 __ mov(edx, FieldOperand(ebx, Map::kInstanceDescriptorsOffset)); | 890 __ mov(edx, FieldOperand(ebx, Map::kInstanceDescriptorsOrBitField3Offset)); |
891 __ cmp(edx, isolate()->factory()->empty_descriptor_array()); | 891 __ JumpIfSmi(edx, &call_runtime); |
892 __ j(equal, &call_runtime); | |
893 | 892 |
894 // Check that there is an enum cache in the non-empty instance | 893 // Check that there is an enum cache in the non-empty instance |
895 // descriptors (edx). This is the case if the next enumeration | 894 // descriptors (edx). This is the case if the next enumeration |
896 // index field does not contain a smi. | 895 // index field does not contain a smi. |
897 __ mov(edx, FieldOperand(edx, DescriptorArray::kEnumerationIndexOffset)); | 896 __ mov(edx, FieldOperand(edx, DescriptorArray::kEnumerationIndexOffset)); |
898 __ test(edx, Immediate(kSmiTagMask)); | 897 __ test(edx, Immediate(kSmiTagMask)); |
899 __ j(zero, &call_runtime); | 898 __ j(zero, &call_runtime); |
900 | 899 |
901 // For all objects but the receiver, check that the cache is empty. | 900 // For all objects but the receiver, check that the cache is empty. |
902 Label check_prototype; | 901 Label check_prototype; |
(...skipping 23 matching lines...) Expand all Loading... |
926 // If we got a map from the runtime call, we can do a fast | 925 // If we got a map from the runtime call, we can do a fast |
927 // modification check. Otherwise, we got a fixed array, and we have | 926 // modification check. Otherwise, we got a fixed array, and we have |
928 // to do a slow check. | 927 // to do a slow check. |
929 Label fixed_array; | 928 Label fixed_array; |
930 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), | 929 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), |
931 isolate()->factory()->meta_map()); | 930 isolate()->factory()->meta_map()); |
932 __ j(not_equal, &fixed_array, Label::kNear); | 931 __ j(not_equal, &fixed_array, Label::kNear); |
933 | 932 |
934 // We got a map in register eax. Get the enumeration cache from it. | 933 // We got a map in register eax. Get the enumeration cache from it. |
935 __ bind(&use_cache); | 934 __ bind(&use_cache); |
936 __ mov(ecx, FieldOperand(eax, Map::kInstanceDescriptorsOffset)); | 935 __ LoadInstanceDescriptors(eax, ecx); |
937 __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumerationIndexOffset)); | 936 __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumerationIndexOffset)); |
938 __ mov(edx, FieldOperand(ecx, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 937 __ mov(edx, FieldOperand(ecx, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
939 | 938 |
940 // Setup the four remaining stack slots. | 939 // Setup the four remaining stack slots. |
941 __ push(eax); // Map. | 940 __ push(eax); // Map. |
942 __ push(edx); // Enumeration cache. | 941 __ push(edx); // Enumeration cache. |
943 __ mov(eax, FieldOperand(edx, FixedArray::kLengthOffset)); | 942 __ mov(eax, FieldOperand(edx, FixedArray::kLengthOffset)); |
944 __ push(eax); // Enumeration cache length (as smi). | 943 __ push(eax); // Enumeration cache length (as smi). |
945 __ push(Immediate(Smi::FromInt(0))); // Initial index. | 944 __ push(Immediate(Smi::FromInt(0))); // Initial index. |
946 __ jmp(&loop); | 945 __ jmp(&loop); |
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 | 2464 |
2466 // Check for fast case object. Return false for slow case objects. | 2465 // Check for fast case object. Return false for slow case objects. |
2467 __ mov(ecx, FieldOperand(eax, JSObject::kPropertiesOffset)); | 2466 __ mov(ecx, FieldOperand(eax, JSObject::kPropertiesOffset)); |
2468 __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset)); | 2467 __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset)); |
2469 __ cmp(ecx, FACTORY->hash_table_map()); | 2468 __ cmp(ecx, FACTORY->hash_table_map()); |
2470 __ j(equal, if_false); | 2469 __ j(equal, if_false); |
2471 | 2470 |
2472 // Look for valueOf symbol in the descriptor array, and indicate false if | 2471 // Look for valueOf symbol in the descriptor array, and indicate false if |
2473 // found. The type is not checked, so if it is a transition it is a false | 2472 // found. The type is not checked, so if it is a transition it is a false |
2474 // negative. | 2473 // negative. |
2475 __ mov(ebx, FieldOperand(ebx, Map::kInstanceDescriptorsOffset)); | 2474 __ LoadInstanceDescriptors(ebx, ebx); |
2476 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); | 2475 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); |
2477 // ebx: descriptor array | 2476 // ebx: descriptor array |
2478 // ecx: length of descriptor array | 2477 // ecx: length of descriptor array |
2479 // Calculate the end of the descriptor array. | 2478 // Calculate the end of the descriptor array. |
2480 STATIC_ASSERT(kSmiTag == 0); | 2479 STATIC_ASSERT(kSmiTag == 0); |
2481 STATIC_ASSERT(kSmiTagSize == 1); | 2480 STATIC_ASSERT(kSmiTagSize == 1); |
2482 STATIC_ASSERT(kPointerSize == 4); | 2481 STATIC_ASSERT(kPointerSize == 4); |
2483 __ lea(ecx, Operand(ebx, ecx, times_2, FixedArray::kHeaderSize)); | 2482 __ lea(ecx, Operand(ebx, ecx, times_2, FixedArray::kHeaderSize)); |
2484 // Calculate location of the first key name. | 2483 // Calculate location of the first key name. |
2485 __ add(Operand(ebx), | 2484 __ add(Operand(ebx), |
(...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4315 // And return. | 4314 // And return. |
4316 __ ret(0); | 4315 __ ret(0); |
4317 } | 4316 } |
4318 | 4317 |
4319 | 4318 |
4320 #undef __ | 4319 #undef __ |
4321 | 4320 |
4322 } } // namespace v8::internal | 4321 } } // namespace v8::internal |
4323 | 4322 |
4324 #endif // V8_TARGET_ARCH_IA32 | 4323 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |