| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 } | 543 } |
| 544 intptr_t amount_since_last_global_gc = PromotedExternalMemorySize(); | 544 intptr_t amount_since_last_global_gc = PromotedExternalMemorySize(); |
| 545 if (amount_since_last_global_gc > external_allocation_limit_) { | 545 if (amount_since_last_global_gc > external_allocation_limit_) { |
| 546 CollectAllGarbage(kNoGCFlags, "external memory allocation limit reached"); | 546 CollectAllGarbage(kNoGCFlags, "external memory allocation limit reached"); |
| 547 } | 547 } |
| 548 } else { | 548 } else { |
| 549 // Avoid underflow. | 549 // Avoid underflow. |
| 550 if (amount >= 0) { | 550 if (amount >= 0) { |
| 551 amount_of_external_allocated_memory_ = amount; | 551 amount_of_external_allocated_memory_ = amount; |
| 552 } else { | 552 } else { |
| 553 // Give up and reset the counters in case of an overflow. | 553 // Give up and reset the counters in case of an underflow. |
| 554 amount_of_external_allocated_memory_ = 0; | 554 amount_of_external_allocated_memory_ = 0; |
| 555 amount_of_external_allocated_memory_at_last_global_gc_ = 0; | 555 amount_of_external_allocated_memory_at_last_global_gc_ = 0; |
| 556 } | 556 } |
| 557 } | 557 } |
| 558 if (FLAG_trace_external_memory) { | 558 if (FLAG_trace_external_memory) { |
| 559 PrintPID("%8.0f ms: ", isolate()->time_millis_since_init()); | 559 PrintPID("%8.0f ms: ", isolate()->time_millis_since_init()); |
| 560 PrintF("Adjust amount of external memory: delta=%6" V8_PTR_PREFIX "d KB, " | 560 PrintF("Adjust amount of external memory: delta=%6" V8_PTR_PREFIX "d KB, " |
| 561 " amount=%6" V8_PTR_PREFIX "d KB, isolate=0x%08" V8PRIxPTR ".\n", | 561 "amount=%6" V8_PTR_PREFIX "d KB, since_gc=%6" V8_PTR_PREFIX "d KB, " |
| 562 change_in_bytes / 1024, amount_of_external_allocated_memory_ / 1024, | 562 "isolate=0x%08" V8PRIxPTR ".\n", |
| 563 change_in_bytes / KB, |
| 564 amount_of_external_allocated_memory_ / KB, |
| 565 PromotedExternalMemorySize() / KB, |
| 563 reinterpret_cast<intptr_t>(isolate())); | 566 reinterpret_cast<intptr_t>(isolate())); |
| 564 } | 567 } |
| 565 ASSERT(amount_of_external_allocated_memory_ >= 0); | 568 ASSERT(amount_of_external_allocated_memory_ >= 0); |
| 566 return amount_of_external_allocated_memory_; | 569 return amount_of_external_allocated_memory_; |
| 567 } | 570 } |
| 568 | 571 |
| 569 | 572 |
| 570 void Heap::SetLastScriptId(Object* last_script_id) { | 573 void Heap::SetLastScriptId(Object* last_script_id) { |
| 571 roots_[kLastScriptIdRootIndex] = last_script_id; | 574 roots_[kLastScriptIdRootIndex] = last_script_id; |
| 572 } | 575 } |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 DisallowAllocationFailure::~DisallowAllocationFailure() { | 865 DisallowAllocationFailure::~DisallowAllocationFailure() { |
| 863 #ifdef DEBUG | 866 #ifdef DEBUG |
| 864 HEAP->disallow_allocation_failure_ = old_state_; | 867 HEAP->disallow_allocation_failure_ = old_state_; |
| 865 #endif | 868 #endif |
| 866 } | 869 } |
| 867 | 870 |
| 868 | 871 |
| 869 } } // namespace v8::internal | 872 } } // namespace v8::internal |
| 870 | 873 |
| 871 #endif // V8_HEAP_INL_H_ | 874 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |