| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) { | 100 void* ZoneObject::operator new(size_t size, Zone* zone) { |
| 101 return zone->New(static_cast<int>(size)); | 101 return zone->New(static_cast<int>(size)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 | 104 |
| 105 inline void* ZoneListAllocationPolicy::New(int size) { | 105 void* ZoneListAllocationPolicy::New(int size) { |
| 106 return ZONE->New(size); | 106 return ZONE->New(size); |
| 107 } | 107 } |
| 108 | 108 |
| 109 | 109 |
| 110 template <typename T> |
| 111 void* ZoneList<T>::operator new(size_t size) { |
| 112 return ZONE->New(static_cast<int>(size)); |
| 113 } |
| 114 |
| 115 |
| 116 template <typename T> |
| 117 void* ZoneList<T>::operator new(size_t size, Zone* zone) { |
| 118 return zone->New(static_cast<int>(size)); |
| 119 } |
| 120 |
| 121 |
| 110 ZoneScope::ZoneScope(ZoneScopeMode mode) | 122 ZoneScope::ZoneScope(ZoneScopeMode mode) |
| 111 : isolate_(Isolate::Current()), | 123 : isolate_(Isolate::Current()), |
| 112 mode_(mode) { | 124 mode_(mode) { |
| 113 isolate_->zone()->scope_nesting_++; | 125 isolate_->zone()->scope_nesting_++; |
| 114 } | 126 } |
| 115 | 127 |
| 116 | 128 |
| 117 bool ZoneScope::ShouldDeleteOnExit() { | 129 bool ZoneScope::ShouldDeleteOnExit() { |
| 118 return isolate_->zone()->scope_nesting_ == 1 && mode_ == DELETE_ON_EXIT; | 130 return isolate_->zone()->scope_nesting_ == 1 && mode_ == DELETE_ON_EXIT; |
| 119 } | 131 } |
| 120 | 132 |
| 121 | 133 |
| 122 int ZoneScope::nesting() { | 134 int ZoneScope::nesting() { |
| 123 return Isolate::Current()->zone()->scope_nesting_; | 135 return Isolate::Current()->zone()->scope_nesting_; |
| 124 } | 136 } |
| 125 | 137 |
| 126 | 138 |
| 127 } } // namespace v8::internal | 139 } } // namespace v8::internal |
| 128 | 140 |
| 129 #endif // V8_ZONE_INL_H_ | 141 #endif // V8_ZONE_INL_H_ |
| OLD | NEW |