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

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

Issue 2255004: 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
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4219 matching lines...) Expand 10 before | Expand all | Expand 10 after
4230 4230
4231 __ mov(ecx, FieldOperand(ecx, Map::kInstanceDescriptorsOffset)); 4231 __ mov(ecx, FieldOperand(ecx, Map::kInstanceDescriptorsOffset));
4232 // Get the bridge array held in the enumeration index field. 4232 // Get the bridge array held in the enumeration index field.
4233 __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumerationIndexOffset)); 4233 __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumerationIndexOffset));
4234 // Get the cache from the bridge array. 4234 // Get the cache from the bridge array.
4235 __ mov(edx, FieldOperand(ecx, DescriptorArray::kEnumCacheBridgeCacheOffset)); 4235 __ mov(edx, FieldOperand(ecx, DescriptorArray::kEnumCacheBridgeCacheOffset));
4236 4236
4237 frame_->EmitPush(eax); // <- slot 3 4237 frame_->EmitPush(eax); // <- slot 3
4238 frame_->EmitPush(edx); // <- slot 2 4238 frame_->EmitPush(edx); // <- slot 2
4239 __ mov(eax, FieldOperand(edx, FixedArray::kLengthOffset)); 4239 __ mov(eax, FieldOperand(edx, FixedArray::kLengthOffset));
4240 __ SmiTag(eax);
4241 frame_->EmitPush(eax); // <- slot 1 4240 frame_->EmitPush(eax); // <- slot 1
4242 frame_->EmitPush(Immediate(Smi::FromInt(0))); // <- slot 0 4241 frame_->EmitPush(Immediate(Smi::FromInt(0))); // <- slot 0
4243 entry.Jump(); 4242 entry.Jump();
4244 4243
4245 fixed_array.Bind(); 4244 fixed_array.Bind();
4246 // eax: fixed array (result from call to Runtime::kGetPropertyNamesFast) 4245 // eax: fixed array (result from call to Runtime::kGetPropertyNamesFast)
4247 frame_->EmitPush(Immediate(Smi::FromInt(0))); // <- slot 3 4246 frame_->EmitPush(Immediate(Smi::FromInt(0))); // <- slot 3
4248 frame_->EmitPush(eax); // <- slot 2 4247 frame_->EmitPush(eax); // <- slot 2
4249 4248
4250 // Push the length of the array and the initial index onto the stack. 4249 // Push the length of the array and the initial index onto the stack.
4251 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); 4250 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset));
4252 __ SmiTag(eax);
4253 frame_->EmitPush(eax); // <- slot 1 4251 frame_->EmitPush(eax); // <- slot 1
4254 frame_->EmitPush(Immediate(Smi::FromInt(0))); // <- slot 0 4252 frame_->EmitPush(Immediate(Smi::FromInt(0))); // <- slot 0
4255 4253
4256 // Condition. 4254 // Condition.
4257 entry.Bind(); 4255 entry.Bind();
4258 // Grab the current frame's height for the break and continue 4256 // Grab the current frame's height for the break and continue
4259 // targets only after all the state is pushed on the frame. 4257 // targets only after all the state is pushed on the frame.
4260 node->break_target()->set_direction(JumpTarget::FORWARD_ONLY); 4258 node->break_target()->set_direction(JumpTarget::FORWARD_ONLY);
4261 node->continue_target()->set_direction(JumpTarget::FORWARD_ONLY); 4259 node->continue_target()->set_direction(JumpTarget::FORWARD_ONLY);
4262 4260
(...skipping 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after
6758 6756
6759 // Fill out the elements FixedArray. 6757 // Fill out the elements FixedArray.
6760 // eax: JSArray. 6758 // eax: JSArray.
6761 // ebx: FixedArray. 6759 // ebx: FixedArray.
6762 // ecx: Number of elements in array, as smi. 6760 // ecx: Number of elements in array, as smi.
6763 6761
6764 // Set map. 6762 // Set map.
6765 __ mov(FieldOperand(ebx, HeapObject::kMapOffset), 6763 __ mov(FieldOperand(ebx, HeapObject::kMapOffset),
6766 Immediate(Factory::fixed_array_map())); 6764 Immediate(Factory::fixed_array_map()));
6767 // Set length. 6765 // Set length.
6768 __ SmiUntag(ecx);
6769 __ mov(FieldOperand(ebx, FixedArray::kLengthOffset), ecx); 6766 __ mov(FieldOperand(ebx, FixedArray::kLengthOffset), ecx);
6770 // Fill contents of fixed-array with the-hole. 6767 // Fill contents of fixed-array with the-hole.
6768 __ SmiUntag(ecx);
6771 __ mov(edx, Immediate(Factory::the_hole_value())); 6769 __ mov(edx, Immediate(Factory::the_hole_value()));
6772 __ lea(ebx, FieldOperand(ebx, FixedArray::kHeaderSize)); 6770 __ lea(ebx, FieldOperand(ebx, FixedArray::kHeaderSize));
6773 // Fill fixed array elements with hole. 6771 // Fill fixed array elements with hole.
6774 // eax: JSArray. 6772 // eax: JSArray.
6775 // ecx: Number of elements to fill. 6773 // ecx: Number of elements to fill.
6776 // ebx: Start of elements in FixedArray. 6774 // ebx: Start of elements in FixedArray.
6777 // edx: the hole. 6775 // edx: the hole.
6778 Label loop; 6776 Label loop;
6779 __ test(ecx, Operand(ecx)); 6777 __ test(ecx, Operand(ecx));
6780 __ bind(&loop); 6778 __ bind(&loop);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
6864 6862
6865 // Find a place to put new cached value into. 6863 // Find a place to put new cached value into.
6866 Label add_new_entry, update_cache; 6864 Label add_new_entry, update_cache;
6867 __ mov(ecx, Operand(esp, kPointerSize)); // restore the cache 6865 __ mov(ecx, Operand(esp, kPointerSize)); // restore the cache
6868 // Possible optimization: cache size is constant for the given cache 6866 // Possible optimization: cache size is constant for the given cache
6869 // so technically we could use a constant here. However, if we have 6867 // so technically we could use a constant here. However, if we have
6870 // cache miss this optimization would hardly matter much. 6868 // cache miss this optimization would hardly matter much.
6871 6869
6872 // Check if we could add new entry to cache. 6870 // Check if we could add new entry to cache.
6873 __ mov(ebx, FieldOperand(ecx, FixedArray::kLengthOffset)); 6871 __ mov(ebx, FieldOperand(ecx, FixedArray::kLengthOffset));
6874 __ SmiTag(ebx);
6875 __ cmp(ebx, FieldOperand(ecx, JSFunctionResultCache::kCacheSizeOffset)); 6872 __ cmp(ebx, FieldOperand(ecx, JSFunctionResultCache::kCacheSizeOffset));
6876 __ j(greater, &add_new_entry); 6873 __ j(greater, &add_new_entry);
6877 6874
6878 // Check if we could evict entry after finger. 6875 // Check if we could evict entry after finger.
6879 __ mov(edx, FieldOperand(ecx, JSFunctionResultCache::kFingerOffset)); 6876 __ mov(edx, FieldOperand(ecx, JSFunctionResultCache::kFingerOffset));
6880 __ add(Operand(edx), Immediate(kEntrySizeSmi)); 6877 __ add(Operand(edx), Immediate(kEntrySizeSmi));
6881 __ cmp(ebx, Operand(edx)); 6878 __ cmp(ebx, Operand(edx));
6882 __ j(greater, &update_cache); 6879 __ j(greater, &update_cache);
6883 6880
6884 // Need to wrap over the cache. 6881 // Need to wrap over the cache.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
7062 __ mov(tmp2.reg(), Operand(index2.reg(), 0)); 7059 __ mov(tmp2.reg(), Operand(index2.reg(), 0));
7063 __ mov(Operand(index2.reg(), 0), object.reg()); 7060 __ mov(Operand(index2.reg(), 0), object.reg());
7064 __ mov(Operand(index1.reg(), 0), tmp2.reg()); 7061 __ mov(Operand(index1.reg(), 0), tmp2.reg());
7065 7062
7066 Label done; 7063 Label done;
7067 __ InNewSpace(tmp1.reg(), tmp2.reg(), equal, &done); 7064 __ InNewSpace(tmp1.reg(), tmp2.reg(), equal, &done);
7068 // Possible optimization: do a check that both values are Smis 7065 // Possible optimization: do a check that both values are Smis
7069 // (or them and test against Smi mask.) 7066 // (or them and test against Smi mask.)
7070 7067
7071 __ mov(tmp2.reg(), tmp1.reg()); 7068 __ mov(tmp2.reg(), tmp1.reg());
7072 RecordWriteStub recordWrite1(tmp2.reg(), index1.reg(), object.reg()); 7069 __ RecordWriteHelper(tmp2.reg(), index1.reg(), object.reg());
7073 __ CallStub(&recordWrite1); 7070 __ RecordWriteHelper(tmp1.reg(), index2.reg(), object.reg());
7074
7075 RecordWriteStub recordWrite2(tmp1.reg(), index2.reg(), object.reg());
7076 __ CallStub(&recordWrite2);
7077
7078 __ bind(&done); 7071 __ bind(&done);
7079 7072
7080 deferred->BindExit(); 7073 deferred->BindExit();
7081 frame_->Push(Factory::undefined_value()); 7074 frame_->Push(Factory::undefined_value());
7082 } 7075 }
7083 7076
7084 7077
7085 void CodeGenerator::GenerateCallFunction(ZoneList<Expression*>* args) { 7078 void CodeGenerator::GenerateCallFunction(ZoneList<Expression*>* args) {
7086 Comment cmnt(masm_, "[ GenerateCallFunction"); 7079 Comment cmnt(masm_, "[ GenerateCallFunction");
7087 7080
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
8766 // Use a fresh temporary to load the elements without destroying 8759 // Use a fresh temporary to load the elements without destroying
8767 // the receiver which is needed for the deferred slow case. 8760 // the receiver which is needed for the deferred slow case.
8768 Result elements = allocator()->Allocate(); 8761 Result elements = allocator()->Allocate();
8769 ASSERT(elements.is_valid()); 8762 ASSERT(elements.is_valid());
8770 8763
8771 Result key = frame_->Pop(); 8764 Result key = frame_->Pop();
8772 Result receiver = frame_->Pop(); 8765 Result receiver = frame_->Pop();
8773 key.ToRegister(); 8766 key.ToRegister();
8774 receiver.ToRegister(); 8767 receiver.ToRegister();
8775 8768
8776 // Use a fresh temporary for the index and later the loaded
8777 // value.
8778 result = allocator()->Allocate();
8779 ASSERT(result.is_valid());
8780
8781 DeferredReferenceGetKeyedValue* deferred = 8769 DeferredReferenceGetKeyedValue* deferred =
8782 new DeferredReferenceGetKeyedValue(result.reg(), 8770 new DeferredReferenceGetKeyedValue(elements.reg(),
8783 receiver.reg(), 8771 receiver.reg(),
8784 key.reg()); 8772 key.reg());
8785 8773
8786 __ test(receiver.reg(), Immediate(kSmiTagMask)); 8774 __ test(receiver.reg(), Immediate(kSmiTagMask));
8787 deferred->Branch(zero); 8775 deferred->Branch(zero);
8788 8776
8789 // Check that the receiver has the expected map. 8777 // Check that the receiver has the expected map.
8790 // Initially, use an invalid map. The map is patched in the IC 8778 // Initially, use an invalid map. The map is patched in the IC
8791 // initialization code. 8779 // initialization code.
8792 __ bind(deferred->patch_site()); 8780 __ bind(deferred->patch_site());
(...skipping 12 matching lines...) Expand all
8805 } 8793 }
8806 8794
8807 // Get the elements array from the receiver and check that it 8795 // Get the elements array from the receiver and check that it
8808 // is not a dictionary. 8796 // is not a dictionary.
8809 __ mov(elements.reg(), 8797 __ mov(elements.reg(),
8810 FieldOperand(receiver.reg(), JSObject::kElementsOffset)); 8798 FieldOperand(receiver.reg(), JSObject::kElementsOffset));
8811 __ cmp(FieldOperand(elements.reg(), HeapObject::kMapOffset), 8799 __ cmp(FieldOperand(elements.reg(), HeapObject::kMapOffset),
8812 Immediate(Factory::fixed_array_map())); 8800 Immediate(Factory::fixed_array_map()));
8813 deferred->Branch(not_equal); 8801 deferred->Branch(not_equal);
8814 8802
8815 // Shift the key to get the actual index value and check that 8803 // Check that the key is within bounds.
8816 // it is within bounds. Use unsigned comparison to handle negative keys. 8804 __ cmp(key.reg(),
8817 __ mov(result.reg(), key.reg());
8818 __ SmiUntag(result.reg());
8819 __ cmp(result.reg(),
8820 FieldOperand(elements.reg(), FixedArray::kLengthOffset)); 8805 FieldOperand(elements.reg(), FixedArray::kLengthOffset));
8821 deferred->Branch(above_equal); 8806 deferred->Branch(above_equal);
8822 8807
8823 __ mov(result.reg(), Operand(elements.reg(), 8808 // Load and check that the result is not the hole.
8824 result.reg(), 8809 // Key holds a smi.
8825 times_4, 8810 ASSERT((kSmiTag == 0) && (kSmiTagSize == 1));
8826 FixedArray::kHeaderSize - kHeapObjectTag)); 8811 __ mov(elements.reg(),
8827 elements.Unuse(); 8812 FieldOperand(elements.reg(),
8813 key.reg(),
8814 times_2,
8815 FixedArray::kHeaderSize));
8816 result = elements;
8828 __ cmp(Operand(result.reg()), Immediate(Factory::the_hole_value())); 8817 __ cmp(Operand(result.reg()), Immediate(Factory::the_hole_value()));
8829 deferred->Branch(equal); 8818 deferred->Branch(equal);
8830 __ IncrementCounter(&Counters::keyed_load_inline, 1); 8819 __ IncrementCounter(&Counters::keyed_load_inline, 1);
8831 8820
8832 deferred->BindExit(); 8821 deferred->BindExit();
8833 } else { 8822 } else {
8834 Comment cmnt(masm_, "[ Load from keyed Property"); 8823 Comment cmnt(masm_, "[ Load from keyed Property");
8835 result = frame_->CallKeyedLoadIC(RelocInfo::CODE_TARGET); 8824 result = frame_->CallKeyedLoadIC(RelocInfo::CODE_TARGET);
8836 // Make sure that we do not have a test instruction after the 8825 // Make sure that we do not have a test instruction after the
8837 // call. A test instruction after the call is used to 8826 // call. A test instruction after the call is used to
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
8902 FieldOperand(receiver.reg(), JSArray::kLengthOffset)); 8891 FieldOperand(receiver.reg(), JSArray::kLengthOffset));
8903 deferred->Branch(above_equal); 8892 deferred->Branch(above_equal);
8904 8893
8905 // Get the elements array from the receiver and check that it is not a 8894 // Get the elements array from the receiver and check that it is not a
8906 // dictionary. 8895 // dictionary.
8907 __ mov(tmp.reg(), 8896 __ mov(tmp.reg(),
8908 FieldOperand(receiver.reg(), JSArray::kElementsOffset)); 8897 FieldOperand(receiver.reg(), JSArray::kElementsOffset));
8909 8898
8910 // Check whether it is possible to omit the write barrier. If the elements 8899 // Check whether it is possible to omit the write barrier. If the elements
8911 // array is in new space or the value written is a smi we can safely update 8900 // array is in new space or the value written is a smi we can safely update
8912 // the elements array without updating the remembered set. 8901 // the elements array without write barrier.
8913 Label in_new_space; 8902 Label in_new_space;
8914 __ InNewSpace(tmp.reg(), tmp2.reg(), equal, &in_new_space); 8903 __ InNewSpace(tmp.reg(), tmp2.reg(), equal, &in_new_space);
8915 if (!value_is_constant) { 8904 if (!value_is_constant) {
8916 __ test(result.reg(), Immediate(kSmiTagMask)); 8905 __ test(result.reg(), Immediate(kSmiTagMask));
8917 deferred->Branch(not_zero); 8906 deferred->Branch(not_zero);
8918 } 8907 }
8919 8908
8920 __ bind(&in_new_space); 8909 __ bind(&in_new_space);
8921 // Bind the deferred code patch site to be able to locate the fixed 8910 // Bind the deferred code patch site to be able to locate the fixed
8922 // array map comparison. When debugging, we patch this comparison to 8911 // array map comparison. When debugging, we patch this comparison to
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
9172 Label gc; 9161 Label gc;
9173 int length = slots_ + Context::MIN_CONTEXT_SLOTS; 9162 int length = slots_ + Context::MIN_CONTEXT_SLOTS;
9174 __ AllocateInNewSpace((length * kPointerSize) + FixedArray::kHeaderSize, 9163 __ AllocateInNewSpace((length * kPointerSize) + FixedArray::kHeaderSize,
9175 eax, ebx, ecx, &gc, TAG_OBJECT); 9164 eax, ebx, ecx, &gc, TAG_OBJECT);
9176 9165
9177 // Get the function from the stack. 9166 // Get the function from the stack.
9178 __ mov(ecx, Operand(esp, 1 * kPointerSize)); 9167 __ mov(ecx, Operand(esp, 1 * kPointerSize));
9179 9168
9180 // Setup the object header. 9169 // Setup the object header.
9181 __ mov(FieldOperand(eax, HeapObject::kMapOffset), Factory::context_map()); 9170 __ mov(FieldOperand(eax, HeapObject::kMapOffset), Factory::context_map());
9182 __ mov(FieldOperand(eax, Array::kLengthOffset), Immediate(length)); 9171 __ mov(FieldOperand(eax, Context::kLengthOffset),
9172 Immediate(Smi::FromInt(length)));
9183 9173
9184 // Setup the fixed slots. 9174 // Setup the fixed slots.
9185 __ xor_(ebx, Operand(ebx)); // Set to NULL. 9175 __ xor_(ebx, Operand(ebx)); // Set to NULL.
9186 __ mov(Operand(eax, Context::SlotOffset(Context::CLOSURE_INDEX)), ecx); 9176 __ mov(Operand(eax, Context::SlotOffset(Context::CLOSURE_INDEX)), ecx);
9187 __ mov(Operand(eax, Context::SlotOffset(Context::FCONTEXT_INDEX)), eax); 9177 __ mov(Operand(eax, Context::SlotOffset(Context::FCONTEXT_INDEX)), eax);
9188 __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), ebx); 9178 __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), ebx);
9189 __ mov(Operand(eax, Context::SlotOffset(Context::EXTENSION_INDEX)), ebx); 9179 __ mov(Operand(eax, Context::SlotOffset(Context::EXTENSION_INDEX)), ebx);
9190 9180
9191 // Copy the global object from the surrounding context. We go through the 9181 // Copy the global object from the surrounding context. We go through the
9192 // context in the function (ecx) to match the allocation behavior we have 9182 // context in the function (ecx) to match the allocation behavior we have
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
11135 // Get the length (smi tagged) and set that as an in-object property too. 11125 // Get the length (smi tagged) and set that as an in-object property too.
11136 ASSERT(Heap::arguments_length_index == 1); 11126 ASSERT(Heap::arguments_length_index == 1);
11137 __ mov(ecx, Operand(esp, 1 * kPointerSize)); 11127 __ mov(ecx, Operand(esp, 1 * kPointerSize));
11138 __ mov(FieldOperand(eax, JSObject::kHeaderSize + kPointerSize), ecx); 11128 __ mov(FieldOperand(eax, JSObject::kHeaderSize + kPointerSize), ecx);
11139 11129
11140 // If there are no actual arguments, we're done. 11130 // If there are no actual arguments, we're done.
11141 Label done; 11131 Label done;
11142 __ test(ecx, Operand(ecx)); 11132 __ test(ecx, Operand(ecx));
11143 __ j(zero, &done); 11133 __ j(zero, &done);
11144 11134
11145 // Get the parameters pointer from the stack and untag the length. 11135 // Get the parameters pointer from the stack.
11146 __ mov(edx, Operand(esp, 2 * kPointerSize)); 11136 __ mov(edx, Operand(esp, 2 * kPointerSize));
11147 __ SmiUntag(ecx);
11148 11137
11149 // Setup the elements pointer in the allocated arguments object and 11138 // Setup the elements pointer in the allocated arguments object and
11150 // initialize the header in the elements fixed array. 11139 // initialize the header in the elements fixed array.
11151 __ lea(edi, Operand(eax, Heap::kArgumentsObjectSize)); 11140 __ lea(edi, Operand(eax, Heap::kArgumentsObjectSize));
11152 __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi); 11141 __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi);
11153 __ mov(FieldOperand(edi, FixedArray::kMapOffset), 11142 __ mov(FieldOperand(edi, FixedArray::kMapOffset),
11154 Immediate(Factory::fixed_array_map())); 11143 Immediate(Factory::fixed_array_map()));
11155 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx); 11144 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx);
11145 // Untag the length for the loop below.
11146 __ SmiUntag(ecx);
11156 11147
11157 // Copy the fixed array slots. 11148 // Copy the fixed array slots.
11158 Label loop; 11149 Label loop;
11159 __ bind(&loop); 11150 __ bind(&loop);
11160 __ mov(ebx, Operand(edx, -1 * kPointerSize)); // Skip receiver. 11151 __ mov(ebx, Operand(edx, -1 * kPointerSize)); // Skip receiver.
11161 __ mov(FieldOperand(edi, FixedArray::kHeaderSize), ebx); 11152 __ mov(FieldOperand(edi, FixedArray::kHeaderSize), ebx);
11162 __ add(Operand(edi), Immediate(kPointerSize)); 11153 __ add(Operand(edi), Immediate(kPointerSize));
11163 __ sub(Operand(edx), Immediate(kPointerSize)); 11154 __ sub(Operand(edx), Immediate(kPointerSize));
11164 __ dec(ecx); 11155 __ dec(ecx);
11165 __ j(not_zero, &loop); 11156 __ j(not_zero, &loop);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
11274 __ CmpObjectType(eax, JS_ARRAY_TYPE, ebx); 11265 __ CmpObjectType(eax, JS_ARRAY_TYPE, ebx);
11275 __ j(not_equal, &runtime); 11266 __ j(not_equal, &runtime);
11276 // Check that the JSArray is in fast case. 11267 // Check that the JSArray is in fast case.
11277 __ mov(ebx, FieldOperand(eax, JSArray::kElementsOffset)); 11268 __ mov(ebx, FieldOperand(eax, JSArray::kElementsOffset));
11278 __ mov(eax, FieldOperand(ebx, HeapObject::kMapOffset)); 11269 __ mov(eax, FieldOperand(ebx, HeapObject::kMapOffset));
11279 __ cmp(eax, Factory::fixed_array_map()); 11270 __ cmp(eax, Factory::fixed_array_map());
11280 __ j(not_equal, &runtime); 11271 __ j(not_equal, &runtime);
11281 // Check that the last match info has space for the capture registers and the 11272 // Check that the last match info has space for the capture registers and the
11282 // additional information. 11273 // additional information.
11283 __ mov(eax, FieldOperand(ebx, FixedArray::kLengthOffset)); 11274 __ mov(eax, FieldOperand(ebx, FixedArray::kLengthOffset));
11275 __ SmiUntag(eax);
11284 __ add(Operand(edx), Immediate(RegExpImpl::kLastMatchOverhead)); 11276 __ add(Operand(edx), Immediate(RegExpImpl::kLastMatchOverhead));
11285 __ cmp(edx, Operand(eax)); 11277 __ cmp(edx, Operand(eax));
11286 __ j(greater, &runtime); 11278 __ j(greater, &runtime);
11287 11279
11288 // ecx: RegExp data (FixedArray) 11280 // ecx: RegExp data (FixedArray)
11289 // Check the representation and encoding of the subject string. 11281 // Check the representation and encoding of the subject string.
11290 Label seq_string, seq_two_byte_string, check_code; 11282 Label seq_string, seq_two_byte_string, check_code;
11291 const int kStringRepresentationEncodingMask = 11283 const int kStringRepresentationEncodingMask =
11292 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; 11284 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask;
11293 __ mov(eax, Operand(esp, kSubjectOffset)); 11285 __ mov(eax, Operand(esp, kSubjectOffset));
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
11517 Register scratch = scratch2; 11509 Register scratch = scratch2;
11518 11510
11519 // Load the number string cache. 11511 // Load the number string cache.
11520 ExternalReference roots_address = ExternalReference::roots_address(); 11512 ExternalReference roots_address = ExternalReference::roots_address();
11521 __ mov(scratch, Immediate(Heap::kNumberStringCacheRootIndex)); 11513 __ mov(scratch, Immediate(Heap::kNumberStringCacheRootIndex));
11522 __ mov(number_string_cache, 11514 __ mov(number_string_cache,
11523 Operand::StaticArray(scratch, times_pointer_size, roots_address)); 11515 Operand::StaticArray(scratch, times_pointer_size, roots_address));
11524 // Make the hash mask from the length of the number string cache. It 11516 // Make the hash mask from the length of the number string cache. It
11525 // contains two elements (number and string) for each cache entry. 11517 // contains two elements (number and string) for each cache entry.
11526 __ mov(mask, FieldOperand(number_string_cache, FixedArray::kLengthOffset)); 11518 __ mov(mask, FieldOperand(number_string_cache, FixedArray::kLengthOffset));
11527 __ shr(mask, 1); // Divide length by two (length is not a smi). 11519 __ shr(mask, kSmiTagSize + 1); // Untag length and divide it by two.
11528 __ sub(Operand(mask), Immediate(1)); // Make mask. 11520 __ sub(Operand(mask), Immediate(1)); // Make mask.
11529 11521
11530 // Calculate the entry in the number string cache. The hash value in the 11522 // Calculate the entry in the number string cache. The hash value in the
11531 // number string cache for smis is just the smi value, and the hash for 11523 // number string cache for smis is just the smi value, and the hash for
11532 // doubles is the xor of the upper and lower words. See 11524 // doubles is the xor of the upper and lower words. See
11533 // Heap::GetNumberStringCache. 11525 // Heap::GetNumberStringCache.
11534 Label smi_hash_calculated; 11526 Label smi_hash_calculated;
11535 Label load_result_from_cache; 11527 Label load_result_from_cache;
11536 if (object_is_smi) { 11528 if (object_is_smi) {
11537 __ mov(scratch, object); 11529 __ mov(scratch, object);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
11608 // Generate code to lookup number in the number string cache. 11600 // Generate code to lookup number in the number string cache.
11609 GenerateLookupNumberStringCache(masm, ebx, eax, ecx, edx, false, &runtime); 11601 GenerateLookupNumberStringCache(masm, ebx, eax, ecx, edx, false, &runtime);
11610 __ ret(1 * kPointerSize); 11602 __ ret(1 * kPointerSize);
11611 11603
11612 __ bind(&runtime); 11604 __ bind(&runtime);
11613 // Handle number to string in the runtime system if not found in the cache. 11605 // Handle number to string in the runtime system if not found in the cache.
11614 __ TailCallRuntime(Runtime::kNumberToStringSkipCache, 1, 1); 11606 __ TailCallRuntime(Runtime::kNumberToStringSkipCache, 1, 1);
11615 } 11607 }
11616 11608
11617 11609
11618 void RecordWriteStub::Generate(MacroAssembler* masm) {
11619 masm->RecordWriteHelper(object_, addr_, scratch_);
11620 masm->ret(0);
11621 }
11622
11623
11624 static int NegativeComparisonResult(Condition cc) { 11610 static int NegativeComparisonResult(Condition cc) {
11625 ASSERT(cc != equal); 11611 ASSERT(cc != equal);
11626 ASSERT((cc == less) || (cc == less_equal) 11612 ASSERT((cc == less) || (cc == less_equal)
11627 || (cc == greater) || (cc == greater_equal)); 11613 || (cc == greater) || (cc == greater_equal));
11628 return (cc == greater || cc == greater_equal) ? LESS : GREATER; 11614 return (cc == greater || cc == greater_equal) ? LESS : GREATER;
11629 } 11615 }
11630 11616
11631 11617
11632 void CompareStub::Generate(MacroAssembler* masm) { 11618 void CompareStub::Generate(MacroAssembler* masm) {
11633 Label call_builtin, done; 11619 Label call_builtin, done;
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after
13502 // tagged as a small integer. 13488 // tagged as a small integer.
13503 __ bind(&runtime); 13489 __ bind(&runtime);
13504 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 13490 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
13505 } 13491 }
13506 13492
13507 #undef __ 13493 #undef __
13508 13494
13509 } } // namespace v8::internal 13495 } } // namespace v8::internal
13510 13496
13511 #endif // V8_TARGET_ARCH_IA32 13497 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698