Commit ff544419 authored by mostynb's avatar mostynb Committed by Commit bot

convert a bunch of DCHECKs to STATIC_ASSERT

Review URL: https://codereview.chromium.org/1251593009

Cr-Commit-Position: refs/heads/master@{#29825}
parent dfd81151
......@@ -3888,7 +3888,7 @@ void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
Register entity_name = scratch0;
// Having undefined at this place means the name is not contained.
DCHECK_EQ(kSmiTagSize, 1);
STATIC_ASSERT(kSmiTagSize == 1);
Register tmp = properties;
__ add(tmp, properties, Operand(index, LSL, 1));
__ ldr(entity_name, FieldMemOperand(tmp, kElementsStartOffset));
......@@ -3978,8 +3978,8 @@ void NameDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
}
__ and_(scratch2, scratch1, Operand(scratch2, LSR, Name::kHashShift));
// Scale the index by multiplying by the element size.
DCHECK(NameDictionary::kEntrySize == 3);
// Scale the index by multiplying by the entry size.
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
// scratch2 = scratch2 * 3.
__ add(scratch2, scratch2, Operand(scratch2, LSL, 1));
......@@ -4063,10 +4063,10 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ and_(index, mask, Operand(index, LSR, Name::kHashShift));
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ add(index, index, Operand(index, LSL, 1)); // index *= 3.
DCHECK_EQ(kSmiTagSize, 1);
STATIC_ASSERT(kSmiTagSize == 1);
__ add(index, dictionary, Operand(index, LSL, 2));
__ ldr(entry_key, FieldMemOperand(index, kElementsStartOffset));
......@@ -4778,12 +4778,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
// sp[0] - last argument
Label normal_sequence;
if (mode == DONT_OVERRIDE) {
DCHECK(FAST_SMI_ELEMENTS == 0);
DCHECK(FAST_HOLEY_SMI_ELEMENTS == 1);
DCHECK(FAST_ELEMENTS == 2);
DCHECK(FAST_HOLEY_ELEMENTS == 3);
DCHECK(FAST_DOUBLE_ELEMENTS == 4);
DCHECK(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
STATIC_ASSERT(FAST_ELEMENTS == 2);
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
// is the low bit set? If so, we are holey and that is good.
__ tst(r3, Operand(1));
......
......@@ -2454,8 +2454,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
// Find the code object based on the assumptions above.
// kDataOneByteCodeOffset and kDataUC16CodeOffset are adjacent, adds an offset
// of kPointerSize to reach the latter.
DCHECK_EQ(JSRegExp::kDataOneByteCodeOffset + kPointerSize,
JSRegExp::kDataUC16CodeOffset);
STATIC_ASSERT(JSRegExp::kDataOneByteCodeOffset + kPointerSize ==
JSRegExp::kDataUC16CodeOffset);
__ Mov(x10, kPointerSize);
// We will need the encoding later: Latin1 = 0x04
// UC16 = 0x00
......@@ -4940,7 +4940,7 @@ void NameDictionaryLookupStub::GeneratePositiveLookup(
__ And(scratch2, scratch1, Operand(scratch2, LSR, Name::kHashShift));
// Scale the index by multiplying by the element size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ Add(scratch2, scratch2, Operand(scratch2, LSL, 1));
// Check if the key is identical to the name.
......@@ -5009,7 +5009,7 @@ void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
__ And(index, index, name->Hash() + NameDictionary::GetProbeOffset(i));
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ Add(index, index, Operand(index, LSL, 1)); // index *= 3.
Register entity_name = scratch0;
......@@ -5100,7 +5100,7 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ And(index, mask, Operand(index, LSR, Name::kHashShift));
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ Add(index, index, Operand(index, LSL, 1)); // index *= 3.
__ Add(index, dictionary, Operand(index, LSL, kPointerSizeLog2));
......
......@@ -5,6 +5,7 @@
#ifndef V8_ELEMENTS_KIND_H_
#define V8_ELEMENTS_KIND_H_
#include "src/base/macros.h"
#include "src/checks.h"
namespace v8 {
......@@ -115,7 +116,7 @@ inline bool IsFixedTypedArrayElementsKind(ElementsKind kind) {
inline bool IsFastElementsKind(ElementsKind kind) {
DCHECK(FIRST_FAST_ELEMENTS_KIND == 0);
STATIC_ASSERT(FIRST_FAST_ELEMENTS_KIND == 0);
return kind <= FAST_HOLEY_DOUBLE_ELEMENTS;
}
......
......@@ -3968,11 +3968,11 @@ void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
NameDictionary::GetProbeOffset(i))));
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ lea(index, Operand(index, index, times_2, 0)); // index *= 3.
Register entity_name = r0;
// Having undefined at this place means the name is not contained.
DCHECK_EQ(kSmiTagSize, 1);
STATIC_ASSERT(kSmiTagSize == 1);
__ mov(entity_name, Operand(properties, index, times_half_pointer_size,
kElementsStartOffset - kHeapObjectTag));
__ cmp(entity_name, masm->isolate()->factory()->undefined_value());
......@@ -4040,7 +4040,7 @@ void NameDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
__ and_(r0, r1);
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ lea(r0, Operand(r0, r0, times_2, 0)); // r0 = r0 * 3
// Check if the key is identical to the name.
......@@ -4103,11 +4103,11 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ and_(scratch, Operand(esp, 0));
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ lea(index(), Operand(scratch, scratch, times_2, 0)); // index *= 3.
// Having undefined at this place means the name is not contained.
DCHECK_EQ(kSmiTagSize, 1);
STATIC_ASSERT(kSmiTagSize == 1);
__ mov(scratch, Operand(dictionary(), index(), times_pointer_size,
kElementsStartOffset - kHeapObjectTag));
__ cmp(scratch, isolate()->factory()->undefined_value());
......@@ -4818,12 +4818,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
// esp[4] - last argument
Label normal_sequence;
if (mode == DONT_OVERRIDE) {
DCHECK(FAST_SMI_ELEMENTS == 0);
DCHECK(FAST_HOLEY_SMI_ELEMENTS == 1);
DCHECK(FAST_ELEMENTS == 2);
DCHECK(FAST_HOLEY_ELEMENTS == 3);
DCHECK(FAST_DOUBLE_ELEMENTS == 4);
DCHECK(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
STATIC_ASSERT(FAST_ELEMENTS == 2);
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
// is the low bit set? If so, we are holey and that is good.
__ test_b(edx, 1);
......
......@@ -4084,7 +4084,7 @@ void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
Register entity_name = scratch0;
// Having undefined at this place means the name is not contained.
DCHECK_EQ(kSmiTagSize, 1);
STATIC_ASSERT(kSmiTagSize == 1);
Register tmp = properties;
__ sll(scratch0, index, 1);
__ Addu(tmp, properties, scratch0);
......@@ -4174,7 +4174,7 @@ void NameDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
__ And(scratch2, scratch1, scratch2);
// Scale the index by multiplying by the element size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
// scratch2 = scratch2 * 3.
__ sll(at, scratch2, 1);
......@@ -4261,14 +4261,14 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ And(index, mask, index);
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
// index *= 3.
__ mov(at, index);
__ sll(index, index, 1);
__ Addu(index, index, at);
DCHECK_EQ(kSmiTagSize, 1);
STATIC_ASSERT(kSmiTagSize == 1);
__ sll(index, index, 2);
__ Addu(index, index, dictionary);
__ lw(entry_key, FieldMemOperand(index, kElementsStartOffset));
......@@ -4992,12 +4992,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
// sp[0] - last argument
Label normal_sequence;
if (mode == DONT_OVERRIDE) {
DCHECK(FAST_SMI_ELEMENTS == 0);
DCHECK(FAST_HOLEY_SMI_ELEMENTS == 1);
DCHECK(FAST_ELEMENTS == 2);
DCHECK(FAST_HOLEY_ELEMENTS == 3);
DCHECK(FAST_DOUBLE_ELEMENTS == 4);
DCHECK(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
STATIC_ASSERT(FAST_ELEMENTS == 2);
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
// is the low bit set? If so, we are holey and that is good.
__ And(at, a3, Operand(1));
......
......@@ -4116,7 +4116,7 @@ void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
Register entity_name = scratch0;
// Having undefined at this place means the name is not contained.
DCHECK_EQ(kSmiTagSize, 1);
STATIC_ASSERT(kSmiTagSize == 1);
Register tmp = properties;
__ dsll(scratch0, index, kPointerSizeLog2);
......@@ -4206,8 +4206,8 @@ void NameDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
__ dsrl(scratch2, scratch2, Name::kHashShift);
__ And(scratch2, scratch1, scratch2);
// Scale the index by multiplying by the element size.
DCHECK(NameDictionary::kEntrySize == 3);
// Scale the index by multiplying by the entry size.
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
// scratch2 = scratch2 * 3.
__ dsll(at, scratch2, 1);
......@@ -4294,14 +4294,14 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ And(index, mask, index);
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
// index *= 3.
__ mov(at, index);
__ dsll(index, index, 1);
__ Daddu(index, index, at);
DCHECK_EQ(kSmiTagSize, 1);
STATIC_ASSERT(kSmiTagSize == 1);
__ dsll(index, index, kPointerSizeLog2);
__ Daddu(index, index, dictionary);
__ ld(entry_key, FieldMemOperand(index, kElementsStartOffset));
......@@ -5024,12 +5024,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
// sp[0] - last argument
Label normal_sequence;
if (mode == DONT_OVERRIDE) {
DCHECK(FAST_SMI_ELEMENTS == 0);
DCHECK(FAST_HOLEY_SMI_ELEMENTS == 1);
DCHECK(FAST_ELEMENTS == 2);
DCHECK(FAST_HOLEY_ELEMENTS == 3);
DCHECK(FAST_DOUBLE_ELEMENTS == 4);
DCHECK(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
STATIC_ASSERT(FAST_ELEMENTS == 2);
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
// is the low bit set? If so, we are holey and that is good.
__ And(at, a3, Operand(1));
......
......@@ -4209,7 +4209,7 @@ void NameDictionaryLookupStub::GeneratePositiveLookup(
__ and_(scratch2, scratch1, scratch2);
// Scale the index by multiplying by the element size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
// scratch2 = scratch2 * 3.
__ ShiftLeftImm(ip, scratch2, Operand(1));
__ add(scratch2, scratch2, ip);
......@@ -4298,7 +4298,7 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ and_(index, mask, r0);
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ ShiftLeftImm(scratch, index, Operand(1));
__ add(index, index, scratch); // index *= 3.
......@@ -5037,12 +5037,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
// sp[0] - last argument
Label normal_sequence;
if (mode == DONT_OVERRIDE) {
DCHECK(FAST_SMI_ELEMENTS == 0);
DCHECK(FAST_HOLEY_SMI_ELEMENTS == 1);
DCHECK(FAST_ELEMENTS == 2);
DCHECK(FAST_HOLEY_ELEMENTS == 3);
DCHECK(FAST_DOUBLE_ELEMENTS == 4);
DCHECK(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
STATIC_ASSERT(FAST_ELEMENTS == 2);
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
// is the low bit set? If so, we are holey and that is good.
__ andi(r0, r6, Operand(1));
......
......@@ -3901,12 +3901,12 @@ void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
Immediate(name->Hash() + NameDictionary::GetProbeOffset(i)));
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ leap(index, Operand(index, index, times_2, 0)); // index *= 3.
Register entity_name = r0;
// Having undefined at this place means the name is not contained.
DCHECK_EQ(kSmiTagSize, 1);
STATIC_ASSERT(kSmiTagSize == 1);
__ movp(entity_name, Operand(properties,
index,
times_pointer_size,
......@@ -3972,7 +3972,7 @@ void NameDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
__ andp(r1, r0);
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ leap(r1, Operand(r1, r1, times_2, 0)); // r1 = r1 * 3
// Check if the key is identical to the name.
......@@ -4034,7 +4034,7 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ andp(scratch, Operand(rsp, 0));
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ leap(index(), Operand(scratch, scratch, times_2, 0)); // index *= 3.
// Having undefined at this place means the name is not contained.
......@@ -4731,12 +4731,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
Label normal_sequence;
if (mode == DONT_OVERRIDE) {
DCHECK(FAST_SMI_ELEMENTS == 0);
DCHECK(FAST_HOLEY_SMI_ELEMENTS == 1);
DCHECK(FAST_ELEMENTS == 2);
DCHECK(FAST_HOLEY_ELEMENTS == 3);
DCHECK(FAST_DOUBLE_ELEMENTS == 4);
DCHECK(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
STATIC_ASSERT(FAST_ELEMENTS == 2);
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
// is the low bit set? If so, we are holey and that is good.
__ testb(rdx, Immediate(1));
......
......@@ -3616,11 +3616,11 @@ void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
NameDictionary::GetProbeOffset(i))));
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ lea(index, Operand(index, index, times_2, 0)); // index *= 3.
Register entity_name = r0;
// Having undefined at this place means the name is not contained.
DCHECK_EQ(kSmiTagSize, 1);
STATIC_ASSERT(kSmiTagSize == 1);
__ mov(entity_name, Operand(properties, index, times_half_pointer_size,
kElementsStartOffset - kHeapObjectTag));
__ cmp(entity_name, masm->isolate()->factory()->undefined_value());
......@@ -3688,7 +3688,7 @@ void NameDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
__ and_(r0, r1);
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ lea(r0, Operand(r0, r0, times_2, 0)); // r0 = r0 * 3
// Check if the key is identical to the name.
......@@ -3751,11 +3751,11 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ and_(scratch, Operand(esp, 0));
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
STATIC_ASSERT(NameDictionary::kEntrySize == 3);
__ lea(index(), Operand(scratch, scratch, times_2, 0)); // index *= 3.
// Having undefined at this place means the name is not contained.
DCHECK_EQ(kSmiTagSize, 1);
STATIC_ASSERT(kSmiTagSize == 1);
__ mov(scratch, Operand(dictionary(), index(), times_pointer_size,
kElementsStartOffset - kHeapObjectTag));
__ cmp(scratch, isolate()->factory()->undefined_value());
......@@ -4464,12 +4464,12 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
// esp[4] - last argument
Label normal_sequence;
if (mode == DONT_OVERRIDE) {
DCHECK(FAST_SMI_ELEMENTS == 0);
DCHECK(FAST_HOLEY_SMI_ELEMENTS == 1);
DCHECK(FAST_ELEMENTS == 2);
DCHECK(FAST_HOLEY_ELEMENTS == 3);
DCHECK(FAST_DOUBLE_ELEMENTS == 4);
DCHECK(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
STATIC_ASSERT(FAST_ELEMENTS == 2);
STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
STATIC_ASSERT(FAST_DOUBLE_ELEMENTS == 4);
STATIC_ASSERT(FAST_HOLEY_DOUBLE_ELEMENTS == 5);
// is the low bit set? If so, we are holey and that is good.
__ test_b(edx, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment