Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/arm/codegen-arm.cc

Issue 2114015: Cardmarking writebarrier. (Closed)
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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));
2280 frame_->EmitPush(r0); 2279 frame_->EmitPush(r0);
2281 __ mov(r0, Operand(Smi::FromInt(0))); 2280 __ mov(r0, Operand(Smi::FromInt(0)));
2282 frame_->EmitPush(r0); 2281 frame_->EmitPush(r0);
2283 entry.Jump(); 2282 entry.Jump();
2284 2283
2285 fixed_array.Bind(); 2284 fixed_array.Bind();
2286 __ mov(r1, Operand(Smi::FromInt(0))); 2285 __ mov(r1, Operand(Smi::FromInt(0)));
2287 frame_->EmitPush(r1); // insert 0 in place of Map 2286 frame_->EmitPush(r1); // insert 0 in place of Map
2288 frame_->EmitPush(r0); 2287 frame_->EmitPush(r0);
2289 2288
2290 // Push the length of the array and the initial index onto the stack. 2289 // Push the length of the array and the initial index onto the stack.
2291 __ ldr(r0, FieldMemOperand(r0, FixedArray::kLengthOffset)); 2290 __ ldr(r0, FieldMemOperand(r0, FixedArray::kLengthOffset));
2292 __ mov(r0, Operand(r0, LSL, kSmiTagSize));
2293 frame_->EmitPush(r0); 2291 frame_->EmitPush(r0);
2294 __ mov(r0, Operand(Smi::FromInt(0))); // init index 2292 __ mov(r0, Operand(Smi::FromInt(0))); // init index
2295 frame_->EmitPush(r0); 2293 frame_->EmitPush(r0);
2296 2294
2297 // Condition. 2295 // Condition.
2298 entry.Bind(); 2296 entry.Bind();
2299 // sp[0] : index 2297 // sp[0] : index
2300 // sp[1] : array/enum cache length 2298 // sp[1] : array/enum cache length
2301 // sp[2] : array or enum cache 2299 // sp[2] : array or enum cache
2302 // sp[3] : 0 or map 2300 // sp[3] : 0 or map
(...skipping 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after
4483 4481
4484 // Fill out the elements FixedArray. 4482 // Fill out the elements FixedArray.
4485 // r0: JSArray, tagged. 4483 // r0: JSArray, tagged.
4486 // r3: FixedArray, tagged. 4484 // r3: FixedArray, tagged.
4487 // r5: Number of elements in array, untagged. 4485 // r5: Number of elements in array, untagged.
4488 4486
4489 // Set map. 4487 // Set map.
4490 __ mov(r2, Operand(Factory::fixed_array_map())); 4488 __ mov(r2, Operand(Factory::fixed_array_map()));
4491 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); 4489 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset));
4492 // Set FixedArray length. 4490 // Set FixedArray length.
4493 __ str(r5, FieldMemOperand(r3, FixedArray::kLengthOffset)); 4491 __ mov(r6, Operand(r5, LSL, kSmiTagSize));
4492 __ str(r6, FieldMemOperand(r3, FixedArray::kLengthOffset));
4494 // Fill contents of fixed-array with the-hole. 4493 // Fill contents of fixed-array with the-hole.
4495 __ mov(r2, Operand(Factory::the_hole_value())); 4494 __ mov(r2, Operand(Factory::the_hole_value()));
4496 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 4495 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
4497 // Fill fixed array elements with hole. 4496 // Fill fixed array elements with hole.
4498 // r0: JSArray, tagged. 4497 // r0: JSArray, tagged.
4499 // r2: the hole. 4498 // r2: the hole.
4500 // r3: Start of elements in FixedArray. 4499 // r3: Start of elements in FixedArray.
4501 // r5: Number of elements to fill. 4500 // r5: Number of elements to fill.
4502 Label loop; 4501 Label loop;
4503 __ tst(r5, Operand(r5)); 4502 __ tst(r5, Operand(r5));
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
5690 // is not a dictionary. 5689 // is not a dictionary.
5691 __ ldr(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset)); 5690 __ ldr(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset));
5692 __ ldr(scratch2, FieldMemOperand(scratch1, JSObject::kMapOffset)); 5691 __ ldr(scratch2, FieldMemOperand(scratch1, JSObject::kMapOffset));
5693 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); 5692 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex);
5694 __ cmp(scratch2, ip); 5693 __ cmp(scratch2, ip);
5695 deferred->Branch(ne); 5694 deferred->Branch(ne);
5696 5695
5697 // Check that key is within bounds. Use unsigned comparison to handle 5696 // Check that key is within bounds. Use unsigned comparison to handle
5698 // negative keys. 5697 // negative keys.
5699 __ ldr(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset)); 5698 __ ldr(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset));
5700 __ cmp(scratch2, Operand(key, ASR, kSmiTagSize)); 5699 __ cmp(scratch2, key);
5701 deferred->Branch(ls); // Unsigned less equal. 5700 deferred->Branch(ls); // Unsigned less equal.
5702 5701
5703 // Load and check that the result is not the hole (key is a smi). 5702 // Load and check that the result is not the hole (key is a smi).
5704 __ LoadRoot(scratch2, Heap::kTheHoleValueRootIndex); 5703 __ LoadRoot(scratch2, Heap::kTheHoleValueRootIndex);
5705 __ add(scratch1, 5704 __ add(scratch1,
5706 scratch1, 5705 scratch1,
5707 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 5706 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
5708 __ ldr(scratch1, 5707 __ ldr(scratch1,
5709 MemOperand(scratch1, key, LSL, 5708 MemOperand(scratch1, key, LSL,
5710 kPointerSizeLog2 - (kSmiTagSize + kSmiShiftSize))); 5709 kPointerSizeLog2 - (kSmiTagSize + kSmiShiftSize)));
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
5991 r2, 5990 r2,
5992 &gc, 5991 &gc,
5993 TAG_OBJECT); 5992 TAG_OBJECT);
5994 5993
5995 // Load the function from the stack. 5994 // Load the function from the stack.
5996 __ ldr(r3, MemOperand(sp, 0)); 5995 __ ldr(r3, MemOperand(sp, 0));
5997 5996
5998 // Setup the object header. 5997 // Setup the object header.
5999 __ LoadRoot(r2, Heap::kContextMapRootIndex); 5998 __ LoadRoot(r2, Heap::kContextMapRootIndex);
6000 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); 5999 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset));
6001 __ mov(r2, Operand(length)); 6000 __ mov(r2, Operand(Smi::FromInt(length)));
6002 __ str(r2, FieldMemOperand(r0, Array::kLengthOffset)); 6001 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset));
6003 6002
6004 // Setup the fixed slots. 6003 // Setup the fixed slots.
6005 __ mov(r1, Operand(Smi::FromInt(0))); 6004 __ mov(r1, Operand(Smi::FromInt(0)));
6006 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX))); 6005 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX)));
6007 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX))); 6006 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX)));
6008 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX))); 6007 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX)));
6009 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX))); 6008 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX)));
6010 6009
6011 // Copy the global object from the surrounding context. 6010 // Copy the global object from the surrounding context.
6012 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); 6011 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
6623 // Use of registers. Register result is used as a temporary. 6622 // Use of registers. Register result is used as a temporary.
6624 Register number_string_cache = result; 6623 Register number_string_cache = result;
6625 Register mask = scratch3; 6624 Register mask = scratch3;
6626 6625
6627 // Load the number string cache. 6626 // Load the number string cache.
6628 __ LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex); 6627 __ LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex);
6629 6628
6630 // Make the hash mask from the length of the number string cache. It 6629 // Make the hash mask from the length of the number string cache. It
6631 // contains two elements (number and string) for each cache entry. 6630 // contains two elements (number and string) for each cache entry.
6632 __ ldr(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset)); 6631 __ ldr(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset));
6633 // Divide length by two (length is not a smi). 6632 // Divide length by two (length is a smi).
6634 __ mov(mask, Operand(mask, ASR, 1)); 6633 __ mov(mask, Operand(mask, ASR, kSmiTagSize + 1));
6635 __ sub(mask, mask, Operand(1)); // Make mask. 6634 __ sub(mask, mask, Operand(1)); // Make mask.
6636 6635
6637 // Calculate the entry in the number string cache. The hash value in the 6636 // Calculate the entry in the number string cache. The hash value in the
6638 // number string cache for smis is just the smi value, and the hash for 6637 // number string cache for smis is just the smi value, and the hash for
6639 // doubles is the xor of the upper and lower words. See 6638 // doubles is the xor of the upper and lower words. See
6640 // Heap::GetNumberStringCache. 6639 // Heap::GetNumberStringCache.
6641 Label is_smi; 6640 Label is_smi;
6642 Label load_result_from_cache; 6641 Label load_result_from_cache;
6643 if (!object_is_smi) { 6642 if (!object_is_smi) {
6644 __ BranchOnSmi(object, &is_smi); 6643 __ BranchOnSmi(object, &is_smi);
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after
8515 // Get the length (smi tagged) and set that as an in-object property too. 8514 // Get the length (smi tagged) and set that as an in-object property too.
8516 ASSERT(Heap::arguments_length_index == 1); 8515 ASSERT(Heap::arguments_length_index == 1);
8517 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); 8516 __ ldr(r1, MemOperand(sp, 0 * kPointerSize));
8518 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + kPointerSize)); 8517 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + kPointerSize));
8519 8518
8520 // If there are no actual arguments, we're done. 8519 // If there are no actual arguments, we're done.
8521 Label done; 8520 Label done;
8522 __ cmp(r1, Operand(0)); 8521 __ cmp(r1, Operand(0));
8523 __ b(eq, &done); 8522 __ b(eq, &done);
8524 8523
8525 // Get the parameters pointer from the stack and untag the length. 8524 // Get the parameters pointer from the stack.
8526 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); 8525 __ ldr(r2, MemOperand(sp, 1 * kPointerSize));
8527 __ mov(r1, Operand(r1, LSR, kSmiTagSize));
8528 8526
8529 // Setup the elements pointer in the allocated arguments object and 8527 // Setup the elements pointer in the allocated arguments object and
8530 // initialize the header in the elements fixed array. 8528 // initialize the header in the elements fixed array.
8531 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize)); 8529 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize));
8532 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); 8530 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset));
8533 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); 8531 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex);
8534 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); 8532 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset));
8535 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); 8533 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset));
8534 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); // Untag the length for the loop.
8536 8535
8537 // Copy the fixed array slots. 8536 // Copy the fixed array slots.
8538 Label loop; 8537 Label loop;
8539 // Setup r4 to point to the first array slot. 8538 // Setup r4 to point to the first array slot.
8540 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 8539 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
8541 __ bind(&loop); 8540 __ bind(&loop);
8542 // Pre-decrement r2 with kPointerSize on each iteration. 8541 // Pre-decrement r2 with kPointerSize on each iteration.
8543 // Pre-decrement in order to skip receiver. 8542 // Pre-decrement in order to skip receiver.
8544 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex)); 8543 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex));
8545 // Post-increment r4 with kPointerSize on each iteration. 8544 // Post-increment r4 with kPointerSize on each iteration.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
8676 FieldMemOperand(r0, JSArray::kElementsOffset)); 8675 FieldMemOperand(r0, JSArray::kElementsOffset));
8677 __ ldr(r0, FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); 8676 __ ldr(r0, FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset));
8678 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); 8677 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex);
8679 __ cmp(r0, ip); 8678 __ cmp(r0, ip);
8680 __ b(ne, &runtime); 8679 __ b(ne, &runtime);
8681 // Check that the last match info has space for the capture registers and the 8680 // Check that the last match info has space for the capture registers and the
8682 // additional information. 8681 // additional information.
8683 __ ldr(r0, 8682 __ ldr(r0,
8684 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); 8683 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset));
8685 __ add(r2, r2, Operand(RegExpImpl::kLastMatchOverhead)); 8684 __ add(r2, r2, Operand(RegExpImpl::kLastMatchOverhead));
8686 __ cmp(r2, r0); 8685 __ cmp(r2, Operand(r0, ASR, kSmiTagSize));
8687 __ b(gt, &runtime); 8686 __ b(gt, &runtime);
8688 8687
8689 // subject: Subject string 8688 // subject: Subject string
8690 // regexp_data: RegExp data (FixedArray) 8689 // regexp_data: RegExp data (FixedArray)
8691 // Check the representation and encoding of the subject string. 8690 // Check the representation and encoding of the subject string.
8692 Label seq_string; 8691 Label seq_string;
8693 const int kStringRepresentationEncodingMask = 8692 const int kStringRepresentationEncodingMask =
8694 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; 8693 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask;
8695 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); 8694 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset));
8696 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); 8695 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset));
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
10039 __ bind(&string_add_runtime); 10038 __ bind(&string_add_runtime);
10040 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); 10039 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
10041 } 10040 }
10042 10041
10043 10042
10044 #undef __ 10043 #undef __
10045 10044
10046 } } // namespace v8::internal 10045 } } // namespace v8::internal
10047 10046
10048 #endif // V8_TARGET_ARCH_ARM 10047 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/ic-arm.cc » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698