OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 5443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5454 __ pop(rcx); | 5454 __ pop(rcx); |
5455 __ pop(rax); | 5455 __ pop(rax); |
5456 __ pop(rdx); | 5456 __ pop(rdx); |
5457 __ push(rcx); | 5457 __ push(rcx); |
5458 | 5458 |
5459 // Do a tail call to the rewritten stub. | 5459 // Do a tail call to the rewritten stub. |
5460 __ jmp(rdi); | 5460 __ jmp(rdi); |
5461 } | 5461 } |
5462 | 5462 |
5463 | 5463 |
5464 MaybeObject* StringDictionaryLookupStub::GenerateNegativeLookup( | 5464 void StringDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm, |
| 5465 Label* miss, |
| 5466 Label* done, |
| 5467 Register properties, |
| 5468 Handle<String> name, |
| 5469 Register r0) { |
| 5470 // If names of slots in range from 1 to kProbes - 1 for the hash value are |
| 5471 // not equal to the name and kProbes-th slot is not used (its name is the |
| 5472 // undefined value), it guarantees the hash table doesn't contain the |
| 5473 // property. It's true even if some slots represent deleted properties |
| 5474 // (their names are the null value). |
| 5475 for (int i = 0; i < kInlinedProbes; i++) { |
| 5476 // r0 points to properties hash. |
| 5477 // Compute the masked index: (hash + i + i * i) & mask. |
| 5478 Register index = r0; |
| 5479 // Capacity is smi 2^n. |
| 5480 __ SmiToInteger32(index, FieldOperand(properties, kCapacityOffset)); |
| 5481 __ decl(index); |
| 5482 __ and_(index, |
| 5483 Immediate(name->Hash() + StringDictionary::GetProbeOffset(i))); |
| 5484 |
| 5485 // Scale the index by multiplying by the entry size. |
| 5486 ASSERT(StringDictionary::kEntrySize == 3); |
| 5487 __ lea(index, Operand(index, index, times_2, 0)); // index *= 3. |
| 5488 |
| 5489 Register entity_name = r0; |
| 5490 // Having undefined at this place means the name is not contained. |
| 5491 ASSERT_EQ(kSmiTagSize, 1); |
| 5492 __ movq(entity_name, Operand(properties, |
| 5493 index, |
| 5494 times_pointer_size, |
| 5495 kElementsStartOffset - kHeapObjectTag)); |
| 5496 __ Cmp(entity_name, masm->isolate()->factory()->undefined_value()); |
| 5497 __ j(equal, done); |
| 5498 |
| 5499 // Stop if found the property. |
| 5500 __ Cmp(entity_name, Handle<String>(name)); |
| 5501 __ j(equal, miss); |
| 5502 |
| 5503 // Check if the entry name is not a symbol. |
| 5504 __ movq(entity_name, FieldOperand(entity_name, HeapObject::kMapOffset)); |
| 5505 __ testb(FieldOperand(entity_name, Map::kInstanceTypeOffset), |
| 5506 Immediate(kIsSymbolMask)); |
| 5507 __ j(zero, miss); |
| 5508 } |
| 5509 |
| 5510 StringDictionaryLookupStub stub(properties, |
| 5511 r0, |
| 5512 r0, |
| 5513 StringDictionaryLookupStub::NEGATIVE_LOOKUP); |
| 5514 __ Push(Handle<Object>(name)); |
| 5515 __ push(Immediate(name->Hash())); |
| 5516 __ CallStub(&stub); |
| 5517 __ testq(r0, r0); |
| 5518 __ j(not_zero, miss); |
| 5519 __ jmp(done); |
| 5520 } |
| 5521 |
| 5522 |
| 5523 // TODO(kmillikin): Eliminate this function when the stub cache is fully |
| 5524 // handlified. |
| 5525 MaybeObject* StringDictionaryLookupStub::TryGenerateNegativeLookup( |
5465 MacroAssembler* masm, | 5526 MacroAssembler* masm, |
5466 Label* miss, | 5527 Label* miss, |
5467 Label* done, | 5528 Label* done, |
5468 Register properties, | 5529 Register properties, |
5469 String* name, | 5530 String* name, |
5470 Register r0) { | 5531 Register r0) { |
5471 // If names of slots in range from 1 to kProbes - 1 for the hash value are | 5532 // If names of slots in range from 1 to kProbes - 1 for the hash value are |
5472 // not equal to the name and kProbes-th slot is not used (its name is the | 5533 // not equal to the name and kProbes-th slot is not used (its name is the |
5473 // undefined value), it guarantees the hash table doesn't contain the | 5534 // undefined value), it guarantees the hash table doesn't contain the |
5474 // property. It's true even if some slots represent deleted properties | 5535 // property. It's true even if some slots represent deleted properties |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5942 __ bind(&need_incremental); | 6003 __ bind(&need_incremental); |
5943 | 6004 |
5944 // Fall through when we need to inform the incremental marker. | 6005 // Fall through when we need to inform the incremental marker. |
5945 } | 6006 } |
5946 | 6007 |
5947 #undef __ | 6008 #undef __ |
5948 | 6009 |
5949 } } // namespace v8::internal | 6010 } } // namespace v8::internal |
5950 | 6011 |
5951 #endif // V8_TARGET_ARCH_X64 | 6012 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |