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

Side by Side Diff: src/spaces.cc

Issue 316133002: Move atomic ops and related files to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 6 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/spaces.h ('k') | src/store-buffer.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/full-codegen.h" 7 #include "src/full-codegen.h"
8 #include "src/macro-assembler.h" 8 #include "src/macro-assembler.h"
9 #include "src/mark-compact.h" 9 #include "src/mark-compact.h"
10 #include "src/msan.h" 10 #include "src/msan.h"
(...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 } 2039 }
2040 2040
2041 2041
2042 void FreeListNode::set_next(FreeListNode* next) { 2042 void FreeListNode::set_next(FreeListNode* next) {
2043 ASSERT(IsFreeListNode(this)); 2043 ASSERT(IsFreeListNode(this));
2044 // While we are booting the VM the free space map will actually be null. So 2044 // While we are booting the VM the free space map will actually be null. So
2045 // we have to make sure that we don't try to use it for anything at that 2045 // we have to make sure that we don't try to use it for anything at that
2046 // stage. 2046 // stage.
2047 if (map() == GetHeap()->raw_unchecked_free_space_map()) { 2047 if (map() == GetHeap()->raw_unchecked_free_space_map()) {
2048 ASSERT(map() == NULL || Size() >= kNextOffset + kPointerSize); 2048 ASSERT(map() == NULL || Size() >= kNextOffset + kPointerSize);
2049 NoBarrier_Store(reinterpret_cast<AtomicWord*>(address() + kNextOffset), 2049 base::NoBarrier_Store(
2050 reinterpret_cast<AtomicWord>(next)); 2050 reinterpret_cast<base::AtomicWord*>(address() + kNextOffset),
2051 reinterpret_cast<base::AtomicWord>(next));
2051 } else { 2052 } else {
2052 NoBarrier_Store(reinterpret_cast<AtomicWord*>(address() + kPointerSize), 2053 base::NoBarrier_Store(
2053 reinterpret_cast<AtomicWord>(next)); 2054 reinterpret_cast<base::AtomicWord*>(address() + kPointerSize),
2055 reinterpret_cast<base::AtomicWord>(next));
2054 } 2056 }
2055 } 2057 }
2056 2058
2057 2059
2058 intptr_t FreeListCategory::Concatenate(FreeListCategory* category) { 2060 intptr_t FreeListCategory::Concatenate(FreeListCategory* category) {
2059 intptr_t free_bytes = 0; 2061 intptr_t free_bytes = 0;
2060 if (category->top() != NULL) { 2062 if (category->top() != NULL) {
2061 // This is safe (not going to deadlock) since Concatenate operations 2063 // This is safe (not going to deadlock) since Concatenate operations
2062 // are never performed on the same free lists at the same time in 2064 // are never performed on the same free lists at the same time in
2063 // reverse order. 2065 // reverse order.
2064 LockGuard<Mutex> target_lock_guard(mutex()); 2066 LockGuard<Mutex> target_lock_guard(mutex());
2065 LockGuard<Mutex> source_lock_guard(category->mutex()); 2067 LockGuard<Mutex> source_lock_guard(category->mutex());
2066 ASSERT(category->end_ != NULL); 2068 ASSERT(category->end_ != NULL);
2067 free_bytes = category->available(); 2069 free_bytes = category->available();
2068 if (end_ == NULL) { 2070 if (end_ == NULL) {
2069 end_ = category->end(); 2071 end_ = category->end();
2070 } else { 2072 } else {
2071 category->end()->set_next(top()); 2073 category->end()->set_next(top());
2072 } 2074 }
2073 set_top(category->top()); 2075 set_top(category->top());
2074 NoBarrier_Store(&top_, category->top_); 2076 base::NoBarrier_Store(&top_, category->top_);
2075 available_ += category->available(); 2077 available_ += category->available();
2076 category->Reset(); 2078 category->Reset();
2077 } 2079 }
2078 return free_bytes; 2080 return free_bytes;
2079 } 2081 }
2080 2082
2081 2083
2082 void FreeListCategory::Reset() { 2084 void FreeListCategory::Reset() {
2083 set_top(NULL); 2085 set_top(NULL);
2084 set_end(NULL); 2086 set_end(NULL);
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
3111 object->ShortPrint(); 3113 object->ShortPrint();
3112 PrintF("\n"); 3114 PrintF("\n");
3113 } 3115 }
3114 printf(" --------------------------------------\n"); 3116 printf(" --------------------------------------\n");
3115 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3117 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3116 } 3118 }
3117 3119
3118 #endif // DEBUG 3120 #endif // DEBUG
3119 3121
3120 } } // namespace v8::internal 3122 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | src/store-buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698