| OLD | NEW |
| 1 // Copyright 2006-2008 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 ASSERT(ZoneScope::nesting() > 0); | 52 ASSERT(ZoneScope::nesting() > 0); |
| 53 // Round up the requested size to fit the alignment. | 53 // Round up the requested size to fit the alignment. |
| 54 size = RoundUp(size, kAlignment); | 54 size = RoundUp(size, kAlignment); |
| 55 | 55 |
| 56 // Check if the requested size is available without expanding. | 56 // Check if the requested size is available without expanding. |
| 57 Address result = position_; | 57 Address result = position_; |
| 58 if ((position_ += size) > limit_) result = NewExpand(size); | 58 if ((position_ += size) > limit_) result = NewExpand(size); |
| 59 | 59 |
| 60 // Check that the result has the proper alignment and return it. | 60 // Check that the result has the proper alignment and return it. |
| 61 ASSERT(IsAddressAligned(result, kAlignment, 0)); | 61 ASSERT(IsAddressAligned(result, kAlignment, 0)); |
| 62 allocation_size_ += size; |
| 62 return reinterpret_cast<void*>(result); | 63 return reinterpret_cast<void*>(result); |
| 63 } | 64 } |
| 64 | 65 |
| 65 | 66 |
| 66 template <typename T> | 67 template <typename T> |
| 67 T* Zone::NewArray(int length) { | 68 T* Zone::NewArray(int length) { |
| 68 return static_cast<T*>(New(length * sizeof(T))); | 69 return static_cast<T*>(New(length * sizeof(T))); |
| 69 } | 70 } |
| 70 | 71 |
| 71 | 72 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 116 |
| 116 | 117 |
| 117 int ZoneScope::nesting() { | 118 int ZoneScope::nesting() { |
| 118 return Isolate::Current()->zone()->scope_nesting_; | 119 return Isolate::Current()->zone()->scope_nesting_; |
| 119 } | 120 } |
| 120 | 121 |
| 121 | 122 |
| 122 } } // namespace v8::internal | 123 } } // namespace v8::internal |
| 123 | 124 |
| 124 #endif // V8_ZONE_INL_H_ | 125 #endif // V8_ZONE_INL_H_ |
| OLD | NEW |