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/x64/code-stubs-x64.cc

Issue 9463012: Fix the negative lookup stub to handle deleted entries in a (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 5735 matching lines...) Expand 10 before | Expand all | Expand 10 after
5746 void StringDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm, 5746 void StringDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
5747 Label* miss, 5747 Label* miss,
5748 Label* done, 5748 Label* done,
5749 Register properties, 5749 Register properties,
5750 Handle<String> name, 5750 Handle<String> name,
5751 Register r0) { 5751 Register r0) {
5752 // If names of slots in range from 1 to kProbes - 1 for the hash value are 5752 // If names of slots in range from 1 to kProbes - 1 for the hash value are
5753 // not equal to the name and kProbes-th slot is not used (its name is the 5753 // not equal to the name and kProbes-th slot is not used (its name is the
5754 // undefined value), it guarantees the hash table doesn't contain the 5754 // undefined value), it guarantees the hash table doesn't contain the
5755 // property. It's true even if some slots represent deleted properties 5755 // property. It's true even if some slots represent deleted properties
5756 // (their names are the null value). 5756 // (their names are the hole value).
5757 for (int i = 0; i < kInlinedProbes; i++) { 5757 for (int i = 0; i < kInlinedProbes; i++) {
5758 // r0 points to properties hash. 5758 // r0 points to properties hash.
5759 // Compute the masked index: (hash + i + i * i) & mask. 5759 // Compute the masked index: (hash + i + i * i) & mask.
5760 Register index = r0; 5760 Register index = r0;
5761 // Capacity is smi 2^n. 5761 // Capacity is smi 2^n.
5762 __ SmiToInteger32(index, FieldOperand(properties, kCapacityOffset)); 5762 __ SmiToInteger32(index, FieldOperand(properties, kCapacityOffset));
5763 __ decl(index); 5763 __ decl(index);
5764 __ and_(index, 5764 __ and_(index,
5765 Immediate(name->Hash() + StringDictionary::GetProbeOffset(i))); 5765 Immediate(name->Hash() + StringDictionary::GetProbeOffset(i)));
5766 5766
5767 // Scale the index by multiplying by the entry size. 5767 // Scale the index by multiplying by the entry size.
5768 ASSERT(StringDictionary::kEntrySize == 3); 5768 ASSERT(StringDictionary::kEntrySize == 3);
5769 __ lea(index, Operand(index, index, times_2, 0)); // index *= 3. 5769 __ lea(index, Operand(index, index, times_2, 0)); // index *= 3.
5770 5770
5771 Register entity_name = r0; 5771 Register entity_name = r0;
5772 // Having undefined at this place means the name is not contained. 5772 // Having undefined at this place means the name is not contained.
5773 ASSERT_EQ(kSmiTagSize, 1); 5773 ASSERT_EQ(kSmiTagSize, 1);
5774 __ movq(entity_name, Operand(properties, 5774 __ movq(entity_name, Operand(properties,
5775 index, 5775 index,
5776 times_pointer_size, 5776 times_pointer_size,
5777 kElementsStartOffset - kHeapObjectTag)); 5777 kElementsStartOffset - kHeapObjectTag));
5778 __ Cmp(entity_name, masm->isolate()->factory()->undefined_value()); 5778 __ Cmp(entity_name, masm->isolate()->factory()->undefined_value());
5779 __ j(equal, done); 5779 __ j(equal, done);
5780 5780
5781 // Stop if found the property. 5781 // Stop if found the property.
5782 __ Cmp(entity_name, Handle<String>(name)); 5782 __ Cmp(entity_name, Handle<String>(name));
5783 __ j(equal, miss); 5783 __ j(equal, miss);
5784 5784
5785 Label the_hole;
5786 // Check for the hole and skip.
5787 __ CompareRoot(entity_name, Heap::kTheHoleValueRootIndex);
5788 __ j(equal, &the_hole, Label::kNear);
5789
5785 // Check if the entry name is not a symbol. 5790 // Check if the entry name is not a symbol.
5786 __ movq(entity_name, FieldOperand(entity_name, HeapObject::kMapOffset)); 5791 __ movq(entity_name, FieldOperand(entity_name, HeapObject::kMapOffset));
5787 __ testb(FieldOperand(entity_name, Map::kInstanceTypeOffset), 5792 __ testb(FieldOperand(entity_name, Map::kInstanceTypeOffset),
5788 Immediate(kIsSymbolMask)); 5793 Immediate(kIsSymbolMask));
5789 __ j(zero, miss); 5794 __ j(zero, miss);
5795
5796 __ bind(&the_hole);
5790 } 5797 }
5791 5798
5792 StringDictionaryLookupStub stub(properties, 5799 StringDictionaryLookupStub stub(properties,
5793 r0, 5800 r0,
5794 r0, 5801 r0,
5795 StringDictionaryLookupStub::NEGATIVE_LOOKUP); 5802 StringDictionaryLookupStub::NEGATIVE_LOOKUP);
5796 __ Push(Handle<Object>(name)); 5803 __ Push(Handle<Object>(name));
5797 __ push(Immediate(name->Hash())); 5804 __ push(Immediate(name->Hash()));
5798 __ CallStub(&stub); 5805 __ CallStub(&stub);
5799 __ testq(r0, r0); 5806 __ testq(r0, r0);
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
6305 xmm0, 6312 xmm0,
6306 &slow_elements); 6313 &slow_elements);
6307 __ ret(0); 6314 __ ret(0);
6308 } 6315 }
6309 6316
6310 #undef __ 6317 #undef __
6311 6318
6312 } } // namespace v8::internal 6319 } } // namespace v8::internal
6313 6320
6314 #endif // V8_TARGET_ARCH_X64 6321 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698