| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 if (first_word.IsForwardingAddress()) { | 323 if (first_word.IsForwardingAddress()) { |
| 324 *p = first_word.ToForwardingAddress(); | 324 *p = first_word.ToForwardingAddress(); |
| 325 return; | 325 return; |
| 326 } | 326 } |
| 327 | 327 |
| 328 // Call the slow part of scavenge object. | 328 // Call the slow part of scavenge object. |
| 329 return ScavengeObjectSlow(p, object); | 329 return ScavengeObjectSlow(p, object); |
| 330 } | 330 } |
| 331 | 331 |
| 332 | 332 |
| 333 bool Heap::CollectGarbage(AllocationSpace space) { |
| 334 return CollectGarbage(space, SelectGarbageCollector(space)); |
| 335 } |
| 336 |
| 337 |
| 333 MaybeObject* Heap::PrepareForCompare(String* str) { | 338 MaybeObject* Heap::PrepareForCompare(String* str) { |
| 334 // Always flatten small strings and force flattening of long strings | 339 // Always flatten small strings and force flattening of long strings |
| 335 // after we have accumulated a certain amount we failed to flatten. | 340 // after we have accumulated a certain amount we failed to flatten. |
| 336 static const int kMaxAlwaysFlattenLength = 32; | 341 static const int kMaxAlwaysFlattenLength = 32; |
| 337 static const int kFlattenLongThreshold = 16*KB; | 342 static const int kFlattenLongThreshold = 16*KB; |
| 338 | 343 |
| 339 const int length = str->length(); | 344 const int length = str->length(); |
| 340 MaybeObject* obj = str->TryFlatten(); | 345 MaybeObject* obj = str->TryFlatten(); |
| 341 if (length <= kMaxAlwaysFlattenLength || | 346 if (length <= kMaxAlwaysFlattenLength || |
| 342 unflattened_strings_length_ >= kFlattenLongThreshold) { | 347 unflattened_strings_length_ >= kFlattenLongThreshold) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 if (!__maybe_object__->IsRetryAfterGC()) RETURN_EMPTY; \ | 411 if (!__maybe_object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
| 407 Heap::CollectGarbage(Failure::cast(__maybe_object__)-> \ | 412 Heap::CollectGarbage(Failure::cast(__maybe_object__)-> \ |
| 408 allocation_space()); \ | 413 allocation_space()); \ |
| 409 __maybe_object__ = FUNCTION_CALL; \ | 414 __maybe_object__ = FUNCTION_CALL; \ |
| 410 if (__maybe_object__->ToObject(&__object__)) RETURN_VALUE; \ | 415 if (__maybe_object__->ToObject(&__object__)) RETURN_VALUE; \ |
| 411 if (__maybe_object__->IsOutOfMemory()) { \ | 416 if (__maybe_object__->IsOutOfMemory()) { \ |
| 412 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1", true);\ | 417 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1", true);\ |
| 413 } \ | 418 } \ |
| 414 if (!__maybe_object__->IsRetryAfterGC()) RETURN_EMPTY; \ | 419 if (!__maybe_object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
| 415 Counters::gc_last_resort_from_handles.Increment(); \ | 420 Counters::gc_last_resort_from_handles.Increment(); \ |
| 416 Heap::CollectAllGarbage(false); \ | 421 Heap::CollectAllAvailableGarbage(); \ |
| 417 { \ | 422 { \ |
| 418 AlwaysAllocateScope __scope__; \ | 423 AlwaysAllocateScope __scope__; \ |
| 419 __maybe_object__ = FUNCTION_CALL; \ | 424 __maybe_object__ = FUNCTION_CALL; \ |
| 420 } \ | 425 } \ |
| 421 if (__maybe_object__->ToObject(&__object__)) RETURN_VALUE; \ | 426 if (__maybe_object__->ToObject(&__object__)) RETURN_VALUE; \ |
| 422 if (__maybe_object__->IsOutOfMemory() || \ | 427 if (__maybe_object__->IsOutOfMemory() || \ |
| 423 __maybe_object__->IsRetryAfterGC()) { \ | 428 __maybe_object__->IsRetryAfterGC()) { \ |
| 424 /* TODO(1181417): Fix this. */ \ | 429 /* TODO(1181417): Fix this. */ \ |
| 425 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2", true);\ | 430 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2", true);\ |
| 426 } \ | 431 } \ |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 | 500 |
| 496 | 501 |
| 497 void ExternalStringTable::ShrinkNewStrings(int position) { | 502 void ExternalStringTable::ShrinkNewStrings(int position) { |
| 498 new_space_strings_.Rewind(position); | 503 new_space_strings_.Rewind(position); |
| 499 Verify(); | 504 Verify(); |
| 500 } | 505 } |
| 501 | 506 |
| 502 } } // namespace v8::internal | 507 } } // namespace v8::internal |
| 503 | 508 |
| 504 #endif // V8_HEAP_INL_H_ | 509 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |