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 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2269 // the object) | 2269 // the object) |
2270 __ mov(r1, Operand(r0)); | 2270 __ mov(r1, Operand(r0)); |
2271 __ ldr(r1, FieldMemOperand(r1, Map::kInstanceDescriptorsOffset)); | 2271 __ ldr(r1, FieldMemOperand(r1, Map::kInstanceDescriptorsOffset)); |
2272 __ ldr(r1, FieldMemOperand(r1, DescriptorArray::kEnumerationIndexOffset)); | 2272 __ ldr(r1, FieldMemOperand(r1, DescriptorArray::kEnumerationIndexOffset)); |
2273 __ ldr(r2, | 2273 __ ldr(r2, |
2274 FieldMemOperand(r1, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 2274 FieldMemOperand(r1, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
2275 | 2275 |
2276 frame_->EmitPush(r0); // map | 2276 frame_->EmitPush(r0); // map |
2277 frame_->EmitPush(r2); // enum cache bridge cache | 2277 frame_->EmitPush(r2); // enum cache bridge cache |
2278 __ ldr(r0, FieldMemOperand(r2, FixedArray::kLengthOffset)); | 2278 __ ldr(r0, FieldMemOperand(r2, FixedArray::kLengthOffset)); |
| 2279 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); |
2279 frame_->EmitPush(r0); | 2280 frame_->EmitPush(r0); |
2280 __ mov(r0, Operand(Smi::FromInt(0))); | 2281 __ mov(r0, Operand(Smi::FromInt(0))); |
2281 frame_->EmitPush(r0); | 2282 frame_->EmitPush(r0); |
2282 entry.Jump(); | 2283 entry.Jump(); |
2283 | 2284 |
2284 fixed_array.Bind(); | 2285 fixed_array.Bind(); |
2285 __ mov(r1, Operand(Smi::FromInt(0))); | 2286 __ mov(r1, Operand(Smi::FromInt(0))); |
2286 frame_->EmitPush(r1); // insert 0 in place of Map | 2287 frame_->EmitPush(r1); // insert 0 in place of Map |
2287 frame_->EmitPush(r0); | 2288 frame_->EmitPush(r0); |
2288 | 2289 |
2289 // Push the length of the array and the initial index onto the stack. | 2290 // Push the length of the array and the initial index onto the stack. |
2290 __ ldr(r0, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 2291 __ ldr(r0, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
| 2292 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); |
2291 frame_->EmitPush(r0); | 2293 frame_->EmitPush(r0); |
2292 __ mov(r0, Operand(Smi::FromInt(0))); // init index | 2294 __ mov(r0, Operand(Smi::FromInt(0))); // init index |
2293 frame_->EmitPush(r0); | 2295 frame_->EmitPush(r0); |
2294 | 2296 |
2295 // Condition. | 2297 // Condition. |
2296 entry.Bind(); | 2298 entry.Bind(); |
2297 // sp[0] : index | 2299 // sp[0] : index |
2298 // sp[1] : array/enum cache length | 2300 // sp[1] : array/enum cache length |
2299 // sp[2] : array or enum cache | 2301 // sp[2] : array or enum cache |
2300 // sp[3] : 0 or map | 2302 // sp[3] : 0 or map |
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4479 | 4481 |
4480 // Fill out the elements FixedArray. | 4482 // Fill out the elements FixedArray. |
4481 // r0: JSArray, tagged. | 4483 // r0: JSArray, tagged. |
4482 // r3: FixedArray, tagged. | 4484 // r3: FixedArray, tagged. |
4483 // r5: Number of elements in array, untagged. | 4485 // r5: Number of elements in array, untagged. |
4484 | 4486 |
4485 // Set map. | 4487 // Set map. |
4486 __ mov(r2, Operand(Factory::fixed_array_map())); | 4488 __ mov(r2, Operand(Factory::fixed_array_map())); |
4487 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); | 4489 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); |
4488 // Set FixedArray length. | 4490 // Set FixedArray length. |
4489 __ mov(r6, Operand(r5, LSL, kSmiTagSize)); | 4491 __ str(r5, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
4490 __ str(r6, FieldMemOperand(r3, FixedArray::kLengthOffset)); | |
4491 // Fill contents of fixed-array with the-hole. | 4492 // Fill contents of fixed-array with the-hole. |
4492 __ mov(r2, Operand(Factory::the_hole_value())); | 4493 __ mov(r2, Operand(Factory::the_hole_value())); |
4493 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 4494 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
4494 // Fill fixed array elements with hole. | 4495 // Fill fixed array elements with hole. |
4495 // r0: JSArray, tagged. | 4496 // r0: JSArray, tagged. |
4496 // r2: the hole. | 4497 // r2: the hole. |
4497 // r3: Start of elements in FixedArray. | 4498 // r3: Start of elements in FixedArray. |
4498 // r5: Number of elements to fill. | 4499 // r5: Number of elements to fill. |
4499 Label loop; | 4500 Label loop; |
4500 __ tst(r5, Operand(r5)); | 4501 __ tst(r5, Operand(r5)); |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5682 // is not a dictionary. | 5683 // is not a dictionary. |
5683 __ ldr(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 5684 __ ldr(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
5684 __ ldr(scratch2, FieldMemOperand(scratch1, JSObject::kMapOffset)); | 5685 __ ldr(scratch2, FieldMemOperand(scratch1, JSObject::kMapOffset)); |
5685 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 5686 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); |
5686 __ cmp(scratch2, ip); | 5687 __ cmp(scratch2, ip); |
5687 deferred->Branch(ne); | 5688 deferred->Branch(ne); |
5688 | 5689 |
5689 // Check that key is within bounds. Use unsigned comparison to handle | 5690 // Check that key is within bounds. Use unsigned comparison to handle |
5690 // negative keys. | 5691 // negative keys. |
5691 __ ldr(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset)); | 5692 __ ldr(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset)); |
5692 __ cmp(scratch2, key); | 5693 __ cmp(scratch2, Operand(key, ASR, kSmiTagSize)); |
5693 deferred->Branch(ls); // Unsigned less equal. | 5694 deferred->Branch(ls); // Unsigned less equal. |
5694 | 5695 |
5695 // Load and check that the result is not the hole (key is a smi). | 5696 // Load and check that the result is not the hole (key is a smi). |
5696 __ LoadRoot(scratch2, Heap::kTheHoleValueRootIndex); | 5697 __ LoadRoot(scratch2, Heap::kTheHoleValueRootIndex); |
5697 __ add(scratch1, | 5698 __ add(scratch1, |
5698 scratch1, | 5699 scratch1, |
5699 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 5700 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
5700 __ ldr(scratch1, | 5701 __ ldr(scratch1, |
5701 MemOperand(scratch1, key, LSL, | 5702 MemOperand(scratch1, key, LSL, |
5702 kPointerSizeLog2 - (kSmiTagSize + kSmiShiftSize))); | 5703 kPointerSizeLog2 - (kSmiTagSize + kSmiShiftSize))); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5983 r2, | 5984 r2, |
5984 &gc, | 5985 &gc, |
5985 TAG_OBJECT); | 5986 TAG_OBJECT); |
5986 | 5987 |
5987 // Load the function from the stack. | 5988 // Load the function from the stack. |
5988 __ ldr(r3, MemOperand(sp, 0)); | 5989 __ ldr(r3, MemOperand(sp, 0)); |
5989 | 5990 |
5990 // Setup the object header. | 5991 // Setup the object header. |
5991 __ LoadRoot(r2, Heap::kContextMapRootIndex); | 5992 __ LoadRoot(r2, Heap::kContextMapRootIndex); |
5992 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); | 5993 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); |
5993 __ mov(r2, Operand(Smi::FromInt(length))); | 5994 __ mov(r2, Operand(length)); |
5994 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 5995 __ str(r2, FieldMemOperand(r0, Array::kLengthOffset)); |
5995 | 5996 |
5996 // Setup the fixed slots. | 5997 // Setup the fixed slots. |
5997 __ mov(r1, Operand(Smi::FromInt(0))); | 5998 __ mov(r1, Operand(Smi::FromInt(0))); |
5998 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX))); | 5999 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX))); |
5999 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 6000 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
6000 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX))); | 6001 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX))); |
6001 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX))); | 6002 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX))); |
6002 | 6003 |
6003 // Copy the global object from the surrounding context. | 6004 // Copy the global object from the surrounding context. |
6004 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 6005 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6615 // Use of registers. Register result is used as a temporary. | 6616 // Use of registers. Register result is used as a temporary. |
6616 Register number_string_cache = result; | 6617 Register number_string_cache = result; |
6617 Register mask = scratch3; | 6618 Register mask = scratch3; |
6618 | 6619 |
6619 // Load the number string cache. | 6620 // Load the number string cache. |
6620 __ LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex); | 6621 __ LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex); |
6621 | 6622 |
6622 // Make the hash mask from the length of the number string cache. It | 6623 // Make the hash mask from the length of the number string cache. It |
6623 // contains two elements (number and string) for each cache entry. | 6624 // contains two elements (number and string) for each cache entry. |
6624 __ ldr(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset)); | 6625 __ ldr(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset)); |
6625 // Divide length by two (length is a smi). | 6626 // Divide length by two (length is not a smi). |
6626 __ mov(mask, Operand(mask, ASR, kSmiTagSize + 1)); | 6627 __ mov(mask, Operand(mask, ASR, 1)); |
6627 __ sub(mask, mask, Operand(1)); // Make mask. | 6628 __ sub(mask, mask, Operand(1)); // Make mask. |
6628 | 6629 |
6629 // Calculate the entry in the number string cache. The hash value in the | 6630 // Calculate the entry in the number string cache. The hash value in the |
6630 // number string cache for smis is just the smi value, and the hash for | 6631 // number string cache for smis is just the smi value, and the hash for |
6631 // doubles is the xor of the upper and lower words. See | 6632 // doubles is the xor of the upper and lower words. See |
6632 // Heap::GetNumberStringCache. | 6633 // Heap::GetNumberStringCache. |
6633 Label is_smi; | 6634 Label is_smi; |
6634 Label load_result_from_cache; | 6635 Label load_result_from_cache; |
6635 if (!object_is_smi) { | 6636 if (!object_is_smi) { |
6636 __ BranchOnSmi(object, &is_smi); | 6637 __ BranchOnSmi(object, &is_smi); |
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8507 // Get the length (smi tagged) and set that as an in-object property too. | 8508 // Get the length (smi tagged) and set that as an in-object property too. |
8508 ASSERT(Heap::arguments_length_index == 1); | 8509 ASSERT(Heap::arguments_length_index == 1); |
8509 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | 8510 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); |
8510 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + kPointerSize)); | 8511 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + kPointerSize)); |
8511 | 8512 |
8512 // If there are no actual arguments, we're done. | 8513 // If there are no actual arguments, we're done. |
8513 Label done; | 8514 Label done; |
8514 __ cmp(r1, Operand(0)); | 8515 __ cmp(r1, Operand(0)); |
8515 __ b(eq, &done); | 8516 __ b(eq, &done); |
8516 | 8517 |
8517 // Get the parameters pointer from the stack. | 8518 // Get the parameters pointer from the stack and untag the length. |
8518 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); | 8519 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); |
| 8520 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); |
8519 | 8521 |
8520 // Setup the elements pointer in the allocated arguments object and | 8522 // Setup the elements pointer in the allocated arguments object and |
8521 // initialize the header in the elements fixed array. | 8523 // initialize the header in the elements fixed array. |
8522 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize)); | 8524 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize)); |
8523 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | 8525 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
8524 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | 8526 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); |
8525 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); | 8527 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); |
8526 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); | 8528 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); |
8527 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); // Untag the length for the loop. | |
8528 | 8529 |
8529 // Copy the fixed array slots. | 8530 // Copy the fixed array slots. |
8530 Label loop; | 8531 Label loop; |
8531 // Setup r4 to point to the first array slot. | 8532 // Setup r4 to point to the first array slot. |
8532 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 8533 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
8533 __ bind(&loop); | 8534 __ bind(&loop); |
8534 // Pre-decrement r2 with kPointerSize on each iteration. | 8535 // Pre-decrement r2 with kPointerSize on each iteration. |
8535 // Pre-decrement in order to skip receiver. | 8536 // Pre-decrement in order to skip receiver. |
8536 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex)); | 8537 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex)); |
8537 // Post-increment r4 with kPointerSize on each iteration. | 8538 // Post-increment r4 with kPointerSize on each iteration. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8668 FieldMemOperand(r0, JSArray::kElementsOffset)); | 8669 FieldMemOperand(r0, JSArray::kElementsOffset)); |
8669 __ ldr(r0, FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); | 8670 __ ldr(r0, FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); |
8670 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 8671 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); |
8671 __ cmp(r0, ip); | 8672 __ cmp(r0, ip); |
8672 __ b(ne, &runtime); | 8673 __ b(ne, &runtime); |
8673 // Check that the last match info has space for the capture registers and the | 8674 // Check that the last match info has space for the capture registers and the |
8674 // additional information. | 8675 // additional information. |
8675 __ ldr(r0, | 8676 __ ldr(r0, |
8676 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); | 8677 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); |
8677 __ add(r2, r2, Operand(RegExpImpl::kLastMatchOverhead)); | 8678 __ add(r2, r2, Operand(RegExpImpl::kLastMatchOverhead)); |
8678 __ cmp(r2, Operand(r0, ASR, kSmiTagSize)); | 8679 __ cmp(r2, r0); |
8679 __ b(gt, &runtime); | 8680 __ b(gt, &runtime); |
8680 | 8681 |
8681 // subject: Subject string | 8682 // subject: Subject string |
8682 // regexp_data: RegExp data (FixedArray) | 8683 // regexp_data: RegExp data (FixedArray) |
8683 // Check the representation and encoding of the subject string. | 8684 // Check the representation and encoding of the subject string. |
8684 Label seq_string; | 8685 Label seq_string; |
8685 const int kStringRepresentationEncodingMask = | 8686 const int kStringRepresentationEncodingMask = |
8686 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; | 8687 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; |
8687 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); | 8688 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); |
8688 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); | 8689 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); |
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10031 __ bind(&string_add_runtime); | 10032 __ bind(&string_add_runtime); |
10032 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 10033 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
10033 } | 10034 } |
10034 | 10035 |
10035 | 10036 |
10036 #undef __ | 10037 #undef __ |
10037 | 10038 |
10038 } } // namespace v8::internal | 10039 } } // namespace v8::internal |
10039 | 10040 |
10040 #endif // V8_TARGET_ARCH_ARM | 10041 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |