OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1961 // Size of objects alive after last GC. | 1961 // Size of objects alive after last GC. |
1962 static intptr_t alive_after_last_gc_; | 1962 static intptr_t alive_after_last_gc_; |
1963 | 1963 |
1964 static double last_gc_end_timestamp_; | 1964 static double last_gc_end_timestamp_; |
1965 }; | 1965 }; |
1966 | 1966 |
1967 | 1967 |
1968 class TranscendentalCache { | 1968 class TranscendentalCache { |
1969 public: | 1969 public: |
1970 enum Type {ACOS, ASIN, ATAN, COS, EXP, LOG, SIN, TAN, kNumberOfCaches}; | 1970 enum Type {ACOS, ASIN, ATAN, COS, EXP, LOG, SIN, TAN, kNumberOfCaches}; |
| 1971 static const int kTranscendentalTypeBits = 3; |
| 1972 STATIC_ASSERT((1 << kTranscendentalTypeBits) >= kNumberOfCaches); |
1971 | 1973 |
1972 explicit TranscendentalCache(Type t); | 1974 explicit TranscendentalCache(Type t); |
1973 | 1975 |
1974 // Returns a heap number with f(input), where f is a math function specified | 1976 // Returns a heap number with f(input), where f is a math function specified |
1975 // by the 'type' argument. | 1977 // by the 'type' argument. |
1976 MUST_USE_RESULT static inline MaybeObject* Get(Type type, double input) { | 1978 MUST_USE_RESULT static inline MaybeObject* Get(Type type, double input) { |
1977 TranscendentalCache* cache = caches_[type]; | 1979 TranscendentalCache* cache = caches_[type]; |
1978 if (cache == NULL) { | 1980 if (cache == NULL) { |
1979 caches_[type] = cache = new TranscendentalCache(type); | 1981 caches_[type] = cache = new TranscendentalCache(type); |
1980 } | 1982 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 // Return whether this object should be retained. If NULL is returned the | 2108 // Return whether this object should be retained. If NULL is returned the |
2107 // object has no references. Otherwise the address of the retained object | 2109 // object has no references. Otherwise the address of the retained object |
2108 // should be returned as in some GC situations the object has been moved. | 2110 // should be returned as in some GC situations the object has been moved. |
2109 virtual Object* RetainAs(Object* object) = 0; | 2111 virtual Object* RetainAs(Object* object) = 0; |
2110 }; | 2112 }; |
2111 | 2113 |
2112 | 2114 |
2113 } } // namespace v8::internal | 2115 } } // namespace v8::internal |
2114 | 2116 |
2115 #endif // V8_HEAP_H_ | 2117 #endif // V8_HEAP_H_ |
OLD | NEW |