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

Side by Side Diff: src/mips/code-stubs-mips.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/ia32/code-stubs-ia32.cc ('k') | src/mips64/code-stubs-mips64.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_MIPS 7 #if V8_TARGET_ARCH_MIPS
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 4071 matching lines...) Expand 10 before | Expand all | Expand 10 after
4082 __ And(index, index, Operand( 4082 __ And(index, index, Operand(
4083 Smi::FromInt(name->Hash() + NameDictionary::GetProbeOffset(i)))); 4083 Smi::FromInt(name->Hash() + NameDictionary::GetProbeOffset(i))));
4084 4084
4085 // Scale the index by multiplying by the entry size. 4085 // Scale the index by multiplying by the entry size.
4086 STATIC_ASSERT(NameDictionary::kEntrySize == 3); 4086 STATIC_ASSERT(NameDictionary::kEntrySize == 3);
4087 __ sll(at, index, 1); 4087 __ sll(at, index, 1);
4088 __ Addu(index, index, at); 4088 __ Addu(index, index, at);
4089 4089
4090 Register entity_name = scratch0; 4090 Register entity_name = scratch0;
4091 // Having undefined at this place means the name is not contained. 4091 // Having undefined at this place means the name is not contained.
4092 DCHECK_EQ(kSmiTagSize, 1); 4092 STATIC_ASSERT(kSmiTagSize == 1);
4093 Register tmp = properties; 4093 Register tmp = properties;
4094 __ sll(scratch0, index, 1); 4094 __ sll(scratch0, index, 1);
4095 __ Addu(tmp, properties, scratch0); 4095 __ Addu(tmp, properties, scratch0);
4096 __ lw(entity_name, FieldMemOperand(tmp, kElementsStartOffset)); 4096 __ lw(entity_name, FieldMemOperand(tmp, kElementsStartOffset));
4097 4097
4098 DCHECK(!tmp.is(entity_name)); 4098 DCHECK(!tmp.is(entity_name));
4099 __ LoadRoot(tmp, Heap::kUndefinedValueRootIndex); 4099 __ LoadRoot(tmp, Heap::kUndefinedValueRootIndex);
4100 __ Branch(done, eq, entity_name, Operand(tmp)); 4100 __ Branch(done, eq, entity_name, Operand(tmp));
4101 4101
4102 // Load the hole ready for use below: 4102 // Load the hole ready for use below:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
4172 // shifted in the following and instruction. 4172 // shifted in the following and instruction.
4173 DCHECK(NameDictionary::GetProbeOffset(i) < 4173 DCHECK(NameDictionary::GetProbeOffset(i) <
4174 1 << (32 - Name::kHashFieldOffset)); 4174 1 << (32 - Name::kHashFieldOffset));
4175 __ Addu(scratch2, scratch2, Operand( 4175 __ Addu(scratch2, scratch2, Operand(
4176 NameDictionary::GetProbeOffset(i) << Name::kHashShift)); 4176 NameDictionary::GetProbeOffset(i) << Name::kHashShift));
4177 } 4177 }
4178 __ srl(scratch2, scratch2, Name::kHashShift); 4178 __ srl(scratch2, scratch2, Name::kHashShift);
4179 __ And(scratch2, scratch1, scratch2); 4179 __ And(scratch2, scratch1, scratch2);
4180 4180
4181 // Scale the index by multiplying by the element size. 4181 // Scale the index by multiplying by the element size.
4182 DCHECK(NameDictionary::kEntrySize == 3); 4182 STATIC_ASSERT(NameDictionary::kEntrySize == 3);
4183 // scratch2 = scratch2 * 3. 4183 // scratch2 = scratch2 * 3.
4184 4184
4185 __ sll(at, scratch2, 1); 4185 __ sll(at, scratch2, 1);
4186 __ Addu(scratch2, scratch2, at); 4186 __ Addu(scratch2, scratch2, at);
4187 4187
4188 // Check if the key is identical to the name. 4188 // Check if the key is identical to the name.
4189 __ sll(at, scratch2, 2); 4189 __ sll(at, scratch2, 2);
4190 __ Addu(scratch2, elements, at); 4190 __ Addu(scratch2, elements, at);
4191 __ lw(at, FieldMemOperand(scratch2, kElementsStartOffset)); 4191 __ lw(at, FieldMemOperand(scratch2, kElementsStartOffset));
4192 __ Branch(done, eq, name, Operand(at)); 4192 __ Branch(done, eq, name, Operand(at));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
4259 1 << (32 - Name::kHashFieldOffset)); 4259 1 << (32 - Name::kHashFieldOffset));
4260 __ Addu(index, hash, Operand( 4260 __ Addu(index, hash, Operand(
4261 NameDictionary::GetProbeOffset(i) << Name::kHashShift)); 4261 NameDictionary::GetProbeOffset(i) << Name::kHashShift));
4262 } else { 4262 } else {
4263 __ mov(index, hash); 4263 __ mov(index, hash);
4264 } 4264 }
4265 __ srl(index, index, Name::kHashShift); 4265 __ srl(index, index, Name::kHashShift);
4266 __ And(index, mask, index); 4266 __ And(index, mask, index);
4267 4267
4268 // Scale the index by multiplying by the entry size. 4268 // Scale the index by multiplying by the entry size.
4269 DCHECK(NameDictionary::kEntrySize == 3); 4269 STATIC_ASSERT(NameDictionary::kEntrySize == 3);
4270 // index *= 3. 4270 // index *= 3.
4271 __ mov(at, index); 4271 __ mov(at, index);
4272 __ sll(index, index, 1); 4272 __ sll(index, index, 1);
4273 __ Addu(index, index, at); 4273 __ Addu(index, index, at);
4274 4274
4275 4275
4276 DCHECK_EQ(kSmiTagSize, 1); 4276 STATIC_ASSERT(kSmiTagSize == 1);
4277 __ sll(index, index, 2); 4277 __ sll(index, index, 2);
4278 __ Addu(index, index, dictionary); 4278 __ Addu(index, index, dictionary);
4279 __ lw(entry_key, FieldMemOperand(index, kElementsStartOffset)); 4279 __ lw(entry_key, FieldMemOperand(index, kElementsStartOffset));
4280 4280
4281 // Having undefined at this place means the name is not contained. 4281 // Having undefined at this place means the name is not contained.
4282 __ Branch(&not_in_dictionary, eq, entry_key, Operand(undefined)); 4282 __ Branch(&not_in_dictionary, eq, entry_key, Operand(undefined));
4283 4283
4284 // Stop if found the property. 4284 // Stop if found the property.
4285 __ Branch(&in_dictionary, eq, entry_key, Operand(key)); 4285 __ Branch(&in_dictionary, eq, entry_key, Operand(key));
4286 4286
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
4990 4990
4991 static void CreateArrayDispatchOneArgument(MacroAssembler* masm, 4991 static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
4992 AllocationSiteOverrideMode mode) { 4992 AllocationSiteOverrideMode mode) {
4993 // a2 - allocation site (if mode != DISABLE_ALLOCATION_SITES) 4993 // a2 - allocation site (if mode != DISABLE_ALLOCATION_SITES)
4994 // a3 - kind (if mode != DISABLE_ALLOCATION_SITES) 4994 // a3 - kind (if mode != DISABLE_ALLOCATION_SITES)
4995 // a0 - number of arguments 4995 // a0 - number of arguments
4996 // a1 - constructor? 4996 // a1 - constructor?
4997 // sp[0] - last argument 4997 // sp[0] - last argument
4998 Label normal_sequence; 4998 Label normal_sequence;
4999 if (mode == DONT_OVERRIDE) { 4999 if (mode == DONT_OVERRIDE) {
5000 DCHECK(FAST_SMI_ELEMENTS == 0); 5000 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
5001 DCHECK(FAST_HOLEY_SMI_ELEMENTS == 1); 5001 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
5002 DCHECK(FAST_ELEMENTS == 2); 5002 STATIC_ASSERT(FAST_ELEMENTS == 2);
5003 DCHECK(FAST_HOLEY_ELEMENTS == 3); 5003 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
5004 DCHECK(FAST_DOUBLE_ELEMENTS == 4); 5004 STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
5005 DCHECK(FAST_HOLEY_DOUBLE_ELEMENTS == 5); 5005 STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
5006 5006
5007 // is the low bit set? If so, we are holey and that is good. 5007 // is the low bit set? If so, we are holey and that is good.
5008 __ And(at, a3, Operand(1)); 5008 __ And(at, a3, Operand(1));
5009 __ Branch(&normal_sequence, ne, at, Operand(zero_reg)); 5009 __ Branch(&normal_sequence, ne, at, Operand(zero_reg));
5010 } 5010 }
5011 5011
5012 // look at the first argument 5012 // look at the first argument
5013 __ lw(t1, MemOperand(sp, 0)); 5013 __ lw(t1, MemOperand(sp, 0));
5014 __ Branch(&normal_sequence, eq, t1, Operand(zero_reg)); 5014 __ Branch(&normal_sequence, eq, t1, Operand(zero_reg));
5015 5015
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
5577 MemOperand(fp, 6 * kPointerSize), NULL); 5577 MemOperand(fp, 6 * kPointerSize), NULL);
5578 } 5578 }
5579 5579
5580 5580
5581 #undef __ 5581 #undef __
5582 5582
5583 } // namespace internal 5583 } // namespace internal
5584 } // namespace v8 5584 } // namespace v8
5585 5585
5586 #endif // V8_TARGET_ARCH_MIPS 5586 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698