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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
922 Label convert, done_convert; | 922 Label convert, done_convert; |
923 __ JumpIfSmi(r0, &convert); | 923 __ JumpIfSmi(r0, &convert); |
924 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE); | 924 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE); |
925 __ b(ge, &done_convert); | 925 __ b(ge, &done_convert); |
926 __ bind(&convert); | 926 __ bind(&convert); |
927 __ push(r0); | 927 __ push(r0); |
928 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 928 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
929 __ bind(&done_convert); | 929 __ bind(&done_convert); |
930 __ push(r0); | 930 __ push(r0); |
931 | 931 |
932 // Check for proxies. | |
933 Label call_runtime; | |
934 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | |
935 __ CompareObjectType(r0, r1, r1, LAST_JS_PROXY_TYPE); | |
936 __ b(le, &call_runtime); | |
937 | |
932 // Check cache validity in generated code. This is a fast case for | 938 // Check cache validity in generated code. This is a fast case for |
933 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 939 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
934 // guarantee cache validity, call the runtime system to check cache | 940 // guarantee cache validity, call the runtime system to check cache |
935 // validity or get the property names in a fixed array. | 941 // validity or get the property names in a fixed array. |
936 Label next, call_runtime; | 942 Label next; |
937 // Preload a couple of values used in the loop. | 943 // Preload a couple of values used in the loop. |
938 Register empty_fixed_array_value = r6; | 944 Register empty_fixed_array_value = r6; |
939 __ LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); | 945 __ LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); |
940 Register empty_descriptor_array_value = r7; | 946 Register empty_descriptor_array_value = r7; |
941 __ LoadRoot(empty_descriptor_array_value, | 947 __ LoadRoot(empty_descriptor_array_value, |
942 Heap::kEmptyDescriptorArrayRootIndex); | 948 Heap::kEmptyDescriptorArrayRootIndex); |
943 __ mov(r1, r0); | 949 __ mov(r1, r0); |
944 __ bind(&next); | 950 __ bind(&next); |
945 | 951 |
946 // Check that there are no elements. Register r1 contains the | 952 // Check that there are no elements. Register r1 contains the |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1005 | 1011 |
1006 // Setup the four remaining stack slots. | 1012 // Setup the four remaining stack slots. |
1007 __ push(r0); // Map. | 1013 __ push(r0); // Map. |
1008 __ ldr(r1, FieldMemOperand(r2, FixedArray::kLengthOffset)); | 1014 __ ldr(r1, FieldMemOperand(r2, FixedArray::kLengthOffset)); |
1009 __ mov(r0, Operand(Smi::FromInt(0))); | 1015 __ mov(r0, Operand(Smi::FromInt(0))); |
1010 // Push enumeration cache, enumeration cache length (as smi) and zero. | 1016 // Push enumeration cache, enumeration cache length (as smi) and zero. |
1011 __ Push(r2, r1, r0); | 1017 __ Push(r2, r1, r0); |
1012 __ jmp(&loop); | 1018 __ jmp(&loop); |
1013 | 1019 |
1014 // We got a fixed array in register r0. Iterate through that. | 1020 // We got a fixed array in register r0. Iterate through that. |
1021 Label non_proxy; | |
1015 __ bind(&fixed_array); | 1022 __ bind(&fixed_array); |
1016 __ mov(r1, Operand(Smi::FromInt(0))); // Map (0) - force slow check. | 1023 __ mov(r1, Operand(Smi::FromInt(1))); // smi indicates slow check |
Rico
2011/10/20 14:25:31
Capitalize start of comment + below
rossberg
2011/10/24 13:31:35
Done.
| |
1017 __ Push(r1, r0); | 1024 __ ldr(r2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object |
1025 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | |
1026 __ CompareObjectType(r2, r3, r3, LAST_JS_PROXY_TYPE); | |
1027 __ b(gt, &non_proxy); | |
1028 __ mov(r1, Operand(Smi::FromInt(0))); // zero indicates proxy | |
1029 __ bind(&non_proxy); | |
1030 __ Push(r1, r0); // map or smi, and array | |
Rico
2011/10/20 14:25:31
how can r1 be a map, we either load smi 1 or smi 0
rossberg
2011/10/24 13:31:35
Done.
| |
1018 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 1031 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
1019 __ mov(r0, Operand(Smi::FromInt(0))); | 1032 __ mov(r0, Operand(Smi::FromInt(0))); |
1020 __ Push(r1, r0); // Fixed array length (as smi) and initial index. | 1033 __ Push(r1, r0); // Fixed array length (as smi) and initial index. |
1021 | 1034 |
1022 // Generate code for doing the condition check. | 1035 // Generate code for doing the condition check. |
1023 __ bind(&loop); | 1036 __ bind(&loop); |
1024 // Load the current count to r0, load the length to r1. | 1037 // Load the current count to r0, load the length to r1. |
1025 __ Ldrd(r0, r1, MemOperand(sp, 0 * kPointerSize)); | 1038 __ Ldrd(r0, r1, MemOperand(sp, 0 * kPointerSize)); |
1026 __ cmp(r0, r1); // Compare to the array length. | 1039 __ cmp(r0, r1); // Compare to the array length. |
1027 __ b(hs, loop_statement.break_label()); | 1040 __ b(hs, loop_statement.break_label()); |
1028 | 1041 |
1029 // Get the current entry of the array into register r3. | 1042 // Get the current entry of the array into register r3. |
1030 __ ldr(r2, MemOperand(sp, 2 * kPointerSize)); | 1043 __ ldr(r2, MemOperand(sp, 2 * kPointerSize)); |
1031 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 1044 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
1032 __ ldr(r3, MemOperand(r2, r0, LSL, kPointerSizeLog2 - kSmiTagSize)); | 1045 __ ldr(r3, MemOperand(r2, r0, LSL, kPointerSizeLog2 - kSmiTagSize)); |
1033 | 1046 |
1034 // Get the expected map from the stack or a zero map in the | 1047 // Get the expected map from the stack or a smi in the |
1035 // permanent slow case into register r2. | 1048 // permanent slow case into register r2. |
1036 __ ldr(r2, MemOperand(sp, 3 * kPointerSize)); | 1049 __ ldr(r2, MemOperand(sp, 3 * kPointerSize)); |
1037 | 1050 |
1038 // Check if the expected map still matches that of the enumerable. | 1051 // Check if the expected map still matches that of the enumerable. |
1039 // If not, we have to filter the key. | 1052 // If not, we may have to filter the key. |
1040 Label update_each; | 1053 Label update_each; |
1041 __ ldr(r1, MemOperand(sp, 4 * kPointerSize)); | 1054 __ ldr(r1, MemOperand(sp, 4 * kPointerSize)); |
1042 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset)); | 1055 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset)); |
1043 __ cmp(r4, Operand(r2)); | 1056 __ cmp(r4, Operand(r2)); |
1044 __ b(eq, &update_each); | 1057 __ b(eq, &update_each); |
1045 | 1058 |
1059 // For proxies, no filtering is done. | |
1060 // TODO(rossberg): What if only a prototype is a proxy? Not specified. | |
Rico
2011/10/20 14:25:31
Please file a bug
rossberg
2011/10/24 13:31:35
Will note it in bug v8:1543.
| |
1061 __ cmp(r2, Operand(Smi::FromInt(0))); | |
1062 __ b(eq, &update_each); | |
1063 | |
1046 // Convert the entry to a string or (smi) 0 if it isn't a property | 1064 // Convert the entry to a string or (smi) 0 if it isn't a property |
1047 // any more. If the property has been removed while iterating, we | 1065 // any more. If the property has been removed while iterating, we |
1048 // just skip it. | 1066 // just skip it. |
1049 __ push(r1); // Enumerable. | 1067 __ push(r1); // Enumerable. |
1050 __ push(r3); // Current entry. | 1068 __ push(r3); // Current entry. |
1051 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION); | 1069 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION); |
1052 __ mov(r3, Operand(r0), SetCC); | 1070 __ mov(r3, Operand(r0), SetCC); |
1053 __ b(eq, loop_statement.continue_label()); | 1071 __ b(eq, loop_statement.continue_label()); |
1054 | 1072 |
1055 // Update the 'each' property or variable from the possibly filtered | 1073 // Update the 'each' property or variable from the possibly filtered |
(...skipping 3212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4268 *context_length = 0; | 4286 *context_length = 0; |
4269 return previous_; | 4287 return previous_; |
4270 } | 4288 } |
4271 | 4289 |
4272 | 4290 |
4273 #undef __ | 4291 #undef __ |
4274 | 4292 |
4275 } } // namespace v8::internal | 4293 } } // namespace v8::internal |
4276 | 4294 |
4277 #endif // V8_TARGET_ARCH_ARM | 4295 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |