| 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 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2916 // Check whether this map has already been checked to be safe for default | 2916 // Check whether this map has already been checked to be safe for default |
| 2917 // valueOf. | 2917 // valueOf. |
| 2918 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); | 2918 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); |
| 2919 __ test_b(FieldOperand(ebx, Map::kBitField2Offset), | 2919 __ test_b(FieldOperand(ebx, Map::kBitField2Offset), |
| 2920 1 << Map::kStringWrapperSafeForDefaultValueOf); | 2920 1 << Map::kStringWrapperSafeForDefaultValueOf); |
| 2921 __ j(not_zero, if_true); | 2921 __ j(not_zero, if_true); |
| 2922 | 2922 |
| 2923 // Check for fast case object. Return false for slow case objects. | 2923 // Check for fast case object. Return false for slow case objects. |
| 2924 __ mov(ecx, FieldOperand(eax, JSObject::kPropertiesOffset)); | 2924 __ mov(ecx, FieldOperand(eax, JSObject::kPropertiesOffset)); |
| 2925 __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset)); | 2925 __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset)); |
| 2926 __ cmp(ecx, FACTORY->hash_table_map()); | 2926 __ cmp(ecx, isolate()->factory()->hash_table_map()); |
| 2927 __ j(equal, if_false); | 2927 __ j(equal, if_false); |
| 2928 | 2928 |
| 2929 // Look for valueOf string in the descriptor array, and indicate false if | 2929 // Look for valueOf string in the descriptor array, and indicate false if |
| 2930 // found. Since we omit an enumeration index check, if it is added via a | 2930 // found. Since we omit an enumeration index check, if it is added via a |
| 2931 // transition that shares its descriptor array, this is a false positive. | 2931 // transition that shares its descriptor array, this is a false positive. |
| 2932 Label entry, loop, done; | 2932 Label entry, loop, done; |
| 2933 | 2933 |
| 2934 // Skip loop if no descriptors are valid. | 2934 // Skip loop if no descriptors are valid. |
| 2935 __ NumberOfOwnDescriptors(ecx, ebx); | 2935 __ NumberOfOwnDescriptors(ecx, ebx); |
| 2936 __ cmp(ecx, 0); | 2936 __ cmp(ecx, 0); |
| 2937 __ j(equal, &done); | 2937 __ j(equal, &done); |
| 2938 | 2938 |
| 2939 __ LoadInstanceDescriptors(ebx, ebx); | 2939 __ LoadInstanceDescriptors(ebx, ebx); |
| 2940 // ebx: descriptor array. | 2940 // ebx: descriptor array. |
| 2941 // ecx: valid entries in the descriptor array. | 2941 // ecx: valid entries in the descriptor array. |
| 2942 // Calculate the end of the descriptor array. | 2942 // Calculate the end of the descriptor array. |
| 2943 STATIC_ASSERT(kSmiTag == 0); | 2943 STATIC_ASSERT(kSmiTag == 0); |
| 2944 STATIC_ASSERT(kSmiTagSize == 1); | 2944 STATIC_ASSERT(kSmiTagSize == 1); |
| 2945 STATIC_ASSERT(kPointerSize == 4); | 2945 STATIC_ASSERT(kPointerSize == 4); |
| 2946 __ imul(ecx, ecx, DescriptorArray::kDescriptorSize); | 2946 __ imul(ecx, ecx, DescriptorArray::kDescriptorSize); |
| 2947 __ lea(ecx, Operand(ebx, ecx, times_2, DescriptorArray::kFirstOffset)); | 2947 __ lea(ecx, Operand(ebx, ecx, times_2, DescriptorArray::kFirstOffset)); |
| 2948 // Calculate location of the first key name. | 2948 // Calculate location of the first key name. |
| 2949 __ add(ebx, Immediate(DescriptorArray::kFirstOffset)); | 2949 __ add(ebx, Immediate(DescriptorArray::kFirstOffset)); |
| 2950 // Loop through all the keys in the descriptor array. If one of these is the | 2950 // Loop through all the keys in the descriptor array. If one of these is the |
| 2951 // internalized string "valueOf" the result is false. | 2951 // internalized string "valueOf" the result is false. |
| 2952 __ jmp(&entry); | 2952 __ jmp(&entry); |
| 2953 __ bind(&loop); | 2953 __ bind(&loop); |
| 2954 __ mov(edx, FieldOperand(ebx, 0)); | 2954 __ mov(edx, FieldOperand(ebx, 0)); |
| 2955 __ cmp(edx, FACTORY->value_of_string()); | 2955 __ cmp(edx, isolate()->factory()->value_of_string()); |
| 2956 __ j(equal, if_false); | 2956 __ j(equal, if_false); |
| 2957 __ add(ebx, Immediate(DescriptorArray::kDescriptorSize * kPointerSize)); | 2957 __ add(ebx, Immediate(DescriptorArray::kDescriptorSize * kPointerSize)); |
| 2958 __ bind(&entry); | 2958 __ bind(&entry); |
| 2959 __ cmp(ebx, ecx); | 2959 __ cmp(ebx, ecx); |
| 2960 __ j(not_equal, &loop); | 2960 __ j(not_equal, &loop); |
| 2961 | 2961 |
| 2962 __ bind(&done); | 2962 __ bind(&done); |
| 2963 | 2963 |
| 2964 // Reload map as register ebx was used as temporary above. | 2964 // Reload map as register ebx was used as temporary above. |
| 2965 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); | 2965 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); |
| (...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4869 *stack_depth = 0; | 4869 *stack_depth = 0; |
| 4870 *context_length = 0; | 4870 *context_length = 0; |
| 4871 return previous_; | 4871 return previous_; |
| 4872 } | 4872 } |
| 4873 | 4873 |
| 4874 #undef __ | 4874 #undef __ |
| 4875 | 4875 |
| 4876 } } // namespace v8::internal | 4876 } } // namespace v8::internal |
| 4877 | 4877 |
| 4878 #endif // V8_TARGET_ARCH_IA32 | 4878 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |