| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 SCAN_ON_SCAVENGE, | 372 SCAN_ON_SCAVENGE, |
| 373 IN_FROM_SPACE, // Mutually exclusive with IN_TO_SPACE. | 373 IN_FROM_SPACE, // Mutually exclusive with IN_TO_SPACE. |
| 374 IN_TO_SPACE, // All pages in new space has one of these two set. | 374 IN_TO_SPACE, // All pages in new space has one of these two set. |
| 375 NEW_SPACE_BELOW_AGE_MARK, | 375 NEW_SPACE_BELOW_AGE_MARK, |
| 376 CONTAINS_ONLY_DATA, | 376 CONTAINS_ONLY_DATA, |
| 377 EVACUATION_CANDIDATE, | 377 EVACUATION_CANDIDATE, |
| 378 NUM_MEMORY_CHUNK_FLAGS | 378 NUM_MEMORY_CHUNK_FLAGS |
| 379 }; | 379 }; |
| 380 | 380 |
| 381 void SetFlag(int flag) { | 381 void SetFlag(int flag) { |
| 382 flags_ |= (1 << flag); | 382 flags_ |= static_cast<uintptr_t>(1) << flag; |
| 383 } | 383 } |
| 384 | 384 |
| 385 void ClearFlag(int flag) { | 385 void ClearFlag(int flag) { |
| 386 flags_ &= ~(1 << flag); | 386 flags_ &= ~(static_cast<uintptr_t>(1) << flag); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void SetFlagTo(int flag, bool value) { | 389 void SetFlagTo(int flag, bool value) { |
| 390 if (value) { | 390 if (value) { |
| 391 SetFlag(flag); | 391 SetFlag(flag); |
| 392 } else { | 392 } else { |
| 393 ClearFlag(flag); | 393 ClearFlag(flag); |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 | 396 |
| 397 bool IsFlagSet(int flag) { | 397 bool IsFlagSet(int flag) { |
| 398 return (flags_ & (1 << flag)) != 0; | 398 return (flags_ & (static_cast<uintptr_t>(1) << flag)) != 0; |
| 399 } | 399 } |
| 400 | 400 |
| 401 // Set or clear multiple flags at a time. The flags in the mask | 401 // Set or clear multiple flags at a time. The flags in the mask |
| 402 // are set to the value in "flags", the rest retain the current value | 402 // are set to the value in "flags", the rest retain the current value |
| 403 // in flags_. | 403 // in flags_. |
| 404 void SetFlags(intptr_t flags, intptr_t mask) { | 404 void SetFlags(intptr_t flags, intptr_t mask) { |
| 405 flags_ = (flags_ & ~mask) | (flags & mask); | 405 flags_ = (flags_ & ~mask) | (flags & mask); |
| 406 } | 406 } |
| 407 | 407 |
| 408 // Return all current flags. | 408 // Return all current flags. |
| 409 intptr_t GetFlags() { return flags_; } | 409 intptr_t GetFlags() { return flags_; } |
| 410 | 410 |
| 411 // Manage live byte count (count of bytes known to be live, | 411 // Manage live byte count (count of bytes known to be live, |
| 412 // because they are marked black). | 412 // because they are marked black). |
| 413 void ResetLiveBytes() { | 413 void ResetLiveBytes() { |
| 414 live_byte_count_ = 0; | 414 live_byte_count_ = 0; |
| 415 } | 415 } |
| 416 void IncrementLiveBytes(int by) { | 416 void IncrementLiveBytes(int by) { |
| 417 live_byte_count_ += by; | 417 live_byte_count_ += by; |
| 418 } | 418 } |
| 419 int LiveBytes() { return live_byte_count_; } | 419 int LiveBytes() { return live_byte_count_; } |
| 420 static void IncrementLiveBytes(Address address, int by) { | 420 static void IncrementLiveBytes(Address address, int by) { |
| 421 MemoryChunk::FromAddress(address)->IncrementLiveBytes(by); | 421 MemoryChunk::FromAddress(address)->IncrementLiveBytes(by); |
| 422 } | 422 } |
| 423 | 423 |
| 424 static const intptr_t kAlignment = (1 << kPageSizeBits); | 424 static const intptr_t kAlignment = |
| 425 (static_cast<uintptr_t>(1) << kPageSizeBits); |
| 425 | 426 |
| 426 static const intptr_t kAlignmentMask = kAlignment - 1; | 427 static const intptr_t kAlignmentMask = kAlignment - 1; |
| 427 | 428 |
| 428 static const intptr_t kLiveBytesOffset = | 429 static const intptr_t kLiveBytesOffset = |
| 429 kPointerSize + kPointerSize + kPointerSize + kPointerSize + | 430 kPointerSize + kPointerSize + kPointerSize + kPointerSize + |
| 430 kPointerSize + kPointerSize + kIntSize; | 431 kPointerSize + kPointerSize + kIntSize; |
| 431 | 432 |
| 432 static const size_t kHeaderSize = kLiveBytesOffset + kIntSize; | 433 static const size_t kHeaderSize = kLiveBytesOffset + kIntSize; |
| 433 | 434 |
| 434 static const int kBodyOffset = | 435 static const int kBodyOffset = |
| (...skipping 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2519 } | 2520 } |
| 2520 // Must be small, since an iteration is used for lookup. | 2521 // Must be small, since an iteration is used for lookup. |
| 2521 static const int kMaxComments = 64; | 2522 static const int kMaxComments = 64; |
| 2522 }; | 2523 }; |
| 2523 #endif | 2524 #endif |
| 2524 | 2525 |
| 2525 | 2526 |
| 2526 } } // namespace v8::internal | 2527 } } // namespace v8::internal |
| 2527 | 2528 |
| 2528 #endif // V8_SPACES_H_ | 2529 #endif // V8_SPACES_H_ |
| OLD | NEW |