Chromium Code Reviews| Index: src/heap.cc |
| =================================================================== |
| --- src/heap.cc (revision 2785) |
| +++ src/heap.cc (working copy) |
| @@ -257,6 +257,7 @@ |
| void Heap::GarbageCollectionPrologue() { |
| + TranscendentalCache::Clear(); |
| gc_count_++; |
| #ifdef DEBUG |
| ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); |
| @@ -3986,4 +3987,30 @@ |
| } |
| #endif |
| + |
| +TranscendentalCache::TranscendentalCache(TranscendentalCache::Type t) |
| + : type_(t) { |
| + uint32_t in0 = 0xffffffffu; // Bit-pattern for a NaN that isn't |
| + uint32_t in1 = 0xffffffffu; // generated by the FPU. |
| + 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
|
| + elements_[i].in[0] = in0; |
| + elements_[i].in[1] = in1; |
| + elements_[i].output = NULL; |
| + } |
| +} |
| + |
| + |
| +TranscendentalCache* TranscendentalCache::caches_[kNumberOfCaches]; |
| + |
| + |
| +void TranscendentalCache::Clear() { |
| + for (int i = 0; i < kNumberOfCaches; i++) { |
| + if (caches_[i] != NULL) { |
| + delete caches_[i]; |
| + caches_[i] = NULL; |
| + } |
| + } |
| +} |
| + |
| + |
| } } // namespace v8::internal |