| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 #elif defined(DEBUG) | 317 #elif defined(DEBUG) |
| 318 if (FLAG_heap_stats) ReportHeapStatistics("After GC"); | 318 if (FLAG_heap_stats) ReportHeapStatistics("After GC"); |
| 319 #elif defined(ENABLE_LOGGING_AND_PROFILING) | 319 #elif defined(ENABLE_LOGGING_AND_PROFILING) |
| 320 if (FLAG_log_gc) new_space_.ReportStatistics(); | 320 if (FLAG_log_gc) new_space_.ReportStatistics(); |
| 321 #endif | 321 #endif |
| 322 } | 322 } |
| 323 #endif // defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 323 #endif // defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
| 324 | 324 |
| 325 | 325 |
| 326 void Heap::GarbageCollectionPrologue() { | 326 void Heap::GarbageCollectionPrologue() { |
| 327 TranscendentalCache::Clear(); | 327 Isolate::Current()->transcendental_cache()->Clear(); |
| 328 ClearJSFunctionResultCaches(); | 328 ClearJSFunctionResultCaches(); |
| 329 gc_count_++; | 329 gc_count_++; |
| 330 unflattened_strings_length_ = 0; | 330 unflattened_strings_length_ = 0; |
| 331 #ifdef DEBUG | 331 #ifdef DEBUG |
| 332 ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); | 332 ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); |
| 333 allow_allocation(false); | 333 allow_allocation(false); |
| 334 | 334 |
| 335 if (FLAG_verify_heap) { | 335 if (FLAG_verify_heap) { |
| 336 Verify(); | 336 Verify(); |
| 337 } | 337 } |
| (...skipping 4375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4713 #ifdef DEBUG | 4713 #ifdef DEBUG |
| 4714 bool Heap::GarbageCollectionGreedyCheck() { | 4714 bool Heap::GarbageCollectionGreedyCheck() { |
| 4715 ASSERT(FLAG_gc_greedy); | 4715 ASSERT(FLAG_gc_greedy); |
| 4716 if (Bootstrapper::IsActive()) return true; | 4716 if (Bootstrapper::IsActive()) return true; |
| 4717 if (disallow_allocation_failure()) return true; | 4717 if (disallow_allocation_failure()) return true; |
| 4718 return CollectGarbage(0, NEW_SPACE); | 4718 return CollectGarbage(0, NEW_SPACE); |
| 4719 } | 4719 } |
| 4720 #endif | 4720 #endif |
| 4721 | 4721 |
| 4722 | 4722 |
| 4723 TranscendentalCache::TranscendentalCache(TranscendentalCache::Type t) | 4723 TranscendentalCache::SubCache::SubCache(Type t) |
| 4724 : type_(t), | 4724 : type_(t), |
| 4725 heap_(HEAP) { | 4725 heap_(HEAP) { |
| 4726 uint32_t in0 = 0xffffffffu; // Bit-pattern for a NaN that isn't | 4726 uint32_t in0 = 0xffffffffu; // Bit-pattern for a NaN that isn't |
| 4727 uint32_t in1 = 0xffffffffu; // generated by the FPU. | 4727 uint32_t in1 = 0xffffffffu; // generated by the FPU. |
| 4728 for (int i = 0; i < kCacheSize; i++) { | 4728 for (int i = 0; i < kCacheSize; i++) { |
| 4729 elements_[i].in[0] = in0; | 4729 elements_[i].in[0] = in0; |
| 4730 elements_[i].in[1] = in1; | 4730 elements_[i].in[1] = in1; |
| 4731 elements_[i].output = NULL; | 4731 elements_[i].output = NULL; |
| 4732 } | 4732 } |
| 4733 } | 4733 } |
| 4734 | 4734 |
| 4735 | 4735 |
| 4736 TranscendentalCache* TranscendentalCache::caches_[kNumberOfCaches]; | |
| 4737 | |
| 4738 | |
| 4739 void TranscendentalCache::Clear() { | 4736 void TranscendentalCache::Clear() { |
| 4740 for (int i = 0; i < kNumberOfCaches; i++) { | 4737 for (int i = 0; i < kNumberOfCaches; i++) { |
| 4741 if (caches_[i] != NULL) { | 4738 if (caches_[i] != NULL) { |
| 4742 delete caches_[i]; | 4739 delete caches_[i]; |
| 4743 caches_[i] = NULL; | 4740 caches_[i] = NULL; |
| 4744 } | 4741 } |
| 4745 } | 4742 } |
| 4746 } | 4743 } |
| 4747 | 4744 |
| 4748 | 4745 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4771 void ExternalStringTable::TearDown() { | 4768 void ExternalStringTable::TearDown() { |
| 4772 new_space_strings_.Free(); | 4769 new_space_strings_.Free(); |
| 4773 old_space_strings_.Free(); | 4770 old_space_strings_.Free(); |
| 4774 } | 4771 } |
| 4775 | 4772 |
| 4776 | 4773 |
| 4777 List<Object*> ExternalStringTable::new_space_strings_; | 4774 List<Object*> ExternalStringTable::new_space_strings_; |
| 4778 List<Object*> ExternalStringTable::old_space_strings_; | 4775 List<Object*> ExternalStringTable::old_space_strings_; |
| 4779 | 4776 |
| 4780 } } // namespace v8::internal | 4777 } } // namespace v8::internal |
| OLD | NEW |