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