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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 // TODO(isolates): for performance reasons, this should be replaced with a new | 93 // TODO(isolates): for performance reasons, this should be replaced with a new |
94 // operator that takes the zone in which the object should be | 94 // operator that takes the zone in which the object should be |
95 // allocated. | 95 // allocated. |
96 void* ZoneObject::operator new(size_t size) { | 96 void* ZoneObject::operator new(size_t size) { |
97 return ZONE->New(static_cast<int>(size)); | 97 return ZONE->New(static_cast<int>(size)); |
98 } | 98 } |
99 | 99 |
| 100 void* ZoneObject::operator new(size_t size, Zone* zone) { |
| 101 return zone->New(static_cast<int>(size)); |
| 102 } |
| 103 |
100 | 104 |
101 inline void* ZoneListAllocationPolicy::New(int size) { | 105 inline void* ZoneListAllocationPolicy::New(int size) { |
102 return ZONE->New(size); | 106 return ZONE->New(size); |
103 } | 107 } |
104 | 108 |
105 | 109 |
106 ZoneScope::ZoneScope(ZoneScopeMode mode) | 110 ZoneScope::ZoneScope(ZoneScopeMode mode) |
107 : isolate_(Isolate::Current()), | 111 : isolate_(Isolate::Current()), |
108 mode_(mode) { | 112 mode_(mode) { |
109 isolate_->zone()->scope_nesting_++; | 113 isolate_->zone()->scope_nesting_++; |
110 } | 114 } |
111 | 115 |
112 | 116 |
113 bool ZoneScope::ShouldDeleteOnExit() { | 117 bool ZoneScope::ShouldDeleteOnExit() { |
114 return isolate_->zone()->scope_nesting_ == 1 && mode_ == DELETE_ON_EXIT; | 118 return isolate_->zone()->scope_nesting_ == 1 && mode_ == DELETE_ON_EXIT; |
115 } | 119 } |
116 | 120 |
117 | 121 |
118 int ZoneScope::nesting() { | 122 int ZoneScope::nesting() { |
119 return Isolate::Current()->zone()->scope_nesting_; | 123 return Isolate::Current()->zone()->scope_nesting_; |
120 } | 124 } |
121 | 125 |
122 | 126 |
123 } } // namespace v8::internal | 127 } } // namespace v8::internal |
124 | 128 |
125 #endif // V8_ZONE_INL_H_ | 129 #endif // V8_ZONE_INL_H_ |
OLD | NEW |