| 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 | |
| 104 | 100 |
| 105 inline void* ZoneListAllocationPolicy::New(int size) { | 101 inline void* ZoneListAllocationPolicy::New(int size) { |
| 106 return ZONE->New(size); | 102 return ZONE->New(size); |
| 107 } | 103 } |
| 108 | 104 |
| 109 | 105 |
| 110 ZoneScope::ZoneScope(ZoneScopeMode mode) | 106 ZoneScope::ZoneScope(ZoneScopeMode mode) |
| 111 : isolate_(Isolate::Current()), | 107 : isolate_(Isolate::Current()), |
| 112 mode_(mode) { | 108 mode_(mode) { |
| 113 isolate_->zone()->scope_nesting_++; | 109 isolate_->zone()->scope_nesting_++; |
| 114 } | 110 } |
| 115 | 111 |
| 116 | 112 |
| 117 bool ZoneScope::ShouldDeleteOnExit() { | 113 bool ZoneScope::ShouldDeleteOnExit() { |
| 118 return isolate_->zone()->scope_nesting_ == 1 && mode_ == DELETE_ON_EXIT; | 114 return isolate_->zone()->scope_nesting_ == 1 && mode_ == DELETE_ON_EXIT; |
| 119 } | 115 } |
| 120 | 116 |
| 121 | 117 |
| 122 int ZoneScope::nesting() { | 118 int ZoneScope::nesting() { |
| 123 return Isolate::Current()->zone()->scope_nesting_; | 119 return Isolate::Current()->zone()->scope_nesting_; |
| 124 } | 120 } |
| 125 | 121 |
| 126 | 122 |
| 127 } } // namespace v8::internal | 123 } } // namespace v8::internal |
| 128 | 124 |
| 129 #endif // V8_ZONE_INL_H_ | 125 #endif // V8_ZONE_INL_H_ |
| OLD | NEW |