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 2255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2266 // the object) | 2266 // the object) |
2267 __ mov(r1, Operand(r0)); | 2267 __ mov(r1, Operand(r0)); |
2268 __ ldr(r1, FieldMemOperand(r1, Map::kInstanceDescriptorsOffset)); | 2268 __ ldr(r1, FieldMemOperand(r1, Map::kInstanceDescriptorsOffset)); |
2269 __ ldr(r1, FieldMemOperand(r1, DescriptorArray::kEnumerationIndexOffset)); | 2269 __ ldr(r1, FieldMemOperand(r1, DescriptorArray::kEnumerationIndexOffset)); |
2270 __ ldr(r2, | 2270 __ ldr(r2, |
2271 FieldMemOperand(r1, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 2271 FieldMemOperand(r1, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
2272 | 2272 |
2273 frame_->EmitPush(r0); // map | 2273 frame_->EmitPush(r0); // map |
2274 frame_->EmitPush(r2); // enum cache bridge cache | 2274 frame_->EmitPush(r2); // enum cache bridge cache |
2275 __ ldr(r0, FieldMemOperand(r2, FixedArray::kLengthOffset)); | 2275 __ ldr(r0, FieldMemOperand(r2, FixedArray::kLengthOffset)); |
2276 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); | |
2277 frame_->EmitPush(r0); | 2276 frame_->EmitPush(r0); |
2278 __ mov(r0, Operand(Smi::FromInt(0))); | 2277 __ mov(r0, Operand(Smi::FromInt(0))); |
2279 frame_->EmitPush(r0); | 2278 frame_->EmitPush(r0); |
2280 entry.Jump(); | 2279 entry.Jump(); |
2281 | 2280 |
2282 fixed_array.Bind(); | 2281 fixed_array.Bind(); |
2283 __ mov(r1, Operand(Smi::FromInt(0))); | 2282 __ mov(r1, Operand(Smi::FromInt(0))); |
2284 frame_->EmitPush(r1); // insert 0 in place of Map | 2283 frame_->EmitPush(r1); // insert 0 in place of Map |
2285 frame_->EmitPush(r0); | 2284 frame_->EmitPush(r0); |
2286 | 2285 |
2287 // Push the length of the array and the initial index onto the stack. | 2286 // Push the length of the array and the initial index onto the stack. |
2288 __ ldr(r0, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 2287 __ ldr(r0, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
2289 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); | |
2290 frame_->EmitPush(r0); | 2288 frame_->EmitPush(r0); |
2291 __ mov(r0, Operand(Smi::FromInt(0))); // init index | 2289 __ mov(r0, Operand(Smi::FromInt(0))); // init index |
2292 frame_->EmitPush(r0); | 2290 frame_->EmitPush(r0); |
2293 | 2291 |
2294 // Condition. | 2292 // Condition. |
2295 entry.Bind(); | 2293 entry.Bind(); |
2296 // sp[0] : index | 2294 // sp[0] : index |
2297 // sp[1] : array/enum cache length | 2295 // sp[1] : array/enum cache length |
2298 // sp[2] : array or enum cache | 2296 // sp[2] : array or enum cache |
2299 // sp[3] : 0 or map | 2297 // sp[3] : 0 or map |
(...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4485 | 4483 |
4486 // Fill out the elements FixedArray. | 4484 // Fill out the elements FixedArray. |
4487 // r0: JSArray, tagged. | 4485 // r0: JSArray, tagged. |
4488 // r3: FixedArray, tagged. | 4486 // r3: FixedArray, tagged. |
4489 // r5: Number of elements in array, untagged. | 4487 // r5: Number of elements in array, untagged. |
4490 | 4488 |
4491 // Set map. | 4489 // Set map. |
4492 __ mov(r2, Operand(Factory::fixed_array_map())); | 4490 __ mov(r2, Operand(Factory::fixed_array_map())); |
4493 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); | 4491 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); |
4494 // Set FixedArray length. | 4492 // Set FixedArray length. |
4495 __ str(r5, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 4493 __ mov(r6, Operand(r5, LSL, kSmiTagSize)); |
| 4494 __ str(r6, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
4496 // Fill contents of fixed-array with the-hole. | 4495 // Fill contents of fixed-array with the-hole. |
4497 __ mov(r2, Operand(Factory::the_hole_value())); | 4496 __ mov(r2, Operand(Factory::the_hole_value())); |
4498 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 4497 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
4499 // Fill fixed array elements with hole. | 4498 // Fill fixed array elements with hole. |
4500 // r0: JSArray, tagged. | 4499 // r0: JSArray, tagged. |
4501 // r2: the hole. | 4500 // r2: the hole. |
4502 // r3: Start of elements in FixedArray. | 4501 // r3: Start of elements in FixedArray. |
4503 // r5: Number of elements to fill. | 4502 // r5: Number of elements to fill. |
4504 Label loop; | 4503 Label loop; |
4505 __ tst(r5, Operand(r5)); | 4504 __ tst(r5, Operand(r5)); |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5672 // is not a dictionary. | 5671 // is not a dictionary. |
5673 __ ldr(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 5672 __ ldr(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
5674 __ ldr(scratch2, FieldMemOperand(scratch1, JSObject::kMapOffset)); | 5673 __ ldr(scratch2, FieldMemOperand(scratch1, JSObject::kMapOffset)); |
5675 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 5674 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); |
5676 __ cmp(scratch2, ip); | 5675 __ cmp(scratch2, ip); |
5677 deferred->Branch(ne); | 5676 deferred->Branch(ne); |
5678 | 5677 |
5679 // Check that key is within bounds. Use unsigned comparison to handle | 5678 // Check that key is within bounds. Use unsigned comparison to handle |
5680 // negative keys. | 5679 // negative keys. |
5681 __ ldr(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset)); | 5680 __ ldr(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset)); |
5682 __ cmp(scratch2, Operand(key, ASR, kSmiTagSize)); | 5681 __ cmp(scratch2, key); |
5683 deferred->Branch(ls); // Unsigned less equal. | 5682 deferred->Branch(ls); // Unsigned less equal. |
5684 | 5683 |
5685 // Load and check that the result is not the hole (key is a smi). | 5684 // Load and check that the result is not the hole (key is a smi). |
5686 __ LoadRoot(scratch2, Heap::kTheHoleValueRootIndex); | 5685 __ LoadRoot(scratch2, Heap::kTheHoleValueRootIndex); |
5687 __ add(scratch1, | 5686 __ add(scratch1, |
5688 scratch1, | 5687 scratch1, |
5689 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 5688 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
5690 __ ldr(scratch1, | 5689 __ ldr(scratch1, |
5691 MemOperand(scratch1, key, LSL, | 5690 MemOperand(scratch1, key, LSL, |
5692 kPointerSizeLog2 - (kSmiTagSize + kSmiShiftSize))); | 5691 kPointerSizeLog2 - (kSmiTagSize + kSmiShiftSize))); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5967 r2, | 5966 r2, |
5968 &gc, | 5967 &gc, |
5969 TAG_OBJECT); | 5968 TAG_OBJECT); |
5970 | 5969 |
5971 // Load the function from the stack. | 5970 // Load the function from the stack. |
5972 __ ldr(r3, MemOperand(sp, 0)); | 5971 __ ldr(r3, MemOperand(sp, 0)); |
5973 | 5972 |
5974 // Setup the object header. | 5973 // Setup the object header. |
5975 __ LoadRoot(r2, Heap::kContextMapRootIndex); | 5974 __ LoadRoot(r2, Heap::kContextMapRootIndex); |
5976 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); | 5975 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); |
5977 __ mov(r2, Operand(length)); | 5976 __ mov(r2, Operand(Smi::FromInt(length))); |
5978 __ str(r2, FieldMemOperand(r0, Array::kLengthOffset)); | 5977 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
5979 | 5978 |
5980 // Setup the fixed slots. | 5979 // Setup the fixed slots. |
5981 __ mov(r1, Operand(Smi::FromInt(0))); | 5980 __ mov(r1, Operand(Smi::FromInt(0))); |
5982 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX))); | 5981 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX))); |
5983 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 5982 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
5984 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX))); | 5983 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX))); |
5985 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX))); | 5984 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX))); |
5986 | 5985 |
5987 // Copy the global object from the surrounding context. | 5986 // Copy the global object from the surrounding context. |
5988 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 5987 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6599 // Use of registers. Register result is used as a temporary. | 6598 // Use of registers. Register result is used as a temporary. |
6600 Register number_string_cache = result; | 6599 Register number_string_cache = result; |
6601 Register mask = scratch3; | 6600 Register mask = scratch3; |
6602 | 6601 |
6603 // Load the number string cache. | 6602 // Load the number string cache. |
6604 __ LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex); | 6603 __ LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex); |
6605 | 6604 |
6606 // Make the hash mask from the length of the number string cache. It | 6605 // Make the hash mask from the length of the number string cache. It |
6607 // contains two elements (number and string) for each cache entry. | 6606 // contains two elements (number and string) for each cache entry. |
6608 __ ldr(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset)); | 6607 __ ldr(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset)); |
6609 // Divide length by two (length is not a smi). | 6608 // Divide length by two (length is a smi). |
6610 __ mov(mask, Operand(mask, ASR, 1)); | 6609 __ mov(mask, Operand(mask, ASR, kSmiTagSize + 1)); |
6611 __ sub(mask, mask, Operand(1)); // Make mask. | 6610 __ sub(mask, mask, Operand(1)); // Make mask. |
6612 | 6611 |
6613 // Calculate the entry in the number string cache. The hash value in the | 6612 // Calculate the entry in the number string cache. The hash value in the |
6614 // number string cache for smis is just the smi value, and the hash for | 6613 // number string cache for smis is just the smi value, and the hash for |
6615 // doubles is the xor of the upper and lower words. See | 6614 // doubles is the xor of the upper and lower words. See |
6616 // Heap::GetNumberStringCache. | 6615 // Heap::GetNumberStringCache. |
6617 Label is_smi; | 6616 Label is_smi; |
6618 Label load_result_from_cache; | 6617 Label load_result_from_cache; |
6619 if (!object_is_smi) { | 6618 if (!object_is_smi) { |
6620 __ BranchOnSmi(object, &is_smi); | 6619 __ BranchOnSmi(object, &is_smi); |
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8491 // Get the length (smi tagged) and set that as an in-object property too. | 8490 // Get the length (smi tagged) and set that as an in-object property too. |
8492 ASSERT(Heap::arguments_length_index == 1); | 8491 ASSERT(Heap::arguments_length_index == 1); |
8493 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | 8492 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); |
8494 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + kPointerSize)); | 8493 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + kPointerSize)); |
8495 | 8494 |
8496 // If there are no actual arguments, we're done. | 8495 // If there are no actual arguments, we're done. |
8497 Label done; | 8496 Label done; |
8498 __ cmp(r1, Operand(0)); | 8497 __ cmp(r1, Operand(0)); |
8499 __ b(eq, &done); | 8498 __ b(eq, &done); |
8500 | 8499 |
8501 // Get the parameters pointer from the stack and untag the length. | 8500 // Get the parameters pointer from the stack. |
8502 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); | 8501 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); |
8503 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); | |
8504 | 8502 |
8505 // Setup the elements pointer in the allocated arguments object and | 8503 // Setup the elements pointer in the allocated arguments object and |
8506 // initialize the header in the elements fixed array. | 8504 // initialize the header in the elements fixed array. |
8507 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize)); | 8505 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize)); |
8508 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | 8506 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
8509 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | 8507 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); |
8510 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); | 8508 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); |
8511 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); | 8509 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); |
| 8510 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); // Untag the length for the loop. |
8512 | 8511 |
8513 // Copy the fixed array slots. | 8512 // Copy the fixed array slots. |
8514 Label loop; | 8513 Label loop; |
8515 // Setup r4 to point to the first array slot. | 8514 // Setup r4 to point to the first array slot. |
8516 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 8515 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
8517 __ bind(&loop); | 8516 __ bind(&loop); |
8518 // Pre-decrement r2 with kPointerSize on each iteration. | 8517 // Pre-decrement r2 with kPointerSize on each iteration. |
8519 // Pre-decrement in order to skip receiver. | 8518 // Pre-decrement in order to skip receiver. |
8520 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex)); | 8519 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex)); |
8521 // Post-increment r4 with kPointerSize on each iteration. | 8520 // Post-increment r4 with kPointerSize on each iteration. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8652 FieldMemOperand(r0, JSArray::kElementsOffset)); | 8651 FieldMemOperand(r0, JSArray::kElementsOffset)); |
8653 __ ldr(r0, FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); | 8652 __ ldr(r0, FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); |
8654 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 8653 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); |
8655 __ cmp(r0, ip); | 8654 __ cmp(r0, ip); |
8656 __ b(ne, &runtime); | 8655 __ b(ne, &runtime); |
8657 // Check that the last match info has space for the capture registers and the | 8656 // Check that the last match info has space for the capture registers and the |
8658 // additional information. | 8657 // additional information. |
8659 __ ldr(r0, | 8658 __ ldr(r0, |
8660 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); | 8659 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); |
8661 __ add(r2, r2, Operand(RegExpImpl::kLastMatchOverhead)); | 8660 __ add(r2, r2, Operand(RegExpImpl::kLastMatchOverhead)); |
8662 __ cmp(r2, r0); | 8661 __ cmp(r2, Operand(r0, ASR, kSmiTagSize)); |
8663 __ b(gt, &runtime); | 8662 __ b(gt, &runtime); |
8664 | 8663 |
8665 // subject: Subject string | 8664 // subject: Subject string |
8666 // regexp_data: RegExp data (FixedArray) | 8665 // regexp_data: RegExp data (FixedArray) |
8667 // Check the representation and encoding of the subject string. | 8666 // Check the representation and encoding of the subject string. |
8668 Label seq_string; | 8667 Label seq_string; |
8669 const int kStringRepresentationEncodingMask = | 8668 const int kStringRepresentationEncodingMask = |
8670 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; | 8669 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; |
8671 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); | 8670 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); |
8672 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); | 8671 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10013 | 10012 |
10014 // Just jump to runtime to add the two strings. | 10013 // Just jump to runtime to add the two strings. |
10015 __ bind(&string_add_runtime); | 10014 __ bind(&string_add_runtime); |
10016 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 10015 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
10017 } | 10016 } |
10018 | 10017 |
10019 | 10018 |
10020 #undef __ | 10019 #undef __ |
10021 | 10020 |
10022 } } // namespace v8::internal | 10021 } } // namespace v8::internal |
OLD | NEW |