| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 3598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3609 // Compute the masked index: (hash + i + i * i) & mask. | 3609 // Compute the masked index: (hash + i + i * i) & mask. |
| 3610 Register index = r0; | 3610 Register index = r0; |
| 3611 // Capacity is smi 2^n. | 3611 // Capacity is smi 2^n. |
| 3612 __ mov(index, FieldOperand(properties, kCapacityOffset)); | 3612 __ mov(index, FieldOperand(properties, kCapacityOffset)); |
| 3613 __ dec(index); | 3613 __ dec(index); |
| 3614 __ and_(index, | 3614 __ and_(index, |
| 3615 Immediate(Smi::FromInt(name->Hash() + | 3615 Immediate(Smi::FromInt(name->Hash() + |
| 3616 NameDictionary::GetProbeOffset(i)))); | 3616 NameDictionary::GetProbeOffset(i)))); |
| 3617 | 3617 |
| 3618 // Scale the index by multiplying by the entry size. | 3618 // Scale the index by multiplying by the entry size. |
| 3619 DCHECK(NameDictionary::kEntrySize == 3); | 3619 STATIC_ASSERT(NameDictionary::kEntrySize == 3); |
| 3620 __ lea(index, Operand(index, index, times_2, 0)); // index *= 3. | 3620 __ lea(index, Operand(index, index, times_2, 0)); // index *= 3. |
| 3621 Register entity_name = r0; | 3621 Register entity_name = r0; |
| 3622 // Having undefined at this place means the name is not contained. | 3622 // Having undefined at this place means the name is not contained. |
| 3623 DCHECK_EQ(kSmiTagSize, 1); | 3623 STATIC_ASSERT(kSmiTagSize == 1); |
| 3624 __ mov(entity_name, Operand(properties, index, times_half_pointer_size, | 3624 __ mov(entity_name, Operand(properties, index, times_half_pointer_size, |
| 3625 kElementsStartOffset - kHeapObjectTag)); | 3625 kElementsStartOffset - kHeapObjectTag)); |
| 3626 __ cmp(entity_name, masm->isolate()->factory()->undefined_value()); | 3626 __ cmp(entity_name, masm->isolate()->factory()->undefined_value()); |
| 3627 __ j(equal, done); | 3627 __ j(equal, done); |
| 3628 | 3628 |
| 3629 // Stop if found the property. | 3629 // Stop if found the property. |
| 3630 __ cmp(entity_name, Handle<Name>(name)); | 3630 __ cmp(entity_name, Handle<Name>(name)); |
| 3631 __ j(equal, miss); | 3631 __ j(equal, miss); |
| 3632 | 3632 |
| 3633 Label good; | 3633 Label good; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3681 for (int i = 0; i < kInlinedProbes; i++) { | 3681 for (int i = 0; i < kInlinedProbes; i++) { |
| 3682 // Compute the masked index: (hash + i + i * i) & mask. | 3682 // Compute the masked index: (hash + i + i * i) & mask. |
| 3683 __ mov(r0, FieldOperand(name, Name::kHashFieldOffset)); | 3683 __ mov(r0, FieldOperand(name, Name::kHashFieldOffset)); |
| 3684 __ shr(r0, Name::kHashShift); | 3684 __ shr(r0, Name::kHashShift); |
| 3685 if (i > 0) { | 3685 if (i > 0) { |
| 3686 __ add(r0, Immediate(NameDictionary::GetProbeOffset(i))); | 3686 __ add(r0, Immediate(NameDictionary::GetProbeOffset(i))); |
| 3687 } | 3687 } |
| 3688 __ and_(r0, r1); | 3688 __ and_(r0, r1); |
| 3689 | 3689 |
| 3690 // Scale the index by multiplying by the entry size. | 3690 // Scale the index by multiplying by the entry size. |
| 3691 DCHECK(NameDictionary::kEntrySize == 3); | 3691 STATIC_ASSERT(NameDictionary::kEntrySize == 3); |
| 3692 __ lea(r0, Operand(r0, r0, times_2, 0)); // r0 = r0 * 3 | 3692 __ lea(r0, Operand(r0, r0, times_2, 0)); // r0 = r0 * 3 |
| 3693 | 3693 |
| 3694 // Check if the key is identical to the name. | 3694 // Check if the key is identical to the name. |
| 3695 __ cmp(name, Operand(elements, | 3695 __ cmp(name, Operand(elements, |
| 3696 r0, | 3696 r0, |
| 3697 times_4, | 3697 times_4, |
| 3698 kElementsStartOffset - kHeapObjectTag)); | 3698 kElementsStartOffset - kHeapObjectTag)); |
| 3699 __ j(equal, done); | 3699 __ j(equal, done); |
| 3700 } | 3700 } |
| 3701 | 3701 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3744 // (their names are the null value). | 3744 // (their names are the null value). |
| 3745 for (int i = kInlinedProbes; i < kTotalProbes; i++) { | 3745 for (int i = kInlinedProbes; i < kTotalProbes; i++) { |
| 3746 // Compute the masked index: (hash + i + i * i) & mask. | 3746 // Compute the masked index: (hash + i + i * i) & mask. |
| 3747 __ mov(scratch, Operand(esp, 2 * kPointerSize)); | 3747 __ mov(scratch, Operand(esp, 2 * kPointerSize)); |
| 3748 if (i > 0) { | 3748 if (i > 0) { |
| 3749 __ add(scratch, Immediate(NameDictionary::GetProbeOffset(i))); | 3749 __ add(scratch, Immediate(NameDictionary::GetProbeOffset(i))); |
| 3750 } | 3750 } |
| 3751 __ and_(scratch, Operand(esp, 0)); | 3751 __ and_(scratch, Operand(esp, 0)); |
| 3752 | 3752 |
| 3753 // Scale the index by multiplying by the entry size. | 3753 // Scale the index by multiplying by the entry size. |
| 3754 DCHECK(NameDictionary::kEntrySize == 3); | 3754 STATIC_ASSERT(NameDictionary::kEntrySize == 3); |
| 3755 __ lea(index(), Operand(scratch, scratch, times_2, 0)); // index *= 3. | 3755 __ lea(index(), Operand(scratch, scratch, times_2, 0)); // index *= 3. |
| 3756 | 3756 |
| 3757 // Having undefined at this place means the name is not contained. | 3757 // Having undefined at this place means the name is not contained. |
| 3758 DCHECK_EQ(kSmiTagSize, 1); | 3758 STATIC_ASSERT(kSmiTagSize == 1); |
| 3759 __ mov(scratch, Operand(dictionary(), index(), times_pointer_size, | 3759 __ mov(scratch, Operand(dictionary(), index(), times_pointer_size, |
| 3760 kElementsStartOffset - kHeapObjectTag)); | 3760 kElementsStartOffset - kHeapObjectTag)); |
| 3761 __ cmp(scratch, isolate()->factory()->undefined_value()); | 3761 __ cmp(scratch, isolate()->factory()->undefined_value()); |
| 3762 __ j(equal, ¬_in_dictionary); | 3762 __ j(equal, ¬_in_dictionary); |
| 3763 | 3763 |
| 3764 // Stop if found the property. | 3764 // Stop if found the property. |
| 3765 __ cmp(scratch, Operand(esp, 3 * kPointerSize)); | 3765 __ cmp(scratch, Operand(esp, 3 * kPointerSize)); |
| 3766 __ j(equal, &in_dictionary); | 3766 __ j(equal, &in_dictionary); |
| 3767 | 3767 |
| 3768 if (i != kTotalProbes - 1 && mode() == NEGATIVE_LOOKUP) { | 3768 if (i != kTotalProbes - 1 && mode() == NEGATIVE_LOOKUP) { |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4457 static void CreateArrayDispatchOneArgument(MacroAssembler* masm, | 4457 static void CreateArrayDispatchOneArgument(MacroAssembler* masm, |
| 4458 AllocationSiteOverrideMode mode) { | 4458 AllocationSiteOverrideMode mode) { |
| 4459 // ebx - allocation site (if mode != DISABLE_ALLOCATION_SITES) | 4459 // ebx - allocation site (if mode != DISABLE_ALLOCATION_SITES) |
| 4460 // edx - kind (if mode != DISABLE_ALLOCATION_SITES) | 4460 // edx - kind (if mode != DISABLE_ALLOCATION_SITES) |
| 4461 // eax - number of arguments | 4461 // eax - number of arguments |
| 4462 // edi - constructor? | 4462 // edi - constructor? |
| 4463 // esp[0] - return address | 4463 // esp[0] - return address |
| 4464 // esp[4] - last argument | 4464 // esp[4] - last argument |
| 4465 Label normal_sequence; | 4465 Label normal_sequence; |
| 4466 if (mode == DONT_OVERRIDE) { | 4466 if (mode == DONT_OVERRIDE) { |
| 4467 DCHECK(FAST_SMI_ELEMENTS == 0); | 4467 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
| 4468 DCHECK(FAST_HOLEY_SMI_ELEMENTS == 1); | 4468 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
| 4469 DCHECK(FAST_ELEMENTS == 2); | 4469 STATIC_ASSERT(FAST_ELEMENTS == 2); |
| 4470 DCHECK(FAST_HOLEY_ELEMENTS == 3); | 4470 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); |
| 4471 DCHECK(FAST_DOUBLE_ELEMENTS == 4); | 4471 STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4); |
| 4472 DCHECK(FAST_HOLEY_DOUBLE_ELEMENTS == 5); | 4472 STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5); |
| 4473 | 4473 |
| 4474 // is the low bit set? If so, we are holey and that is good. | 4474 // is the low bit set? If so, we are holey and that is good. |
| 4475 __ test_b(edx, 1); | 4475 __ test_b(edx, 1); |
| 4476 __ j(not_zero, &normal_sequence); | 4476 __ j(not_zero, &normal_sequence); |
| 4477 } | 4477 } |
| 4478 | 4478 |
| 4479 // look at the first argument | 4479 // look at the first argument |
| 4480 __ mov(ecx, Operand(esp, kPointerSize)); | 4480 __ mov(ecx, Operand(esp, kPointerSize)); |
| 4481 __ test(ecx, ecx); | 4481 __ test(ecx, ecx); |
| 4482 __ j(zero, &normal_sequence); | 4482 __ j(zero, &normal_sequence); |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5145 Operand(ebp, 7 * kPointerSize), NULL); | 5145 Operand(ebp, 7 * kPointerSize), NULL); |
| 5146 } | 5146 } |
| 5147 | 5147 |
| 5148 | 5148 |
| 5149 #undef __ | 5149 #undef __ |
| 5150 | 5150 |
| 5151 } // namespace internal | 5151 } // namespace internal |
| 5152 } // namespace v8 | 5152 } // namespace v8 |
| 5153 | 5153 |
| 5154 #endif // V8_TARGET_ARCH_X87 | 5154 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |