OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2307 // the object) | 2307 // the object) |
2308 __ mov(r1, Operand(r0)); | 2308 __ mov(r1, Operand(r0)); |
2309 __ ldr(r1, FieldMemOperand(r1, Map::kInstanceDescriptorsOffset)); | 2309 __ ldr(r1, FieldMemOperand(r1, Map::kInstanceDescriptorsOffset)); |
2310 __ ldr(r1, FieldMemOperand(r1, DescriptorArray::kEnumerationIndexOffset)); | 2310 __ ldr(r1, FieldMemOperand(r1, DescriptorArray::kEnumerationIndexOffset)); |
2311 __ ldr(r2, | 2311 __ ldr(r2, |
2312 FieldMemOperand(r1, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 2312 FieldMemOperand(r1, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
2313 | 2313 |
2314 frame_->EmitPush(r0); // map | 2314 frame_->EmitPush(r0); // map |
2315 frame_->EmitPush(r2); // enum cache bridge cache | 2315 frame_->EmitPush(r2); // enum cache bridge cache |
2316 __ ldr(r0, FieldMemOperand(r2, FixedArray::kLengthOffset)); | 2316 __ ldr(r0, FieldMemOperand(r2, FixedArray::kLengthOffset)); |
2317 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); | |
2318 frame_->EmitPush(r0); | 2317 frame_->EmitPush(r0); |
2319 __ mov(r0, Operand(Smi::FromInt(0))); | 2318 __ mov(r0, Operand(Smi::FromInt(0))); |
2320 frame_->EmitPush(r0); | 2319 frame_->EmitPush(r0); |
2321 entry.Jump(); | 2320 entry.Jump(); |
2322 | 2321 |
2323 fixed_array.Bind(); | 2322 fixed_array.Bind(); |
2324 __ mov(r1, Operand(Smi::FromInt(0))); | 2323 __ mov(r1, Operand(Smi::FromInt(0))); |
2325 frame_->EmitPush(r1); // insert 0 in place of Map | 2324 frame_->EmitPush(r1); // insert 0 in place of Map |
2326 frame_->EmitPush(r0); | 2325 frame_->EmitPush(r0); |
2327 | 2326 |
2328 // Push the length of the array and the initial index onto the stack. | 2327 // Push the length of the array and the initial index onto the stack. |
2329 __ ldr(r0, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 2328 __ ldr(r0, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
2330 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); | |
2331 frame_->EmitPush(r0); | 2329 frame_->EmitPush(r0); |
2332 __ mov(r0, Operand(Smi::FromInt(0))); // init index | 2330 __ mov(r0, Operand(Smi::FromInt(0))); // init index |
2333 frame_->EmitPush(r0); | 2331 frame_->EmitPush(r0); |
2334 | 2332 |
2335 // Condition. | 2333 // Condition. |
2336 entry.Bind(); | 2334 entry.Bind(); |
2337 // sp[0] : index | 2335 // sp[0] : index |
2338 // sp[1] : array/enum cache length | 2336 // sp[1] : array/enum cache length |
2339 // sp[2] : array or enum cache | 2337 // sp[2] : array or enum cache |
2340 // sp[3] : 0 or map | 2338 // sp[3] : 0 or map |
(...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4660 | 4658 |
4661 // Fill out the elements FixedArray. | 4659 // Fill out the elements FixedArray. |
4662 // r0: JSArray, tagged. | 4660 // r0: JSArray, tagged. |
4663 // r3: FixedArray, tagged. | 4661 // r3: FixedArray, tagged. |
4664 // r5: Number of elements in array, untagged. | 4662 // r5: Number of elements in array, untagged. |
4665 | 4663 |
4666 // Set map. | 4664 // Set map. |
4667 __ mov(r2, Operand(Factory::fixed_array_map())); | 4665 __ mov(r2, Operand(Factory::fixed_array_map())); |
4668 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); | 4666 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); |
4669 // Set FixedArray length. | 4667 // Set FixedArray length. |
4670 __ str(r5, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 4668 __ mov(r6, Operand(r5, LSL, kSmiTagSize)); |
| 4669 __ str(r6, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
4671 // Fill contents of fixed-array with the-hole. | 4670 // Fill contents of fixed-array with the-hole. |
4672 __ mov(r2, Operand(Factory::the_hole_value())); | 4671 __ mov(r2, Operand(Factory::the_hole_value())); |
4673 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 4672 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
4674 // Fill fixed array elements with hole. | 4673 // Fill fixed array elements with hole. |
4675 // r0: JSArray, tagged. | 4674 // r0: JSArray, tagged. |
4676 // r2: the hole. | 4675 // r2: the hole. |
4677 // r3: Start of elements in FixedArray. | 4676 // r3: Start of elements in FixedArray. |
4678 // r5: Number of elements to fill. | 4677 // r5: Number of elements to fill. |
4679 Label loop; | 4678 Label loop; |
4680 __ tst(r5, Operand(r5)); | 4679 __ tst(r5, Operand(r5)); |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5862 // is not a dictionary. | 5861 // is not a dictionary. |
5863 __ ldr(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 5862 __ ldr(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
5864 __ ldr(scratch2, FieldMemOperand(scratch1, JSObject::kMapOffset)); | 5863 __ ldr(scratch2, FieldMemOperand(scratch1, JSObject::kMapOffset)); |
5865 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 5864 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); |
5866 __ cmp(scratch2, ip); | 5865 __ cmp(scratch2, ip); |
5867 deferred->Branch(ne); | 5866 deferred->Branch(ne); |
5868 | 5867 |
5869 // Check that key is within bounds. Use unsigned comparison to handle | 5868 // Check that key is within bounds. Use unsigned comparison to handle |
5870 // negative keys. | 5869 // negative keys. |
5871 __ ldr(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset)); | 5870 __ ldr(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset)); |
5872 __ cmp(scratch2, Operand(key, ASR, kSmiTagSize)); | 5871 __ cmp(scratch2, key); |
5873 deferred->Branch(ls); // Unsigned less equal. | 5872 deferred->Branch(ls); // Unsigned less equal. |
5874 | 5873 |
5875 // Load and check that the result is not the hole (key is a smi). | 5874 // Load and check that the result is not the hole (key is a smi). |
5876 __ LoadRoot(scratch2, Heap::kTheHoleValueRootIndex); | 5875 __ LoadRoot(scratch2, Heap::kTheHoleValueRootIndex); |
5877 __ add(scratch1, | 5876 __ add(scratch1, |
5878 scratch1, | 5877 scratch1, |
5879 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 5878 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
5880 __ ldr(scratch1, | 5879 __ ldr(scratch1, |
5881 MemOperand(scratch1, key, LSL, | 5880 MemOperand(scratch1, key, LSL, |
5882 kPointerSizeLog2 - (kSmiTagSize + kSmiShiftSize))); | 5881 kPointerSizeLog2 - (kSmiTagSize + kSmiShiftSize))); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6163 r2, | 6162 r2, |
6164 &gc, | 6163 &gc, |
6165 TAG_OBJECT); | 6164 TAG_OBJECT); |
6166 | 6165 |
6167 // Load the function from the stack. | 6166 // Load the function from the stack. |
6168 __ ldr(r3, MemOperand(sp, 0)); | 6167 __ ldr(r3, MemOperand(sp, 0)); |
6169 | 6168 |
6170 // Setup the object header. | 6169 // Setup the object header. |
6171 __ LoadRoot(r2, Heap::kContextMapRootIndex); | 6170 __ LoadRoot(r2, Heap::kContextMapRootIndex); |
6172 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); | 6171 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); |
6173 __ mov(r2, Operand(length)); | 6172 __ mov(r2, Operand(Smi::FromInt(length))); |
6174 __ str(r2, FieldMemOperand(r0, Array::kLengthOffset)); | 6173 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
6175 | 6174 |
6176 // Setup the fixed slots. | 6175 // Setup the fixed slots. |
6177 __ mov(r1, Operand(Smi::FromInt(0))); | 6176 __ mov(r1, Operand(Smi::FromInt(0))); |
6178 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX))); | 6177 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX))); |
6179 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 6178 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
6180 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX))); | 6179 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX))); |
6181 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX))); | 6180 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX))); |
6182 | 6181 |
6183 // Copy the global object from the surrounding context. | 6182 // Copy the global object from the surrounding context. |
6184 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 6183 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6795 // Use of registers. Register result is used as a temporary. | 6794 // Use of registers. Register result is used as a temporary. |
6796 Register number_string_cache = result; | 6795 Register number_string_cache = result; |
6797 Register mask = scratch3; | 6796 Register mask = scratch3; |
6798 | 6797 |
6799 // Load the number string cache. | 6798 // Load the number string cache. |
6800 __ LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex); | 6799 __ LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex); |
6801 | 6800 |
6802 // Make the hash mask from the length of the number string cache. It | 6801 // Make the hash mask from the length of the number string cache. It |
6803 // contains two elements (number and string) for each cache entry. | 6802 // contains two elements (number and string) for each cache entry. |
6804 __ ldr(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset)); | 6803 __ ldr(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset)); |
6805 // Divide length by two (length is not a smi). | 6804 // Divide length by two (length is a smi). |
6806 __ mov(mask, Operand(mask, ASR, 1)); | 6805 __ mov(mask, Operand(mask, ASR, kSmiTagSize + 1)); |
6807 __ sub(mask, mask, Operand(1)); // Make mask. | 6806 __ sub(mask, mask, Operand(1)); // Make mask. |
6808 | 6807 |
6809 // Calculate the entry in the number string cache. The hash value in the | 6808 // Calculate the entry in the number string cache. The hash value in the |
6810 // number string cache for smis is just the smi value, and the hash for | 6809 // number string cache for smis is just the smi value, and the hash for |
6811 // doubles is the xor of the upper and lower words. See | 6810 // doubles is the xor of the upper and lower words. See |
6812 // Heap::GetNumberStringCache. | 6811 // Heap::GetNumberStringCache. |
6813 Label is_smi; | 6812 Label is_smi; |
6814 Label load_result_from_cache; | 6813 Label load_result_from_cache; |
6815 if (!object_is_smi) { | 6814 if (!object_is_smi) { |
6816 __ BranchOnSmi(object, &is_smi); | 6815 __ BranchOnSmi(object, &is_smi); |
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8687 // Get the length (smi tagged) and set that as an in-object property too. | 8686 // Get the length (smi tagged) and set that as an in-object property too. |
8688 ASSERT(Heap::arguments_length_index == 1); | 8687 ASSERT(Heap::arguments_length_index == 1); |
8689 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | 8688 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); |
8690 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + kPointerSize)); | 8689 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + kPointerSize)); |
8691 | 8690 |
8692 // If there are no actual arguments, we're done. | 8691 // If there are no actual arguments, we're done. |
8693 Label done; | 8692 Label done; |
8694 __ cmp(r1, Operand(0)); | 8693 __ cmp(r1, Operand(0)); |
8695 __ b(eq, &done); | 8694 __ b(eq, &done); |
8696 | 8695 |
8697 // Get the parameters pointer from the stack and untag the length. | 8696 // Get the parameters pointer from the stack. |
8698 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); | 8697 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); |
8699 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); | |
8700 | 8698 |
8701 // Setup the elements pointer in the allocated arguments object and | 8699 // Setup the elements pointer in the allocated arguments object and |
8702 // initialize the header in the elements fixed array. | 8700 // initialize the header in the elements fixed array. |
8703 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize)); | 8701 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize)); |
8704 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | 8702 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
8705 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | 8703 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); |
8706 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); | 8704 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); |
8707 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); | 8705 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); |
| 8706 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); // Untag the length for the loop. |
8708 | 8707 |
8709 // Copy the fixed array slots. | 8708 // Copy the fixed array slots. |
8710 Label loop; | 8709 Label loop; |
8711 // Setup r4 to point to the first array slot. | 8710 // Setup r4 to point to the first array slot. |
8712 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 8711 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
8713 __ bind(&loop); | 8712 __ bind(&loop); |
8714 // Pre-decrement r2 with kPointerSize on each iteration. | 8713 // Pre-decrement r2 with kPointerSize on each iteration. |
8715 // Pre-decrement in order to skip receiver. | 8714 // Pre-decrement in order to skip receiver. |
8716 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex)); | 8715 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex)); |
8717 // Post-increment r4 with kPointerSize on each iteration. | 8716 // Post-increment r4 with kPointerSize on each iteration. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8848 FieldMemOperand(r0, JSArray::kElementsOffset)); | 8847 FieldMemOperand(r0, JSArray::kElementsOffset)); |
8849 __ ldr(r0, FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); | 8848 __ ldr(r0, FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); |
8850 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 8849 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); |
8851 __ cmp(r0, ip); | 8850 __ cmp(r0, ip); |
8852 __ b(ne, &runtime); | 8851 __ b(ne, &runtime); |
8853 // Check that the last match info has space for the capture registers and the | 8852 // Check that the last match info has space for the capture registers and the |
8854 // additional information. | 8853 // additional information. |
8855 __ ldr(r0, | 8854 __ ldr(r0, |
8856 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); | 8855 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); |
8857 __ add(r2, r2, Operand(RegExpImpl::kLastMatchOverhead)); | 8856 __ add(r2, r2, Operand(RegExpImpl::kLastMatchOverhead)); |
8858 __ cmp(r2, r0); | 8857 __ cmp(r2, Operand(r0, ASR, kSmiTagSize)); |
8859 __ b(gt, &runtime); | 8858 __ b(gt, &runtime); |
8860 | 8859 |
8861 // subject: Subject string | 8860 // subject: Subject string |
8862 // regexp_data: RegExp data (FixedArray) | 8861 // regexp_data: RegExp data (FixedArray) |
8863 // Check the representation and encoding of the subject string. | 8862 // Check the representation and encoding of the subject string. |
8864 Label seq_string; | 8863 Label seq_string; |
8865 const int kStringRepresentationEncodingMask = | 8864 const int kStringRepresentationEncodingMask = |
8866 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; | 8865 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; |
8867 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); | 8866 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); |
8868 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); | 8867 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); |
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10264 __ bind(&string_add_runtime); | 10263 __ bind(&string_add_runtime); |
10265 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 10264 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
10266 } | 10265 } |
10267 | 10266 |
10268 | 10267 |
10269 #undef __ | 10268 #undef __ |
10270 | 10269 |
10271 } } // namespace v8::internal | 10270 } } // namespace v8::internal |
10272 | 10271 |
10273 #endif // V8_TARGET_ARCH_ARM | 10272 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |