| 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 17 matching lines...) Expand all Loading... |
| 28 #ifndef V8_HEAP_INL_H_ | 28 #ifndef V8_HEAP_INL_H_ |
| 29 #define V8_HEAP_INL_H_ | 29 #define V8_HEAP_INL_H_ |
| 30 | 30 |
| 31 #include "heap.h" | 31 #include "heap.h" |
| 32 #include "objects.h" | 32 #include "objects.h" |
| 33 #include "v8-counters.h" | 33 #include "v8-counters.h" |
| 34 | 34 |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace internal { | 36 namespace internal { |
| 37 | 37 |
| 38 void Heap::UpdateOldSpaceLimits() { |
| 39 int old_gen_size = PromotedSpaceSize(); |
| 40 old_gen_promotion_limit_ = |
| 41 old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3); |
| 42 old_gen_allocation_limit_ = |
| 43 old_gen_size + Max(kMinimumAllocationLimit, old_gen_size / 2); |
| 44 old_gen_exhausted_ = false; |
| 45 } |
| 46 |
| 47 |
| 38 int Heap::MaxObjectSizeInPagedSpace() { | 48 int Heap::MaxObjectSizeInPagedSpace() { |
| 39 return Page::kMaxHeapObjectSize; | 49 return Page::kMaxHeapObjectSize; |
| 40 } | 50 } |
| 41 | 51 |
| 42 | 52 |
| 43 Object* Heap::AllocateSymbol(Vector<const char> str, | 53 Object* Heap::AllocateSymbol(Vector<const char> str, |
| 44 int chars, | 54 int chars, |
| 45 uint32_t hash_field) { | 55 uint32_t hash_field) { |
| 46 unibrow::Utf8InputBuffer<> buffer(str.start(), | 56 unibrow::Utf8InputBuffer<> buffer(str.start(), |
| 47 static_cast<unsigned>(str.length())); | 57 static_cast<unsigned>(str.length())); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ | 406 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
| 397 Heap::CollectGarbage(Failure::cast(__object__)->requested(), \ | 407 Heap::CollectGarbage(Failure::cast(__object__)->requested(), \ |
| 398 Failure::cast(__object__)->allocation_space()); \ | 408 Failure::cast(__object__)->allocation_space()); \ |
| 399 __object__ = FUNCTION_CALL; \ | 409 __object__ = FUNCTION_CALL; \ |
| 400 if (!__object__->IsFailure()) RETURN_VALUE; \ | 410 if (!__object__->IsFailure()) RETURN_VALUE; \ |
| 401 if (__object__->IsOutOfMemoryFailure()) { \ | 411 if (__object__->IsOutOfMemoryFailure()) { \ |
| 402 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1", true);\ | 412 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1", true);\ |
| 403 } \ | 413 } \ |
| 404 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ | 414 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
| 405 Counters::gc_last_resort_from_handles.Increment(); \ | 415 Counters::gc_last_resort_from_handles.Increment(); \ |
| 406 Heap::CollectAllGarbage(false); \ | 416 Heap::CollectAllAvailableGarbage(); \ |
| 407 { \ | 417 { \ |
| 408 AlwaysAllocateScope __scope__; \ | 418 AlwaysAllocateScope __scope__; \ |
| 409 __object__ = FUNCTION_CALL; \ | 419 __object__ = FUNCTION_CALL; \ |
| 410 } \ | 420 } \ |
| 411 if (!__object__->IsFailure()) RETURN_VALUE; \ | 421 if (!__object__->IsFailure()) RETURN_VALUE; \ |
| 412 if (__object__->IsOutOfMemoryFailure() || \ | 422 if (__object__->IsOutOfMemoryFailure() || \ |
| 413 __object__->IsRetryAfterGC()) { \ | 423 __object__->IsRetryAfterGC()) { \ |
| 414 /* TODO(1181417): Fix this. */ \ | 424 /* TODO(1181417): Fix this. */ \ |
| 415 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2", true);\ | 425 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2", true);\ |
| 416 } \ | 426 } \ |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 | 495 |
| 486 | 496 |
| 487 void ExternalStringTable::ShrinkNewStrings(int position) { | 497 void ExternalStringTable::ShrinkNewStrings(int position) { |
| 488 new_space_strings_.Rewind(position); | 498 new_space_strings_.Rewind(position); |
| 489 Verify(); | 499 Verify(); |
| 490 } | 500 } |
| 491 | 501 |
| 492 } } // namespace v8::internal | 502 } } // namespace v8::internal |
| 493 | 503 |
| 494 #endif // V8_HEAP_INL_H_ | 504 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |