OLD | NEW |
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 return Handle<TYPE>(); \ | 189 return Handle<TYPE>(); \ |
190 } \ | 190 } \ |
191 } else { \ | 191 } else { \ |
192 return Handle<TYPE>(); \ | 192 return Handle<TYPE>(); \ |
193 } \ | 193 } \ |
194 } \ | 194 } \ |
195 return Handle<TYPE>(TYPE::cast(__object__)); \ | 195 return Handle<TYPE>(TYPE::cast(__object__)); \ |
196 } while (false) | 196 } while (false) |
197 | 197 |
198 | 198 |
| 199 // Don't use the following names: __object__, __failure__. |
| 200 #define CALL_HEAP_FUNCTION_VOID(FUNCTION_CALL) \ |
| 201 GC_GREEDY_CHECK(); \ |
| 202 Object* __object__ = FUNCTION_CALL; \ |
| 203 if (__object__->IsFailure()) { \ |
| 204 if (__object__->IsRetryAfterGC()) { \ |
| 205 Failure* __failure__ = Failure::cast(__object__); \ |
| 206 if (!Heap::CollectGarbage(__failure__->requested(), \ |
| 207 __failure__->allocation_space())) { \ |
| 208 /* TODO(1181417): Fix this. */ \ |
| 209 V8::FatalProcessOutOfMemory("Handles"); \ |
| 210 } \ |
| 211 __object__ = FUNCTION_CALL; \ |
| 212 if (__object__->IsFailure()) { \ |
| 213 if (__object__->IsRetryAfterGC()) { \ |
| 214 /* TODO(1181417): Fix this. */ \ |
| 215 V8::FatalProcessOutOfMemory("Handles"); \ |
| 216 } \ |
| 217 return; \ |
| 218 } \ |
| 219 } else { \ |
| 220 return; \ |
| 221 } \ |
| 222 } |
| 223 |
| 224 |
199 #ifdef DEBUG | 225 #ifdef DEBUG |
200 | 226 |
201 inline bool Heap::allow_allocation(bool new_state) { | 227 inline bool Heap::allow_allocation(bool new_state) { |
202 bool old = allocation_allowed_; | 228 bool old = allocation_allowed_; |
203 allocation_allowed_ = new_state; | 229 allocation_allowed_ = new_state; |
204 return old; | 230 return old; |
205 } | 231 } |
206 | 232 |
207 #endif | 233 #endif |
208 | 234 |
209 | 235 |
210 } } // namespace v8::internal | 236 } } // namespace v8::internal |
211 | 237 |
212 #endif // V8_HEAP_INL_H_ | 238 #endif // V8_HEAP_INL_H_ |
OLD | NEW |