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

Side by Side Diff: src/zone-inl.h

Issue 53089: Fixed test memory leaks (Closed)
Patch Set: Created 11 years, 9 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Check if the requested size is available without expanding. 43 // Check if the requested size is available without expanding.
44 Address result = position_; 44 Address result = position_;
45 if ((position_ += size) > limit_) result = NewExpand(size); 45 if ((position_ += size) > limit_) result = NewExpand(size);
46 46
47 // Check that the result has the proper alignment and return it. 47 // Check that the result has the proper alignment and return it.
48 ASSERT(IsAddressAligned(result, kAlignment, 0)); 48 ASSERT(IsAddressAligned(result, kAlignment, 0));
49 return reinterpret_cast<void*>(result); 49 return reinterpret_cast<void*>(result);
50 } 50 }
51 51
52 52
53 template <typename T>
54 T* Zone::NewArray(int length) {
55 return static_cast<T*>(Zone::New(length * sizeof(T)));
56 }
57
58
53 bool Zone::excess_allocation() { 59 bool Zone::excess_allocation() {
54 return segment_bytes_allocated_ > zone_excess_limit_; 60 return segment_bytes_allocated_ > zone_excess_limit_;
55 } 61 }
56 62
57 63
58 void Zone::adjust_segment_bytes_allocated(int delta) { 64 void Zone::adjust_segment_bytes_allocated(int delta) {
59 segment_bytes_allocated_ += delta; 65 segment_bytes_allocated_ += delta;
60 Counters::zone_segment_bytes.Set(segment_bytes_allocated_); 66 Counters::zone_segment_bytes.Set(segment_bytes_allocated_);
61 } 67 }
62 68
63 69
64 } } // namespace v8::internal 70 } } // namespace v8::internal
65 71
66 #endif // V8_ZONE_INL_H_ 72 #endif // V8_ZONE_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698