OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 NameDictionaryLookupStub stub(masm->isolate(), properties, r0, r0, | 2569 NameDictionaryLookupStub stub(masm->isolate(), properties, r0, r0, |
2570 NEGATIVE_LOOKUP); | 2570 NEGATIVE_LOOKUP); |
2571 __ Push(Handle<Object>(name)); | 2571 __ Push(Handle<Object>(name)); |
2572 __ Push(Immediate(name->Hash())); | 2572 __ Push(Immediate(name->Hash())); |
2573 __ CallStub(&stub); | 2573 __ CallStub(&stub); |
2574 __ testp(r0, r0); | 2574 __ testp(r0, r0); |
2575 __ j(not_zero, miss); | 2575 __ j(not_zero, miss); |
2576 __ jmp(done); | 2576 __ jmp(done); |
2577 } | 2577 } |
2578 | 2578 |
2579 | |
2580 // Probe the name dictionary in the |elements| register. Jump to the | |
2581 // |done| label if a property with the given name is found leaving the | |
2582 // index into the dictionary in |r1|. Jump to the |miss| label | |
2583 // otherwise. | |
2584 void NameDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm, | |
2585 Label* miss, | |
2586 Label* done, | |
2587 Register elements, | |
2588 Register name, | |
2589 Register r0, | |
2590 Register r1) { | |
2591 DCHECK(!elements.is(r0)); | |
2592 DCHECK(!elements.is(r1)); | |
2593 DCHECK(!name.is(r0)); | |
2594 DCHECK(!name.is(r1)); | |
2595 | |
2596 __ AssertName(name); | |
2597 | |
2598 __ SmiToInteger32(r0, FieldOperand(elements, kCapacityOffset)); | |
2599 __ decl(r0); | |
2600 | |
2601 for (int i = 0; i < kInlinedProbes; i++) { | |
2602 // Compute the masked index: (hash + i + i * i) & mask. | |
2603 __ movl(r1, FieldOperand(name, Name::kHashFieldOffset)); | |
2604 __ shrl(r1, Immediate(Name::kHashShift)); | |
2605 if (i > 0) { | |
2606 __ addl(r1, Immediate(NameDictionary::GetProbeOffset(i))); | |
2607 } | |
2608 __ andp(r1, r0); | |
2609 | |
2610 // Scale the index by multiplying by the entry size. | |
2611 STATIC_ASSERT(NameDictionary::kEntrySize == 3); | |
2612 __ leap(r1, Operand(r1, r1, times_2, 0)); // r1 = r1 * 3 | |
2613 | |
2614 // Check if the key is identical to the name. | |
2615 __ cmpp(name, Operand(elements, r1, times_pointer_size, | |
2616 kElementsStartOffset - kHeapObjectTag)); | |
2617 __ j(equal, done); | |
2618 } | |
2619 | |
2620 NameDictionaryLookupStub stub(masm->isolate(), elements, r0, r1, | |
2621 POSITIVE_LOOKUP); | |
2622 __ Push(name); | |
2623 __ movl(r0, FieldOperand(name, Name::kHashFieldOffset)); | |
2624 __ shrl(r0, Immediate(Name::kHashShift)); | |
2625 __ Push(r0); | |
2626 __ CallStub(&stub); | |
2627 | |
2628 __ testp(r0, r0); | |
2629 __ j(zero, miss); | |
2630 __ jmp(done); | |
2631 } | |
2632 | |
2633 | |
2634 void NameDictionaryLookupStub::Generate(MacroAssembler* masm) { | 2579 void NameDictionaryLookupStub::Generate(MacroAssembler* masm) { |
2635 // This stub overrides SometimesSetsUpAFrame() to return false. That means | 2580 // This stub overrides SometimesSetsUpAFrame() to return false. That means |
2636 // we cannot call anything that could cause a GC from this stub. | 2581 // we cannot call anything that could cause a GC from this stub. |
2637 // Stack frame on entry: | 2582 // Stack frame on entry: |
2638 // rsp[0 * kPointerSize] : return address. | 2583 // rsp[0 * kPointerSize] : return address. |
2639 // rsp[1 * kPointerSize] : key's hash. | 2584 // rsp[1 * kPointerSize] : key's hash. |
2640 // rsp[2 * kPointerSize] : key. | 2585 // rsp[2 * kPointerSize] : key. |
2641 // Registers: | 2586 // Registers: |
2642 // dictionary_: NameDictionary to probe. | 2587 // dictionary_: NameDictionary to probe. |
2643 // result_: used as scratch. | 2588 // result_: used as scratch. |
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4179 kStackUnwindSpace, nullptr, return_value_operand, | 4124 kStackUnwindSpace, nullptr, return_value_operand, |
4180 NULL); | 4125 NULL); |
4181 } | 4126 } |
4182 | 4127 |
4183 #undef __ | 4128 #undef __ |
4184 | 4129 |
4185 } // namespace internal | 4130 } // namespace internal |
4186 } // namespace v8 | 4131 } // namespace v8 |
4187 | 4132 |
4188 #endif // V8_TARGET_ARCH_X64 | 4133 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |