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 intptr_t 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 | |
48 int Heap::MaxObjectSizeInPagedSpace() { | 38 int Heap::MaxObjectSizeInPagedSpace() { |
49 return Page::kMaxHeapObjectSize; | 39 return Page::kMaxHeapObjectSize; |
50 } | 40 } |
51 | 41 |
52 | 42 |
53 Object* Heap::AllocateSymbol(Vector<const char> str, | 43 Object* Heap::AllocateSymbol(Vector<const char> str, |
54 int chars, | 44 int chars, |
55 uint32_t hash_field) { | 45 uint32_t hash_field) { |
56 unibrow::Utf8InputBuffer<> buffer(str.start(), | 46 unibrow::Utf8InputBuffer<> buffer(str.start(), |
57 static_cast<unsigned>(str.length())); | 47 static_cast<unsigned>(str.length())); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 } \ | 404 } \ |
415 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ | 405 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
416 Heap::CollectGarbage(Failure::cast(__object__)->allocation_space()); \ | 406 Heap::CollectGarbage(Failure::cast(__object__)->allocation_space()); \ |
417 __object__ = FUNCTION_CALL; \ | 407 __object__ = FUNCTION_CALL; \ |
418 if (!__object__->IsFailure()) RETURN_VALUE; \ | 408 if (!__object__->IsFailure()) RETURN_VALUE; \ |
419 if (__object__->IsOutOfMemoryFailure()) { \ | 409 if (__object__->IsOutOfMemoryFailure()) { \ |
420 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1", true);\ | 410 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1", true);\ |
421 } \ | 411 } \ |
422 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ | 412 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
423 Counters::gc_last_resort_from_handles.Increment(); \ | 413 Counters::gc_last_resort_from_handles.Increment(); \ |
424 Heap::CollectAllAvailableGarbage(); \ | 414 Heap::CollectAllGarbage(false); \ |
425 { \ | 415 { \ |
426 AlwaysAllocateScope __scope__; \ | 416 AlwaysAllocateScope __scope__; \ |
427 __object__ = FUNCTION_CALL; \ | 417 __object__ = FUNCTION_CALL; \ |
428 } \ | 418 } \ |
429 if (!__object__->IsFailure()) RETURN_VALUE; \ | 419 if (!__object__->IsFailure()) RETURN_VALUE; \ |
430 if (__object__->IsOutOfMemoryFailure() || \ | 420 if (__object__->IsOutOfMemoryFailure() || \ |
431 __object__->IsRetryAfterGC()) { \ | 421 __object__->IsRetryAfterGC()) { \ |
432 /* TODO(1181417): Fix this. */ \ | 422 /* TODO(1181417): Fix this. */ \ |
433 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2", true);\ | 423 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2", true);\ |
434 } \ | 424 } \ |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 493 |
504 | 494 |
505 void ExternalStringTable::ShrinkNewStrings(int position) { | 495 void ExternalStringTable::ShrinkNewStrings(int position) { |
506 new_space_strings_.Rewind(position); | 496 new_space_strings_.Rewind(position); |
507 Verify(); | 497 Verify(); |
508 } | 498 } |
509 | 499 |
510 } } // namespace v8::internal | 500 } } // namespace v8::internal |
511 | 501 |
512 #endif // V8_HEAP_INL_H_ | 502 #endif // V8_HEAP_INL_H_ |
OLD | NEW |