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

Side by Side Diff: src/arm/code-stubs-arm.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, 4 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 | « no previous file | src/arm64/code-stubs-arm64.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_ARM 7 #if V8_TARGET_ARCH_ARM
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 3877 matching lines...) Expand 10 before | Expand all | Expand 10 after
3888 __ sub(index, index, Operand(1)); 3888 __ sub(index, index, Operand(1));
3889 __ and_(index, index, Operand( 3889 __ and_(index, index, Operand(
3890 Smi::FromInt(name->Hash() + NameDictionary::GetProbeOffset(i)))); 3890 Smi::FromInt(name->Hash() + NameDictionary::GetProbeOffset(i))));
3891 3891
3892 // Scale the index by multiplying by the entry size. 3892 // Scale the index by multiplying by the entry size.
3893 STATIC_ASSERT(NameDictionary::kEntrySize == 3); 3893 STATIC_ASSERT(NameDictionary::kEntrySize == 3);
3894 __ add(index, index, Operand(index, LSL, 1)); // index *= 3. 3894 __ add(index, index, Operand(index, LSL, 1)); // index *= 3.
3895 3895
3896 Register entity_name = scratch0; 3896 Register entity_name = scratch0;
3897 // Having undefined at this place means the name is not contained. 3897 // Having undefined at this place means the name is not contained.
3898 DCHECK_EQ(kSmiTagSize, 1); 3898 STATIC_ASSERT(kSmiTagSize == 1);
3899 Register tmp = properties; 3899 Register tmp = properties;
3900 __ add(tmp, properties, Operand(index, LSL, 1)); 3900 __ add(tmp, properties, Operand(index, LSL, 1));
3901 __ ldr(entity_name, FieldMemOperand(tmp, kElementsStartOffset)); 3901 __ ldr(entity_name, FieldMemOperand(tmp, kElementsStartOffset));
3902 3902
3903 DCHECK(!tmp.is(entity_name)); 3903 DCHECK(!tmp.is(entity_name));
3904 __ LoadRoot(tmp, Heap::kUndefinedValueRootIndex); 3904 __ LoadRoot(tmp, Heap::kUndefinedValueRootIndex);
3905 __ cmp(entity_name, tmp); 3905 __ cmp(entity_name, tmp);
3906 __ b(eq, done); 3906 __ b(eq, done);
3907 3907
3908 // Load the hole ready for use below: 3908 // Load the hole ready for use below:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
3978 // Add the probe offset (i + i * i) left shifted to avoid right shifting 3978 // Add the probe offset (i + i * i) left shifted to avoid right shifting
3979 // the hash in a separate instruction. The value hash + i + i * i is right 3979 // the hash in a separate instruction. The value hash + i + i * i is right
3980 // shifted in the following and instruction. 3980 // shifted in the following and instruction.
3981 DCHECK(NameDictionary::GetProbeOffset(i) < 3981 DCHECK(NameDictionary::GetProbeOffset(i) <
3982 1 << (32 - Name::kHashFieldOffset)); 3982 1 << (32 - Name::kHashFieldOffset));
3983 __ add(scratch2, scratch2, Operand( 3983 __ add(scratch2, scratch2, Operand(
3984 NameDictionary::GetProbeOffset(i) << Name::kHashShift)); 3984 NameDictionary::GetProbeOffset(i) << Name::kHashShift));
3985 } 3985 }
3986 __ and_(scratch2, scratch1, Operand(scratch2, LSR, Name::kHashShift)); 3986 __ and_(scratch2, scratch1, Operand(scratch2, LSR, Name::kHashShift));
3987 3987
3988 // Scale the index by multiplying by the element size. 3988 // Scale the index by multiplying by the entry size.
3989 DCHECK(NameDictionary::kEntrySize == 3); 3989 STATIC_ASSERT(NameDictionary::kEntrySize == 3);
3990 // scratch2 = scratch2 * 3. 3990 // scratch2 = scratch2 * 3.
3991 __ add(scratch2, scratch2, Operand(scratch2, LSL, 1)); 3991 __ add(scratch2, scratch2, Operand(scratch2, LSL, 1));
3992 3992
3993 // Check if the key is identical to the name. 3993 // Check if the key is identical to the name.
3994 __ add(scratch2, elements, Operand(scratch2, LSL, 2)); 3994 __ add(scratch2, elements, Operand(scratch2, LSL, 2));
3995 __ ldr(ip, FieldMemOperand(scratch2, kElementsStartOffset)); 3995 __ ldr(ip, FieldMemOperand(scratch2, kElementsStartOffset));
3996 __ cmp(name, Operand(ip)); 3996 __ cmp(name, Operand(ip));
3997 __ b(eq, done); 3997 __ b(eq, done);
3998 } 3998 }
3999 3999
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
4063 DCHECK(NameDictionary::GetProbeOffset(i) < 4063 DCHECK(NameDictionary::GetProbeOffset(i) <
4064 1 << (32 - Name::kHashFieldOffset)); 4064 1 << (32 - Name::kHashFieldOffset));
4065 __ add(index, hash, Operand( 4065 __ add(index, hash, Operand(
4066 NameDictionary::GetProbeOffset(i) << Name::kHashShift)); 4066 NameDictionary::GetProbeOffset(i) << Name::kHashShift));
4067 } else { 4067 } else {
4068 __ mov(index, Operand(hash)); 4068 __ mov(index, Operand(hash));
4069 } 4069 }
4070 __ and_(index, mask, Operand(index, LSR, Name::kHashShift)); 4070 __ and_(index, mask, Operand(index, LSR, Name::kHashShift));
4071 4071
4072 // Scale the index by multiplying by the entry size. 4072 // Scale the index by multiplying by the entry size.
4073 DCHECK(NameDictionary::kEntrySize == 3); 4073 STATIC_ASSERT(NameDictionary::kEntrySize == 3);
4074 __ add(index, index, Operand(index, LSL, 1)); // index *= 3. 4074 __ add(index, index, Operand(index, LSL, 1)); // index *= 3.
4075 4075
4076 DCHECK_EQ(kSmiTagSize, 1); 4076 STATIC_ASSERT(kSmiTagSize == 1);
4077 __ add(index, dictionary, Operand(index, LSL, 2)); 4077 __ add(index, dictionary, Operand(index, LSL, 2));
4078 __ ldr(entry_key, FieldMemOperand(index, kElementsStartOffset)); 4078 __ ldr(entry_key, FieldMemOperand(index, kElementsStartOffset));
4079 4079
4080 // Having undefined at this place means the name is not contained. 4080 // Having undefined at this place means the name is not contained.
4081 __ cmp(entry_key, Operand(undefined)); 4081 __ cmp(entry_key, Operand(undefined));
4082 __ b(eq, &not_in_dictionary); 4082 __ b(eq, &not_in_dictionary);
4083 4083
4084 // Stop if found the property. 4084 // Stop if found the property.
4085 __ cmp(entry_key, Operand(key)); 4085 __ cmp(entry_key, Operand(key));
4086 __ b(eq, &in_dictionary); 4086 __ b(eq, &in_dictionary);
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
4778 4778
4779 static void CreateArrayDispatchOneArgument(MacroAssembler* masm, 4779 static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
4780 AllocationSiteOverrideMode mode) { 4780 AllocationSiteOverrideMode mode) {
4781 // r2 - allocation site (if mode != DISABLE_ALLOCATION_SITES) 4781 // r2 - allocation site (if mode != DISABLE_ALLOCATION_SITES)
4782 // r3 - kind (if mode != DISABLE_ALLOCATION_SITES) 4782 // r3 - kind (if mode != DISABLE_ALLOCATION_SITES)
4783 // r0 - number of arguments 4783 // r0 - number of arguments
4784 // r1 - constructor? 4784 // r1 - constructor?
4785 // sp[0] - last argument 4785 // sp[0] - last argument
4786 Label normal_sequence; 4786 Label normal_sequence;
4787 if (mode == DONT_OVERRIDE) { 4787 if (mode == DONT_OVERRIDE) {
4788 DCHECK(FAST_SMI_ELEMENTS == 0); 4788 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
4789 DCHECK(FAST_HOLEY_SMI_ELEMENTS == 1); 4789 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
4790 DCHECK(FAST_ELEMENTS == 2); 4790 STATIC_ASSERT(FAST_ELEMENTS == 2);
4791 DCHECK(FAST_HOLEY_ELEMENTS == 3); 4791 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
4792 DCHECK(FAST_DOUBLE_ELEMENTS == 4); 4792 STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
4793 DCHECK(FAST_HOLEY_DOUBLE_ELEMENTS == 5); 4793 STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
4794 4794
4795 // is the low bit set? If so, we are holey and that is good. 4795 // is the low bit set? If so, we are holey and that is good.
4796 __ tst(r3, Operand(1)); 4796 __ tst(r3, Operand(1));
4797 __ b(ne, &normal_sequence); 4797 __ b(ne, &normal_sequence);
4798 } 4798 }
4799 4799
4800 // look at the first argument 4800 // look at the first argument
4801 __ ldr(r5, MemOperand(sp, 0)); 4801 __ ldr(r5, MemOperand(sp, 0));
4802 __ cmp(r5, Operand::Zero()); 4802 __ cmp(r5, Operand::Zero());
4803 __ b(eq, &normal_sequence); 4803 __ b(eq, &normal_sequence);
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
5379 MemOperand(fp, 6 * kPointerSize), NULL); 5379 MemOperand(fp, 6 * kPointerSize), NULL);
5380 } 5380 }
5381 5381
5382 5382
5383 #undef __ 5383 #undef __
5384 5384
5385 } // namespace internal 5385 } // namespace internal
5386 } // namespace v8 5386 } // namespace v8
5387 5387
5388 #endif // V8_TARGET_ARCH_ARM 5388 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698