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

Side by Side Diff: src/objects-inl.h

Issue 304553002: Replace STATIC_CHECK with STATIC_ASSERT. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/runtime.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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 uint32_t StringShape::encoding_tag() { 391 uint32_t StringShape::encoding_tag() {
392 return type_ & kStringEncodingMask; 392 return type_ & kStringEncodingMask;
393 } 393 }
394 394
395 395
396 uint32_t StringShape::full_representation_tag() { 396 uint32_t StringShape::full_representation_tag() {
397 return (type_ & (kStringRepresentationMask | kStringEncodingMask)); 397 return (type_ & (kStringRepresentationMask | kStringEncodingMask));
398 } 398 }
399 399
400 400
401 STATIC_CHECK((kStringRepresentationMask | kStringEncodingMask) == 401 STATIC_ASSERT((kStringRepresentationMask | kStringEncodingMask) ==
402 Internals::kFullStringRepresentationMask); 402 Internals::kFullStringRepresentationMask);
403 403
404 STATIC_CHECK(static_cast<uint32_t>(kStringEncodingMask) == 404 STATIC_ASSERT(static_cast<uint32_t>(kStringEncodingMask) ==
405 Internals::kStringEncodingMask); 405 Internals::kStringEncodingMask);
406 406
407 407
408 bool StringShape::IsSequentialAscii() { 408 bool StringShape::IsSequentialAscii() {
409 return full_representation_tag() == (kSeqStringTag | kOneByteStringTag); 409 return full_representation_tag() == (kSeqStringTag | kOneByteStringTag);
410 } 410 }
411 411
412 412
413 bool StringShape::IsSequentialTwoByte() { 413 bool StringShape::IsSequentialTwoByte() {
414 return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag); 414 return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag);
415 } 415 }
416 416
417 417
418 bool StringShape::IsExternalAscii() { 418 bool StringShape::IsExternalAscii() {
419 return full_representation_tag() == (kExternalStringTag | kOneByteStringTag); 419 return full_representation_tag() == (kExternalStringTag | kOneByteStringTag);
420 } 420 }
421 421
422 422
423 STATIC_CHECK((kExternalStringTag | kOneByteStringTag) == 423 STATIC_ASSERT((kExternalStringTag | kOneByteStringTag) ==
424 Internals::kExternalAsciiRepresentationTag); 424 Internals::kExternalAsciiRepresentationTag);
425 425
426 STATIC_CHECK(v8::String::ASCII_ENCODING == kOneByteStringTag); 426 STATIC_ASSERT(v8::String::ASCII_ENCODING == kOneByteStringTag);
427 427
428 428
429 bool StringShape::IsExternalTwoByte() { 429 bool StringShape::IsExternalTwoByte() {
430 return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag); 430 return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag);
431 } 431 }
432 432
433 433
434 STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) == 434 STATIC_ASSERT((kExternalStringTag | kTwoByteStringTag) ==
435 Internals::kExternalTwoByteRepresentationTag); 435 Internals::kExternalTwoByteRepresentationTag);
436 436
437 STATIC_CHECK(v8::String::TWO_BYTE_ENCODING == kTwoByteStringTag); 437 STATIC_ASSERT(v8::String::TWO_BYTE_ENCODING == kTwoByteStringTag);
438 438
439 uc32 FlatStringReader::Get(int index) { 439 uc32 FlatStringReader::Get(int index) {
440 ASSERT(0 <= index && index <= length_); 440 ASSERT(0 <= index && index <= length_);
441 if (is_ascii_) { 441 if (is_ascii_) {
442 return static_cast<const byte*>(start_)[index]; 442 return static_cast<const byte*>(start_)[index];
443 } else { 443 } else {
444 return static_cast<const uc16*>(start_)[index]; 444 return static_cast<const uc16*>(start_)[index];
445 } 445 }
446 } 446 }
447 447
(...skipping 6397 matching lines...) Expand 10 before | Expand all | Expand 10 after
6845 #undef READ_SHORT_FIELD 6845 #undef READ_SHORT_FIELD
6846 #undef WRITE_SHORT_FIELD 6846 #undef WRITE_SHORT_FIELD
6847 #undef READ_BYTE_FIELD 6847 #undef READ_BYTE_FIELD
6848 #undef WRITE_BYTE_FIELD 6848 #undef WRITE_BYTE_FIELD
6849 #undef NOBARRIER_READ_BYTE_FIELD 6849 #undef NOBARRIER_READ_BYTE_FIELD
6850 #undef NOBARRIER_WRITE_BYTE_FIELD 6850 #undef NOBARRIER_WRITE_BYTE_FIELD
6851 6851
6852 } } // namespace v8::internal 6852 } } // namespace v8::internal
6853 6853
6854 #endif // V8_OBJECTS_INL_H_ 6854 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698