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 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2036 } | 2036 } |
2037 | 2037 |
2038 | 2038 |
2039 intptr_t FreeListCategory::Concatenate(FreeListCategory* category) { | 2039 intptr_t FreeListCategory::Concatenate(FreeListCategory* category) { |
2040 intptr_t free_bytes = 0; | 2040 intptr_t free_bytes = 0; |
2041 if (category->top_ != NULL) { | 2041 if (category->top_ != NULL) { |
2042 ASSERT(category->end_ != NULL); | 2042 ASSERT(category->end_ != NULL); |
2043 // This is safe (not going to deadlock) since Concatenate operations | 2043 // This is safe (not going to deadlock) since Concatenate operations |
2044 // are never performed on the same free lists at the same time in | 2044 // are never performed on the same free lists at the same time in |
2045 // reverse order. | 2045 // reverse order. |
2046 ScopedLock lock_target(mutex_); | 2046 LockGuard<Mutex> target_lock_guard(mutex()); |
2047 ScopedLock lock_source(category->mutex()); | 2047 LockGuard<Mutex> source_lock_guard(category->mutex()); |
2048 free_bytes = category->available(); | 2048 free_bytes = category->available(); |
2049 if (end_ == NULL) { | 2049 if (end_ == NULL) { |
2050 end_ = category->end(); | 2050 end_ = category->end(); |
2051 } else { | 2051 } else { |
2052 category->end()->set_next(top_); | 2052 category->end()->set_next(top_); |
2053 } | 2053 } |
2054 top_ = category->top(); | 2054 top_ = category->top(); |
2055 available_ += category->available(); | 2055 available_ += category->available(); |
2056 category->Reset(); | 2056 category->Reset(); |
2057 } | 2057 } |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3204 object->ShortPrint(); | 3204 object->ShortPrint(); |
3205 PrintF("\n"); | 3205 PrintF("\n"); |
3206 } | 3206 } |
3207 printf(" --------------------------------------\n"); | 3207 printf(" --------------------------------------\n"); |
3208 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3208 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3209 } | 3209 } |
3210 | 3210 |
3211 #endif // DEBUG | 3211 #endif // DEBUG |
3212 | 3212 |
3213 } } // namespace v8::internal | 3213 } } // namespace v8::internal |
OLD | NEW |