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

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

Issue 7859030: Trigger OOM when zone is full. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/zone.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 49
50 inline void* Zone::New(int size) { 50 inline void* Zone::New(int size) {
51 ASSERT(Isolate::Current()->zone_allow_allocation()); 51 ASSERT(Isolate::Current()->zone_allow_allocation());
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
59 if (size > limit_ - position_) {
60 result = NewExpand(size);
61 } else {
62 position_ += size;
63 }
59 64
60 // Check that the result has the proper alignment and return it. 65 // Check that the result has the proper alignment and return it.
61 ASSERT(IsAddressAligned(result, kAlignment, 0)); 66 ASSERT(IsAddressAligned(result, kAlignment, 0));
62 allocation_size_ += size; 67 allocation_size_ += size;
63 return reinterpret_cast<void*>(result); 68 return reinterpret_cast<void*>(result);
64 } 69 }
65 70
66 71
67 template <typename T> 72 template <typename T>
68 T* Zone::NewArray(int length) { 73 T* Zone::NewArray(int length) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 136
132 137
133 int ZoneScope::nesting() { 138 int ZoneScope::nesting() {
134 return Isolate::Current()->zone()->scope_nesting_; 139 return Isolate::Current()->zone()->scope_nesting_;
135 } 140 }
136 141
137 142
138 } } // namespace v8::internal 143 } } // namespace v8::internal
139 144
140 #endif // V8_ZONE_INL_H_ 145 #endif // V8_ZONE_INL_H_
OLDNEW
« no previous file with comments | « src/zone.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698