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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 1251593009: convert a bunch of DCHECKs to STATIC_ASSERT (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add missing include Created 5 years, 5 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/elements-kind.h ('k') | src/mips/code-stubs-mips.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 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_IA32 7 #if V8_TARGET_ARCH_IA32
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 3955 matching lines...) Expand 10 before | Expand all | Expand 10 after
3966 // Compute the masked index: (hash + i + i * i) & mask. 3966 // Compute the masked index: (hash + i + i * i) & mask.
3967 Register index = r0; 3967 Register index = r0;
3968 // Capacity is smi 2^n. 3968 // Capacity is smi 2^n.
3969 __ mov(index, FieldOperand(properties, kCapacityOffset)); 3969 __ mov(index, FieldOperand(properties, kCapacityOffset));
3970 __ dec(index); 3970 __ dec(index);
3971 __ and_(index, 3971 __ and_(index,
3972 Immediate(Smi::FromInt(name->Hash() + 3972 Immediate(Smi::FromInt(name->Hash() +
3973 NameDictionary::GetProbeOffset(i)))); 3973 NameDictionary::GetProbeOffset(i))));
3974 3974
3975 // Scale the index by multiplying by the entry size. 3975 // Scale the index by multiplying by the entry size.
3976 DCHECK(NameDictionary::kEntrySize == 3); 3976 STATIC_ASSERT(NameDictionary::kEntrySize == 3);
3977 __ lea(index, Operand(index, index, times_2, 0)); // index *= 3. 3977 __ lea(index, Operand(index, index, times_2, 0)); // index *= 3.
3978 Register entity_name = r0; 3978 Register entity_name = r0;
3979 // Having undefined at this place means the name is not contained. 3979 // Having undefined at this place means the name is not contained.
3980 DCHECK_EQ(kSmiTagSize, 1); 3980 STATIC_ASSERT(kSmiTagSize == 1);
3981 __ mov(entity_name, Operand(properties, index, times_half_pointer_size, 3981 __ mov(entity_name, Operand(properties, index, times_half_pointer_size,
3982 kElementsStartOffset - kHeapObjectTag)); 3982 kElementsStartOffset - kHeapObjectTag));
3983 __ cmp(entity_name, masm->isolate()->factory()->undefined_value()); 3983 __ cmp(entity_name, masm->isolate()->factory()->undefined_value());
3984 __ j(equal, done); 3984 __ j(equal, done);
3985 3985
3986 // Stop if found the property. 3986 // Stop if found the property.
3987 __ cmp(entity_name, Handle<Name>(name)); 3987 __ cmp(entity_name, Handle<Name>(name));
3988 __ j(equal, miss); 3988 __ j(equal, miss);
3989 3989
3990 Label good; 3990 Label good;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
4038 for (int i = 0; i < kInlinedProbes; i++) { 4038 for (int i = 0; i < kInlinedProbes; i++) {
4039 // Compute the masked index: (hash + i + i * i) & mask. 4039 // Compute the masked index: (hash + i + i * i) & mask.
4040 __ mov(r0, FieldOperand(name, Name::kHashFieldOffset)); 4040 __ mov(r0, FieldOperand(name, Name::kHashFieldOffset));
4041 __ shr(r0, Name::kHashShift); 4041 __ shr(r0, Name::kHashShift);
4042 if (i > 0) { 4042 if (i > 0) {
4043 __ add(r0, Immediate(NameDictionary::GetProbeOffset(i))); 4043 __ add(r0, Immediate(NameDictionary::GetProbeOffset(i)));
4044 } 4044 }
4045 __ and_(r0, r1); 4045 __ and_(r0, r1);
4046 4046
4047 // Scale the index by multiplying by the entry size. 4047 // Scale the index by multiplying by the entry size.
4048 DCHECK(NameDictionary::kEntrySize == 3); 4048 STATIC_ASSERT(NameDictionary::kEntrySize == 3);
4049 __ lea(r0, Operand(r0, r0, times_2, 0)); // r0 = r0 * 3 4049 __ lea(r0, Operand(r0, r0, times_2, 0)); // r0 = r0 * 3
4050 4050
4051 // Check if the key is identical to the name. 4051 // Check if the key is identical to the name.
4052 __ cmp(name, Operand(elements, 4052 __ cmp(name, Operand(elements,
4053 r0, 4053 r0,
4054 times_4, 4054 times_4,
4055 kElementsStartOffset - kHeapObjectTag)); 4055 kElementsStartOffset - kHeapObjectTag));
4056 __ j(equal, done); 4056 __ j(equal, done);
4057 } 4057 }
4058 4058
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 // (their names are the null value). 4101 // (their names are the null value).
4102 for (int i = kInlinedProbes; i < kTotalProbes; i++) { 4102 for (int i = kInlinedProbes; i < kTotalProbes; i++) {
4103 // Compute the masked index: (hash + i + i * i) & mask. 4103 // Compute the masked index: (hash + i + i * i) & mask.
4104 __ mov(scratch, Operand(esp, 2 * kPointerSize)); 4104 __ mov(scratch, Operand(esp, 2 * kPointerSize));
4105 if (i > 0) { 4105 if (i > 0) {
4106 __ add(scratch, Immediate(NameDictionary::GetProbeOffset(i))); 4106 __ add(scratch, Immediate(NameDictionary::GetProbeOffset(i)));
4107 } 4107 }
4108 __ and_(scratch, Operand(esp, 0)); 4108 __ and_(scratch, Operand(esp, 0));
4109 4109
4110 // Scale the index by multiplying by the entry size. 4110 // Scale the index by multiplying by the entry size.
4111 DCHECK(NameDictionary::kEntrySize == 3); 4111 STATIC_ASSERT(NameDictionary::kEntrySize == 3);
4112 __ lea(index(), Operand(scratch, scratch, times_2, 0)); // index *= 3. 4112 __ lea(index(), Operand(scratch, scratch, times_2, 0)); // index *= 3.
4113 4113
4114 // Having undefined at this place means the name is not contained. 4114 // Having undefined at this place means the name is not contained.
4115 DCHECK_EQ(kSmiTagSize, 1); 4115 STATIC_ASSERT(kSmiTagSize == 1);
4116 __ mov(scratch, Operand(dictionary(), index(), times_pointer_size, 4116 __ mov(scratch, Operand(dictionary(), index(), times_pointer_size,
4117 kElementsStartOffset - kHeapObjectTag)); 4117 kElementsStartOffset - kHeapObjectTag));
4118 __ cmp(scratch, isolate()->factory()->undefined_value()); 4118 __ cmp(scratch, isolate()->factory()->undefined_value());
4119 __ j(equal, &not_in_dictionary); 4119 __ j(equal, &not_in_dictionary);
4120 4120
4121 // Stop if found the property. 4121 // Stop if found the property.
4122 __ cmp(scratch, Operand(esp, 3 * kPointerSize)); 4122 __ cmp(scratch, Operand(esp, 3 * kPointerSize));
4123 __ j(equal, &in_dictionary); 4123 __ j(equal, &in_dictionary);
4124 4124
4125 if (i != kTotalProbes - 1 && mode() == NEGATIVE_LOOKUP) { 4125 if (i != kTotalProbes - 1 && mode() == NEGATIVE_LOOKUP) {
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
4816 static void CreateArrayDispatchOneArgument(MacroAssembler* masm, 4816 static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
4817 AllocationSiteOverrideMode mode) { 4817 AllocationSiteOverrideMode mode) {
4818 // ebx - allocation site (if mode != DISABLE_ALLOCATION_SITES) 4818 // ebx - allocation site (if mode != DISABLE_ALLOCATION_SITES)
4819 // edx - kind (if mode != DISABLE_ALLOCATION_SITES) 4819 // edx - kind (if mode != DISABLE_ALLOCATION_SITES)
4820 // eax - number of arguments 4820 // eax - number of arguments
4821 // edi - constructor? 4821 // edi - constructor?
4822 // esp[0] - return address 4822 // esp[0] - return address
4823 // esp[4] - last argument 4823 // esp[4] - last argument
4824 Label normal_sequence; 4824 Label normal_sequence;
4825 if (mode == DONT_OVERRIDE) { 4825 if (mode == DONT_OVERRIDE) {
4826 DCHECK(FAST_SMI_ELEMENTS == 0); 4826 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
4827 DCHECK(FAST_HOLEY_SMI_ELEMENTS == 1); 4827 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
4828 DCHECK(FAST_ELEMENTS == 2); 4828 STATIC_ASSERT(FAST_ELEMENTS == 2);
4829 DCHECK(FAST_HOLEY_ELEMENTS == 3); 4829 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
4830 DCHECK(FAST_DOUBLE_ELEMENTS == 4); 4830 STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
4831 DCHECK(FAST_HOLEY_DOUBLE_ELEMENTS == 5); 4831 STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
4832 4832
4833 // is the low bit set? If so, we are holey and that is good. 4833 // is the low bit set? If so, we are holey and that is good.
4834 __ test_b(edx, 1); 4834 __ test_b(edx, 1);
4835 __ j(not_zero, &normal_sequence); 4835 __ j(not_zero, &normal_sequence);
4836 } 4836 }
4837 4837
4838 // look at the first argument 4838 // look at the first argument
4839 __ mov(ecx, Operand(esp, kPointerSize)); 4839 __ mov(ecx, Operand(esp, kPointerSize));
4840 __ test(ecx, ecx); 4840 __ test(ecx, ecx);
4841 __ j(zero, &normal_sequence); 4841 __ j(zero, &normal_sequence);
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
5504 Operand(ebp, 7 * kPointerSize), NULL); 5504 Operand(ebp, 7 * kPointerSize), NULL);
5505 } 5505 }
5506 5506
5507 5507
5508 #undef __ 5508 #undef __
5509 5509
5510 } // namespace internal 5510 } // namespace internal
5511 } // namespace v8 5511 } // namespace v8
5512 5512
5513 #endif // V8_TARGET_ARCH_IA32 5513 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/elements-kind.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698