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

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

Issue 10443114: Progress towards making Zones independent of Isolates and Threads. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix nits and rebase on current bleeding_edge Created 8 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/zone.h ('k') | test/cctest/test-list.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 // 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 segment_bytes_allocated_ += delta; 83 segment_bytes_allocated_ += delta;
84 isolate_->counters()->zone_segment_bytes()->Set(segment_bytes_allocated_); 84 isolate_->counters()->zone_segment_bytes()->Set(segment_bytes_allocated_);
85 } 85 }
86 86
87 87
88 template <typename Config> 88 template <typename Config>
89 ZoneSplayTree<Config>::~ZoneSplayTree() { 89 ZoneSplayTree<Config>::~ZoneSplayTree() {
90 // Reset the root to avoid unneeded iteration over all tree nodes 90 // Reset the root to avoid unneeded iteration over all tree nodes
91 // in the destructor. For a zone-allocated tree, nodes will be 91 // in the destructor. For a zone-allocated tree, nodes will be
92 // freed by the Zone. 92 // freed by the Zone.
93 SplayTree<Config, ZoneListAllocationPolicy>::ResetRoot(); 93 SplayTree<Config, ZoneAllocationPolicy>::ResetRoot();
94 } 94 }
95 95
96 96
97 // TODO(isolates): for performance reasons, this should be replaced with a new 97 // TODO(isolates): for performance reasons, this should be replaced with a new
98 // operator that takes the zone in which the object should be 98 // operator that takes the zone in which the object should be
99 // allocated. 99 // allocated.
100 void* ZoneObject::operator new(size_t size) { 100 void* ZoneObject::operator new(size_t size) {
101 return ZONE->New(static_cast<int>(size)); 101 return ZONE->New(static_cast<int>(size));
102 } 102 }
103 103
104 void* ZoneObject::operator new(size_t size, Zone* zone) { 104 void* ZoneObject::operator new(size_t size, Zone* zone) {
105 return zone->New(static_cast<int>(size)); 105 return zone->New(static_cast<int>(size));
106 } 106 }
107 107
108 108 inline void* ZoneAllocationPolicy::New(size_t size) {
109 inline void* ZoneListAllocationPolicy::New(int size) { 109 if (zone_) {
110 return ZONE->New(size); 110 return zone_->New(size);
111 } else {
112 return ZONE->New(size);
113 }
111 } 114 }
112 115
113 116
114 template <typename T> 117 template <typename T>
115 void* ZoneList<T>::operator new(size_t size) { 118 void* ZoneList<T>::operator new(size_t size) {
116 return ZONE->New(static_cast<int>(size)); 119 return ZONE->New(static_cast<int>(size));
117 } 120 }
118 121
119 122
120 template <typename T> 123 template <typename T>
(...skipping 14 matching lines...) Expand all
135 138
136 139
137 int ZoneScope::nesting() { 140 int ZoneScope::nesting() {
138 return Isolate::Current()->zone()->scope_nesting_; 141 return Isolate::Current()->zone()->scope_nesting_;
139 } 142 }
140 143
141 144
142 } } // namespace v8::internal 145 } } // namespace v8::internal
143 146
144 #endif // V8_ZONE_INL_H_ 147 #endif // V8_ZONE_INL_H_
OLDNEW
« no previous file with comments | « src/zone.h ('k') | test/cctest/test-list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698