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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 #elif defined(DEBUG) | 250 #elif defined(DEBUG) |
251 if (FLAG_heap_stats) ReportHeapStatistics("After GC"); | 251 if (FLAG_heap_stats) ReportHeapStatistics("After GC"); |
252 #elif defined(ENABLE_LOGGING_AND_PROFILING) | 252 #elif defined(ENABLE_LOGGING_AND_PROFILING) |
253 if (FLAG_log_gc) new_space_.ReportStatistics(); | 253 if (FLAG_log_gc) new_space_.ReportStatistics(); |
254 #endif | 254 #endif |
255 } | 255 } |
256 #endif // defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 256 #endif // defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
257 | 257 |
258 | 258 |
259 void Heap::GarbageCollectionPrologue() { | 259 void Heap::GarbageCollectionPrologue() { |
260 TranscendentalCache::Clear(); | |
260 gc_count_++; | 261 gc_count_++; |
261 #ifdef DEBUG | 262 #ifdef DEBUG |
262 ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); | 263 ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); |
263 allow_allocation(false); | 264 allow_allocation(false); |
264 | 265 |
265 if (FLAG_verify_heap) { | 266 if (FLAG_verify_heap) { |
266 Verify(); | 267 Verify(); |
267 } | 268 } |
268 | 269 |
269 if (FLAG_gc_verbose) Print(); | 270 if (FLAG_gc_verbose) Print(); |
(...skipping 3709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3979 | 3980 |
3980 #ifdef DEBUG | 3981 #ifdef DEBUG |
3981 bool Heap::GarbageCollectionGreedyCheck() { | 3982 bool Heap::GarbageCollectionGreedyCheck() { |
3982 ASSERT(FLAG_gc_greedy); | 3983 ASSERT(FLAG_gc_greedy); |
3983 if (Bootstrapper::IsActive()) return true; | 3984 if (Bootstrapper::IsActive()) return true; |
3984 if (disallow_allocation_failure()) return true; | 3985 if (disallow_allocation_failure()) return true; |
3985 return CollectGarbage(0, NEW_SPACE); | 3986 return CollectGarbage(0, NEW_SPACE); |
3986 } | 3987 } |
3987 #endif | 3988 #endif |
3988 | 3989 |
3990 | |
3991 TranscendentalCache::TranscendentalCache(TranscendentalCache::Type t) | |
3992 : type_(t) { | |
3993 uint32_t in0 = 0xffffffffu; // Bit-pattern for a NaN that isn't | |
3994 uint32_t in1 = 0xffffffffu; // generated by the FPU. | |
3995 for (int i = 0; i < kCacheSize; i++) { | |
Søren Thygesen Gjesse
2009/09/01 08:40:31
Would memcpy be faster here?
Erik Corry
2009/09/01 09:02:28
Possibly, but I don't expect this function to be c
| |
3996 elements_[i].in[0] = in0; | |
3997 elements_[i].in[1] = in1; | |
3998 elements_[i].output = NULL; | |
3999 } | |
4000 } | |
4001 | |
4002 | |
4003 TranscendentalCache* TranscendentalCache::caches_[kNumberOfCaches]; | |
4004 | |
4005 | |
4006 void TranscendentalCache::Clear() { | |
4007 for (int i = 0; i < kNumberOfCaches; i++) { | |
4008 if (caches_[i] != NULL) { | |
4009 delete caches_[i]; | |
4010 caches_[i] = NULL; | |
4011 } | |
4012 } | |
4013 } | |
4014 | |
4015 | |
3989 } } // namespace v8::internal | 4016 } } // namespace v8::internal |
OLD | NEW |