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

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 build on ia32. 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
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_)
danno 2012/06/01 11:29:24 nit: always use {}, even if the block is only one
110 return ZONE->New(size); 110 return zone_->New(size);
111 else
112 return ZONE->New(size);
danno 2012/06/01 11:29:24 same here.
111 } 113 }
112 114
113 115
114 template <typename T> 116 template <typename T>
115 void* ZoneList<T>::operator new(size_t size) { 117 void* ZoneList<T>::operator new(size_t size) {
116 return ZONE->New(static_cast<int>(size)); 118 return ZONE->New(static_cast<int>(size));
117 } 119 }
118 120
119 121
120 template <typename T> 122 template <typename T>
(...skipping 14 matching lines...) Expand all
135 137
136 138
137 int ZoneScope::nesting() { 139 int ZoneScope::nesting() {
138 return Isolate::Current()->zone()->scope_nesting_; 140 return Isolate::Current()->zone()->scope_nesting_;
139 } 141 }
140 142
141 143
142 } } // namespace v8::internal 144 } } // namespace v8::internal
143 145
144 #endif // V8_ZONE_INL_H_ 146 #endif // V8_ZONE_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698