Replace STATIC_CHECK with STATIC_ASSERT.
It's just an alias, and STATIC_ASSERT is used way more often BUG=none R=jkummerow@chromium.org LOG=n Review URL: https://codereview.chromium.org/304553002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21527 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
4309b34e40
commit
276adeda1a
@ -2497,8 +2497,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
||||
STATIC_ASSERT(kSeqStringTag == 0);
|
||||
__ tst(r0, Operand(kStringRepresentationMask));
|
||||
// The underlying external string is never a short external string.
|
||||
STATIC_CHECK(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
||||
STATIC_CHECK(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
||||
STATIC_ASSERT(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
||||
STATIC_ASSERT(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
||||
__ b(ne, &external_string); // Go to (7).
|
||||
|
||||
// (5) Sequential string. Load regexp code according to encoding.
|
||||
@ -3677,7 +3677,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
// Handle external string.
|
||||
// Rule out short external strings.
|
||||
STATIC_CHECK(kShortExternalStringTag != 0);
|
||||
STATIC_ASSERT(kShortExternalStringTag != 0);
|
||||
__ tst(r1, Operand(kShortExternalStringTag));
|
||||
__ b(ne, &runtime);
|
||||
__ ldr(r5, FieldMemOperand(r5, ExternalString::kResourceDataOffset));
|
||||
|
@ -708,7 +708,7 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
|
||||
__ Assert(eq, kExternalStringExpectedButNotFound);
|
||||
}
|
||||
// Rule out short external strings.
|
||||
STATIC_CHECK(kShortExternalStringTag != 0);
|
||||
STATIC_ASSERT(kShortExternalStringTag != 0);
|
||||
__ tst(result, Operand(kShortExternalStringMask));
|
||||
__ b(ne, call_runtime);
|
||||
__ ldr(string, FieldMemOperand(string, ExternalString::kResourceDataOffset));
|
||||
|
@ -2721,8 +2721,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
||||
__ Ldrb(string_type, FieldMemOperand(x10, Map::kInstanceTypeOffset));
|
||||
STATIC_ASSERT(kSeqStringTag == 0);
|
||||
// The underlying external string is never a short external string.
|
||||
STATIC_CHECK(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
||||
STATIC_CHECK(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
||||
STATIC_ASSERT(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
||||
STATIC_ASSERT(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
||||
__ TestAndBranchIfAnySet(string_type.X(),
|
||||
kStringRepresentationMask,
|
||||
&external_string); // Go to (7).
|
||||
|
@ -473,7 +473,7 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
|
||||
__ Assert(eq, kExternalStringExpectedButNotFound);
|
||||
}
|
||||
// Rule out short external strings.
|
||||
STATIC_CHECK(kShortExternalStringTag != 0);
|
||||
STATIC_ASSERT(kShortExternalStringTag != 0);
|
||||
// TestAndBranchIfAnySet can emit Tbnz. Do not use it because call_runtime
|
||||
// can be bound far away in deferred code.
|
||||
__ Tst(result, kShortExternalStringMask);
|
||||
|
10
src/checks.h
10
src/checks.h
@ -243,7 +243,7 @@ inline void CheckNonEqualsHelper(const char* file,
|
||||
// Use C++11 static_assert if possible, which gives error
|
||||
// messages that are easier to understand on first sight.
|
||||
#if V8_HAS_CXX11_STATIC_ASSERT
|
||||
#define STATIC_CHECK(test) static_assert(test, #test)
|
||||
#define STATIC_ASSERT(test) static_assert(test, #test)
|
||||
#else
|
||||
// This is inspired by the static assertion facility in boost. This
|
||||
// is pretty magical. If it causes you trouble on a platform you may
|
||||
@ -260,7 +260,7 @@ template <> class StaticAssertion<true> { };
|
||||
// actually causes each use to introduce a new defined type with a
|
||||
// name depending on the source line.
|
||||
template <int> class StaticAssertionHelper { };
|
||||
#define STATIC_CHECK(test) \
|
||||
#define STATIC_ASSERT(test) \
|
||||
typedef \
|
||||
StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
|
||||
SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) V8_UNUSED
|
||||
@ -310,12 +310,6 @@ void DumpBacktrace();
|
||||
#define ASSERT_LT(v1, v2) ((void) 0)
|
||||
#define ASSERT_LE(v1, v2) ((void) 0)
|
||||
#endif
|
||||
// Static asserts has no impact on runtime performance, so they can be
|
||||
// safely enabled in release mode. Moreover, the ((void) 0) expression
|
||||
// obeys different syntax rules than typedef's, e.g. it can't appear
|
||||
// inside class declaration, this leads to inconsistency between debug
|
||||
// and release compilation modes behavior.
|
||||
#define STATIC_ASSERT(test) STATIC_CHECK(test)
|
||||
|
||||
#define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p)
|
||||
|
||||
|
@ -545,8 +545,8 @@ class Context: public FixedArray {
|
||||
static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object);
|
||||
#endif
|
||||
|
||||
STATIC_CHECK(kHeaderSize == Internals::kContextHeaderSize);
|
||||
STATIC_CHECK(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex);
|
||||
STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize);
|
||||
STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex);
|
||||
};
|
||||
|
||||
} } // namespace v8::internal
|
||||
|
@ -82,7 +82,7 @@ void HeapEntry::SetIndexedReference(HeapGraphEdge::Type type,
|
||||
|
||||
void HeapEntry::Print(
|
||||
const char* prefix, const char* edge_name, int max_depth, int indent) {
|
||||
STATIC_CHECK(sizeof(unsigned) == sizeof(id()));
|
||||
STATIC_ASSERT(sizeof(unsigned) == sizeof(id()));
|
||||
OS::Print("%6" V8PRIuPTR " @%6u %*c %s%s: ",
|
||||
self_size(), id(), indent, ' ', prefix, edge_name);
|
||||
if (type() != kString) {
|
||||
@ -190,10 +190,10 @@ HeapSnapshot::HeapSnapshot(HeapProfiler* profiler,
|
||||
gc_roots_index_(HeapEntry::kNoEntry),
|
||||
natives_root_index_(HeapEntry::kNoEntry),
|
||||
max_snapshot_js_object_id_(0) {
|
||||
STATIC_CHECK(
|
||||
STATIC_ASSERT(
|
||||
sizeof(HeapGraphEdge) ==
|
||||
SnapshotSizeConstants<kPointerSize>::kExpectedHeapGraphEdgeSize);
|
||||
STATIC_CHECK(
|
||||
STATIC_ASSERT(
|
||||
sizeof(HeapEntry) ==
|
||||
SnapshotSizeConstants<kPointerSize>::kExpectedHeapEntrySize);
|
||||
USE(SnapshotSizeConstants<4>::kExpectedHeapGraphEdgeSize);
|
||||
@ -1200,9 +1200,9 @@ void V8HeapExplorer::ExtractJSObjectReferences(
|
||||
SetWeakReference(js_fun, entry,
|
||||
"next_function_link", js_fun->next_function_link(),
|
||||
JSFunction::kNextFunctionLinkOffset);
|
||||
STATIC_CHECK(JSFunction::kNextFunctionLinkOffset
|
||||
STATIC_ASSERT(JSFunction::kNextFunctionLinkOffset
|
||||
== JSFunction::kNonWeakFieldsEndOffset);
|
||||
STATIC_CHECK(JSFunction::kNextFunctionLinkOffset + kPointerSize
|
||||
STATIC_ASSERT(JSFunction::kNextFunctionLinkOffset + kPointerSize
|
||||
== JSFunction::kSize);
|
||||
} else if (obj->IsGlobalObject()) {
|
||||
GlobalObject* global_obj = GlobalObject::cast(obj);
|
||||
@ -1218,7 +1218,7 @@ void V8HeapExplorer::ExtractJSObjectReferences(
|
||||
SetInternalReference(global_obj, entry,
|
||||
"global_receiver", global_obj->global_receiver(),
|
||||
GlobalObject::kGlobalReceiverOffset);
|
||||
STATIC_CHECK(GlobalObject::kHeaderSize - JSObject::kHeaderSize ==
|
||||
STATIC_ASSERT(GlobalObject::kHeaderSize - JSObject::kHeaderSize ==
|
||||
4 * kPointerSize);
|
||||
} else if (obj->IsJSArrayBufferView()) {
|
||||
JSArrayBufferView* view = JSArrayBufferView::cast(obj);
|
||||
@ -1317,10 +1317,12 @@ void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) {
|
||||
EXTRACT_CONTEXT_FIELD(DEOPTIMIZED_CODE_LIST, unused, deoptimized_code_list);
|
||||
EXTRACT_CONTEXT_FIELD(NEXT_CONTEXT_LINK, unused, next_context_link);
|
||||
#undef EXTRACT_CONTEXT_FIELD
|
||||
STATIC_CHECK(Context::OPTIMIZED_FUNCTIONS_LIST == Context::FIRST_WEAK_SLOT);
|
||||
STATIC_CHECK(Context::NEXT_CONTEXT_LINK + 1
|
||||
== Context::NATIVE_CONTEXT_SLOTS);
|
||||
STATIC_CHECK(Context::FIRST_WEAK_SLOT + 5 == Context::NATIVE_CONTEXT_SLOTS);
|
||||
STATIC_ASSERT(Context::OPTIMIZED_FUNCTIONS_LIST ==
|
||||
Context::FIRST_WEAK_SLOT);
|
||||
STATIC_ASSERT(Context::NEXT_CONTEXT_LINK + 1 ==
|
||||
Context::NATIVE_CONTEXT_SLOTS);
|
||||
STATIC_ASSERT(Context::FIRST_WEAK_SLOT + 5 ==
|
||||
Context::NATIVE_CONTEXT_SLOTS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1555,7 +1557,7 @@ void V8HeapExplorer::ExtractAllocationSiteReferences(int entry,
|
||||
AllocationSite::kDependentCodeOffset);
|
||||
// Do not visit weak_next as it is not visited by the StaticVisitor,
|
||||
// and we're not very interested in weak_next field here.
|
||||
STATIC_CHECK(AllocationSite::kWeakNextOffset >=
|
||||
STATIC_ASSERT(AllocationSite::kWeakNextOffset >=
|
||||
AllocationSite::BodyDescriptor::kEndOffset);
|
||||
}
|
||||
|
||||
@ -2822,7 +2824,7 @@ template<> struct ToUnsigned<8> {
|
||||
|
||||
template<typename T>
|
||||
static int utoa_impl(T value, const Vector<char>& buffer, int buffer_pos) {
|
||||
STATIC_CHECK(static_cast<T>(-1) > 0); // Check that T is unsigned
|
||||
STATIC_ASSERT(static_cast<T>(-1) > 0); // Check that T is unsigned
|
||||
int number_of_digits = 0;
|
||||
T t = value;
|
||||
do {
|
||||
@ -2843,7 +2845,7 @@ static int utoa_impl(T value, const Vector<char>& buffer, int buffer_pos) {
|
||||
template<typename T>
|
||||
static int utoa(T value, const Vector<char>& buffer, int buffer_pos) {
|
||||
typename ToUnsigned<sizeof(value)>::Type unsigned_value = value;
|
||||
STATIC_CHECK(sizeof(value) == sizeof(unsigned_value));
|
||||
STATIC_ASSERT(sizeof(value) == sizeof(unsigned_value));
|
||||
return utoa_impl(unsigned_value, buffer, buffer_pos);
|
||||
}
|
||||
|
||||
|
11
src/heap.h
11
src/heap.h
@ -1132,11 +1132,12 @@ class Heap {
|
||||
kSmiRootsStart = kStringTableRootIndex + 1
|
||||
};
|
||||
|
||||
STATIC_CHECK(kUndefinedValueRootIndex == Internals::kUndefinedValueRootIndex);
|
||||
STATIC_CHECK(kNullValueRootIndex == Internals::kNullValueRootIndex);
|
||||
STATIC_CHECK(kTrueValueRootIndex == Internals::kTrueValueRootIndex);
|
||||
STATIC_CHECK(kFalseValueRootIndex == Internals::kFalseValueRootIndex);
|
||||
STATIC_CHECK(kempty_stringRootIndex == Internals::kEmptyStringRootIndex);
|
||||
STATIC_ASSERT(kUndefinedValueRootIndex ==
|
||||
Internals::kUndefinedValueRootIndex);
|
||||
STATIC_ASSERT(kNullValueRootIndex == Internals::kNullValueRootIndex);
|
||||
STATIC_ASSERT(kTrueValueRootIndex == Internals::kTrueValueRootIndex);
|
||||
STATIC_ASSERT(kFalseValueRootIndex == Internals::kFalseValueRootIndex);
|
||||
STATIC_ASSERT(kempty_stringRootIndex == Internals::kEmptyStringRootIndex);
|
||||
|
||||
// Generated code can embed direct references to non-writable roots if
|
||||
// they are in new space.
|
||||
|
@ -1566,8 +1566,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
||||
// (5b) Is subject external? If yes, go to (8).
|
||||
__ test_b(ebx, kStringRepresentationMask);
|
||||
// The underlying external string is never a short external string.
|
||||
STATIC_CHECK(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
||||
STATIC_CHECK(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
||||
STATIC_ASSERT(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
||||
STATIC_ASSERT(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
||||
__ j(not_zero, &external_string); // Go to (8).
|
||||
|
||||
// eax: sequential subject string (or look-alike, external string)
|
||||
@ -3465,7 +3465,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
// Handle external string.
|
||||
// Rule out short external strings.
|
||||
STATIC_CHECK(kShortExternalStringTag != 0);
|
||||
STATIC_ASSERT(kShortExternalStringTag != 0);
|
||||
__ test_b(ebx, kShortExternalStringMask);
|
||||
__ j(not_zero, &runtime);
|
||||
__ mov(edi, FieldOperand(edi, ExternalString::kResourceDataOffset));
|
||||
|
@ -857,7 +857,7 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
|
||||
__ Assert(zero, kExternalStringExpectedButNotFound);
|
||||
}
|
||||
// Rule out short external strings.
|
||||
STATIC_CHECK(kShortExternalStringTag != 0);
|
||||
STATIC_ASSERT(kShortExternalStringTag != 0);
|
||||
__ test_b(result, kShortExternalStringMask);
|
||||
__ j(not_zero, call_runtime);
|
||||
// Check encoding.
|
||||
|
@ -2642,8 +2642,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
||||
STATIC_ASSERT(kSeqStringTag == 0);
|
||||
__ And(at, a0, Operand(kStringRepresentationMask));
|
||||
// The underlying external string is never a short external string.
|
||||
STATIC_CHECK(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
||||
STATIC_CHECK(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
||||
STATIC_ASSERT(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
||||
STATIC_ASSERT(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
||||
__ Branch(&external_string, ne, at, Operand(zero_reg)); // Go to (7).
|
||||
|
||||
// (5) Sequential string. Load regexp code according to encoding.
|
||||
@ -3839,7 +3839,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
// Handle external string.
|
||||
// Rule out short external strings.
|
||||
STATIC_CHECK(kShortExternalStringTag != 0);
|
||||
STATIC_ASSERT(kShortExternalStringTag != 0);
|
||||
__ And(t0, a1, Operand(kShortExternalStringTag));
|
||||
__ Branch(&runtime, ne, t0, Operand(zero_reg));
|
||||
__ lw(t1, FieldMemOperand(t1, ExternalString::kResourceDataOffset));
|
||||
|
@ -1005,7 +1005,7 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
|
||||
at, Operand(zero_reg));
|
||||
}
|
||||
// Rule out short external strings.
|
||||
STATIC_CHECK(kShortExternalStringTag != 0);
|
||||
STATIC_ASSERT(kShortExternalStringTag != 0);
|
||||
__ And(at, result, Operand(kShortExternalStringMask));
|
||||
__ Branch(call_runtime, ne, at, Operand(zero_reg));
|
||||
__ lw(string, FieldMemOperand(string, ExternalString::kResourceDataOffset));
|
||||
|
@ -398,10 +398,10 @@ uint32_t StringShape::full_representation_tag() {
|
||||
}
|
||||
|
||||
|
||||
STATIC_CHECK((kStringRepresentationMask | kStringEncodingMask) ==
|
||||
STATIC_ASSERT((kStringRepresentationMask | kStringEncodingMask) ==
|
||||
Internals::kFullStringRepresentationMask);
|
||||
|
||||
STATIC_CHECK(static_cast<uint32_t>(kStringEncodingMask) ==
|
||||
STATIC_ASSERT(static_cast<uint32_t>(kStringEncodingMask) ==
|
||||
Internals::kStringEncodingMask);
|
||||
|
||||
|
||||
@ -420,10 +420,10 @@ bool StringShape::IsExternalAscii() {
|
||||
}
|
||||
|
||||
|
||||
STATIC_CHECK((kExternalStringTag | kOneByteStringTag) ==
|
||||
STATIC_ASSERT((kExternalStringTag | kOneByteStringTag) ==
|
||||
Internals::kExternalAsciiRepresentationTag);
|
||||
|
||||
STATIC_CHECK(v8::String::ASCII_ENCODING == kOneByteStringTag);
|
||||
STATIC_ASSERT(v8::String::ASCII_ENCODING == kOneByteStringTag);
|
||||
|
||||
|
||||
bool StringShape::IsExternalTwoByte() {
|
||||
@ -431,10 +431,10 @@ bool StringShape::IsExternalTwoByte() {
|
||||
}
|
||||
|
||||
|
||||
STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) ==
|
||||
STATIC_ASSERT((kExternalStringTag | kTwoByteStringTag) ==
|
||||
Internals::kExternalTwoByteRepresentationTag);
|
||||
|
||||
STATIC_CHECK(v8::String::TWO_BYTE_ENCODING == kTwoByteStringTag);
|
||||
STATIC_ASSERT(v8::String::TWO_BYTE_ENCODING == kTwoByteStringTag);
|
||||
|
||||
uc32 FlatStringReader::Get(int index) {
|
||||
ASSERT(0 <= index && index <= length_);
|
||||
|
@ -808,10 +808,10 @@ enum InstanceType {
|
||||
const int kExternalArrayTypeCount =
|
||||
LAST_EXTERNAL_ARRAY_TYPE - FIRST_EXTERNAL_ARRAY_TYPE + 1;
|
||||
|
||||
STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType);
|
||||
STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
|
||||
STATIC_CHECK(ODDBALL_TYPE == Internals::kOddballType);
|
||||
STATIC_CHECK(FOREIGN_TYPE == Internals::kForeignType);
|
||||
STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType);
|
||||
STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
|
||||
STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType);
|
||||
STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType);
|
||||
|
||||
|
||||
#define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \
|
||||
@ -1744,7 +1744,7 @@ class HeapObject: public Object {
|
||||
static const int kMapOffset = Object::kHeaderSize;
|
||||
static const int kHeaderSize = kMapOffset + kPointerSize;
|
||||
|
||||
STATIC_CHECK(kMapOffset == Internals::kHeapObjectMapOffset);
|
||||
STATIC_ASSERT(kMapOffset == Internals::kHeapObjectMapOffset);
|
||||
|
||||
protected:
|
||||
// helpers for calling an ObjectVisitor to iterate over pointers in the
|
||||
@ -2653,7 +2653,7 @@ class JSObject: public JSReceiver {
|
||||
static const int kElementsOffset = kPropertiesOffset + kPointerSize;
|
||||
static const int kHeaderSize = kElementsOffset + kPointerSize;
|
||||
|
||||
STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize);
|
||||
STATIC_ASSERT(kHeaderSize == Internals::kJSObjectHeaderSize);
|
||||
|
||||
class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> {
|
||||
public:
|
||||
@ -3035,7 +3035,7 @@ class FixedArray: public FixedArrayBase {
|
||||
Object* value);
|
||||
|
||||
private:
|
||||
STATIC_CHECK(kHeaderSize == Internals::kFixedArrayHeaderSize);
|
||||
STATIC_ASSERT(kHeaderSize == Internals::kFixedArrayHeaderSize);
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray);
|
||||
};
|
||||
@ -6559,7 +6559,7 @@ class Map: public HeapObject {
|
||||
static const int kBitFieldOffset = kInstanceAttributesOffset + 2;
|
||||
static const int kBitField2Offset = kInstanceAttributesOffset + 3;
|
||||
|
||||
STATIC_CHECK(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset);
|
||||
STATIC_ASSERT(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset);
|
||||
|
||||
// Bit positions for bit field.
|
||||
static const int kHasNonInstancePrototype = 0;
|
||||
@ -8791,7 +8791,7 @@ class Name: public HeapObject {
|
||||
static const int kArrayIndexLengthBits =
|
||||
kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields;
|
||||
|
||||
STATIC_CHECK((kArrayIndexLengthBits > 0));
|
||||
STATIC_ASSERT((kArrayIndexLengthBits > 0));
|
||||
|
||||
static const int kArrayIndexHashLengthShift =
|
||||
kArrayIndexValueBits + kNofHashBitFields;
|
||||
@ -8804,7 +8804,7 @@ class Name: public HeapObject {
|
||||
// Check that kMaxCachedArrayIndexLength + 1 is a power of two so we
|
||||
// could use a mask to test if the length of string is less than or equal to
|
||||
// kMaxCachedArrayIndexLength.
|
||||
STATIC_CHECK(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1));
|
||||
STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1));
|
||||
|
||||
static const unsigned int kContainsCachedArrayIndexMask =
|
||||
(~kMaxCachedArrayIndexLength << kArrayIndexHashLengthShift) |
|
||||
@ -9053,7 +9053,7 @@ class String: public Name {
|
||||
// Maximum number of characters to consider when trying to convert a string
|
||||
// value into an array index.
|
||||
static const int kMaxArrayIndexSize = 10;
|
||||
STATIC_CHECK(kMaxArrayIndexSize < (1 << kArrayIndexLengthBits));
|
||||
STATIC_ASSERT(kMaxArrayIndexSize < (1 << kArrayIndexLengthBits));
|
||||
|
||||
// Max char codes.
|
||||
static const int32_t kMaxOneByteCharCode = unibrow::Latin1::kMaxChar;
|
||||
@ -9211,7 +9211,7 @@ class SeqOneByteString: public SeqString {
|
||||
|
||||
// Maximal memory usage for a single sequential ASCII string.
|
||||
static const int kMaxSize = 512 * MB - 1;
|
||||
STATIC_CHECK((kMaxSize - kHeaderSize) >= String::kMaxLength);
|
||||
STATIC_ASSERT((kMaxSize - kHeaderSize) >= String::kMaxLength);
|
||||
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(SeqOneByteString);
|
||||
@ -9251,7 +9251,7 @@ class SeqTwoByteString: public SeqString {
|
||||
|
||||
// Maximal memory usage for a single sequential two-byte string.
|
||||
static const int kMaxSize = 512 * MB - 1;
|
||||
STATIC_CHECK(static_cast<int>((kMaxSize - kHeaderSize)/sizeof(uint16_t)) >=
|
||||
STATIC_ASSERT(static_cast<int>((kMaxSize - kHeaderSize)/sizeof(uint16_t)) >=
|
||||
String::kMaxLength);
|
||||
|
||||
private:
|
||||
@ -9380,7 +9380,7 @@ class ExternalString: public String {
|
||||
// Return whether external string is short (data pointer is not cached).
|
||||
inline bool is_short();
|
||||
|
||||
STATIC_CHECK(kResourceOffset == Internals::kStringResourceOffset);
|
||||
STATIC_ASSERT(kResourceOffset == Internals::kStringResourceOffset);
|
||||
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString);
|
||||
@ -9650,9 +9650,9 @@ class Oddball: public HeapObject {
|
||||
kToNumberOffset + kPointerSize,
|
||||
kSize> BodyDescriptor;
|
||||
|
||||
STATIC_CHECK(kKindOffset == Internals::kOddballKindOffset);
|
||||
STATIC_CHECK(kNull == Internals::kNullOddballKind);
|
||||
STATIC_CHECK(kUndefined == Internals::kUndefinedOddballKind);
|
||||
STATIC_ASSERT(kKindOffset == Internals::kOddballKindOffset);
|
||||
STATIC_ASSERT(kNull == Internals::kNullOddballKind);
|
||||
STATIC_ASSERT(kUndefined == Internals::kUndefinedOddballKind);
|
||||
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball);
|
||||
@ -9821,7 +9821,7 @@ class JSProxy: public JSReceiver {
|
||||
static const int kHeaderSize = kPaddingOffset;
|
||||
static const int kPaddingSize = kSize - kPaddingOffset;
|
||||
|
||||
STATIC_CHECK(kPaddingSize >= 0);
|
||||
STATIC_ASSERT(kPaddingSize >= 0);
|
||||
|
||||
typedef FixedBodyDescriptor<kHandlerOffset,
|
||||
kPaddingOffset,
|
||||
@ -9887,7 +9887,7 @@ class JSFunctionProxy: public JSProxy {
|
||||
static const int kSize = JSFunction::kSize;
|
||||
static const int kPaddingSize = kSize - kPaddingOffset;
|
||||
|
||||
STATIC_CHECK(kPaddingSize >= 0);
|
||||
STATIC_ASSERT(kPaddingSize >= 0);
|
||||
|
||||
typedef FixedBodyDescriptor<kHandlerOffset,
|
||||
kConstructTrapOffset + kPointerSize,
|
||||
@ -10261,7 +10261,7 @@ class Foreign: public HeapObject {
|
||||
static const int kForeignAddressOffset = HeapObject::kHeaderSize;
|
||||
static const int kSize = kForeignAddressOffset + kPointerSize;
|
||||
|
||||
STATIC_CHECK(kForeignAddressOffset == Internals::kForeignAddressOffset);
|
||||
STATIC_ASSERT(kForeignAddressOffset == Internals::kForeignAddressOffset);
|
||||
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Foreign);
|
||||
|
@ -7577,8 +7577,8 @@ RUNTIME_FUNCTION(Runtime_StringEquals) {
|
||||
// equality is 0 and inequality is 1 so we have to negate the result
|
||||
// from String::Equals.
|
||||
ASSERT(not_equal == 0 || not_equal == 1);
|
||||
STATIC_CHECK(EQUAL == 0);
|
||||
STATIC_CHECK(NOT_EQUAL == 1);
|
||||
STATIC_ASSERT(EQUAL == 0);
|
||||
STATIC_ASSERT(NOT_EQUAL == 1);
|
||||
return Smi::FromInt(not_equal);
|
||||
}
|
||||
|
||||
|
@ -734,7 +734,7 @@ class MemoryChunk {
|
||||
};
|
||||
|
||||
|
||||
STATIC_CHECK(sizeof(MemoryChunk) <= MemoryChunk::kHeaderSize);
|
||||
STATIC_ASSERT(sizeof(MemoryChunk) <= MemoryChunk::kHeaderSize);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -841,7 +841,7 @@ class Page : public MemoryChunk {
|
||||
};
|
||||
|
||||
|
||||
STATIC_CHECK(sizeof(Page) <= MemoryChunk::kHeaderSize);
|
||||
STATIC_ASSERT(sizeof(Page) <= MemoryChunk::kHeaderSize);
|
||||
|
||||
|
||||
class LargePage : public MemoryChunk {
|
||||
@ -863,7 +863,7 @@ class LargePage : public MemoryChunk {
|
||||
friend class MemoryAllocator;
|
||||
};
|
||||
|
||||
STATIC_CHECK(sizeof(LargePage) <= MemoryChunk::kHeaderSize);
|
||||
STATIC_ASSERT(sizeof(LargePage) <= MemoryChunk::kHeaderSize);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Space is the abstract superclass for all allocation spaces.
|
||||
|
@ -1449,8 +1449,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
||||
// (5b) Is subject external? If yes, go to (8).
|
||||
__ testb(rbx, Immediate(kStringRepresentationMask));
|
||||
// The underlying external string is never a short external string.
|
||||
STATIC_CHECK(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
||||
STATIC_CHECK(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
||||
STATIC_ASSERT(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
||||
STATIC_ASSERT(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
||||
__ j(not_zero, &external_string); // Go to (8)
|
||||
|
||||
// (6) One byte sequential. Load regexp code for one byte.
|
||||
@ -3423,7 +3423,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
// Handle external string.
|
||||
// Rule out short external strings.
|
||||
STATIC_CHECK(kShortExternalStringTag != 0);
|
||||
STATIC_ASSERT(kShortExternalStringTag != 0);
|
||||
__ testb(rbx, Immediate(kShortExternalStringMask));
|
||||
__ j(not_zero, &runtime);
|
||||
__ movp(rdi, FieldOperand(rdi, ExternalString::kResourceDataOffset));
|
||||
|
@ -518,7 +518,7 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
|
||||
__ Assert(zero, kExternalStringExpectedButNotFound);
|
||||
}
|
||||
// Rule out short external strings.
|
||||
STATIC_CHECK(kShortExternalStringTag != 0);
|
||||
STATIC_ASSERT(kShortExternalStringTag != 0);
|
||||
__ testb(result, Immediate(kShortExternalStringTag));
|
||||
__ j(not_zero, call_runtime);
|
||||
// Check encoding.
|
||||
|
@ -1239,8 +1239,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
||||
// (5b) Is subject external? If yes, go to (8).
|
||||
__ test_b(ebx, kStringRepresentationMask);
|
||||
// The underlying external string is never a short external string.
|
||||
STATIC_CHECK(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
||||
STATIC_CHECK(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
||||
STATIC_ASSERT(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
||||
STATIC_ASSERT(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
||||
__ j(not_zero, &external_string); // Go to (8).
|
||||
|
||||
// eax: sequential subject string (or look-alike, external string)
|
||||
@ -3140,7 +3140,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
// Handle external string.
|
||||
// Rule out short external strings.
|
||||
STATIC_CHECK(kShortExternalStringTag != 0);
|
||||
STATIC_ASSERT(kShortExternalStringTag != 0);
|
||||
__ test_b(ebx, kShortExternalStringMask);
|
||||
__ j(not_zero, &runtime);
|
||||
__ mov(edi, FieldOperand(edi, ExternalString::kResourceDataOffset));
|
||||
|
@ -526,7 +526,7 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
|
||||
__ Assert(zero, kExternalStringExpectedButNotFound);
|
||||
}
|
||||
// Rule out short external strings.
|
||||
STATIC_CHECK(kShortExternalStringTag != 0);
|
||||
STATIC_ASSERT(kShortExternalStringTag != 0);
|
||||
__ test_b(result, kShortExternalStringMask);
|
||||
__ j(not_zero, call_runtime);
|
||||
// Check encoding.
|
||||
|
@ -4724,7 +4724,7 @@ class ThreadBarrier V8_FINAL {
|
||||
Mutex mutex_;
|
||||
int num_blocked_;
|
||||
|
||||
STATIC_CHECK(N > 0);
|
||||
STATIC_ASSERT(N > 0);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ThreadBarrier);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user