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 2863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2874 MUST_USE_RESULT inline MaybeObject* Get(Type type, double input); | 2874 MUST_USE_RESULT inline MaybeObject* Get(Type type, double input); |
2875 | 2875 |
2876 // The cache contains raw Object pointers. This method disposes of | 2876 // The cache contains raw Object pointers. This method disposes of |
2877 // them before a garbage collection. | 2877 // them before a garbage collection. |
2878 void Clear(); | 2878 void Clear(); |
2879 | 2879 |
2880 private: | 2880 private: |
2881 class SubCache { | 2881 class SubCache { |
2882 static const int kCacheSize = 512; | 2882 static const int kCacheSize = 512; |
2883 | 2883 |
2884 explicit SubCache(Type t); | 2884 explicit SubCache(Isolate* isolate, Type t); |
2885 | 2885 |
2886 MUST_USE_RESULT inline MaybeObject* Get(double input); | 2886 MUST_USE_RESULT inline MaybeObject* Get(double input); |
2887 | 2887 |
2888 inline double Calculate(double input); | 2888 inline double Calculate(double input); |
2889 | 2889 |
2890 struct Element { | 2890 struct Element { |
2891 uint32_t in[2]; | 2891 uint32_t in[2]; |
2892 Object* output; | 2892 Object* output; |
2893 }; | 2893 }; |
2894 | 2894 |
(...skipping 16 matching lines...) Expand all Loading... |
2911 // Allow access to the caches_ array as an ExternalReference. | 2911 // Allow access to the caches_ array as an ExternalReference. |
2912 friend class ExternalReference; | 2912 friend class ExternalReference; |
2913 // Inline implementation of the cache. | 2913 // Inline implementation of the cache. |
2914 friend class TranscendentalCacheStub; | 2914 friend class TranscendentalCacheStub; |
2915 // For evaluating value. | 2915 // For evaluating value. |
2916 friend class TranscendentalCache; | 2916 friend class TranscendentalCache; |
2917 | 2917 |
2918 DISALLOW_COPY_AND_ASSIGN(SubCache); | 2918 DISALLOW_COPY_AND_ASSIGN(SubCache); |
2919 }; | 2919 }; |
2920 | 2920 |
2921 TranscendentalCache() { | 2921 explicit TranscendentalCache(Isolate* isolate) : isolate_(isolate) { |
2922 for (int i = 0; i < kNumberOfCaches; ++i) caches_[i] = NULL; | 2922 for (int i = 0; i < kNumberOfCaches; ++i) caches_[i] = NULL; |
2923 } | 2923 } |
2924 | 2924 |
2925 ~TranscendentalCache() { | 2925 ~TranscendentalCache() { |
2926 for (int i = 0; i < kNumberOfCaches; ++i) delete caches_[i]; | 2926 for (int i = 0; i < kNumberOfCaches; ++i) delete caches_[i]; |
2927 } | 2927 } |
2928 | 2928 |
2929 // Used to create an external reference. | 2929 // Used to create an external reference. |
2930 inline Address cache_array_address(); | 2930 inline Address cache_array_address(); |
2931 | 2931 |
2932 // Instantiation | 2932 // Instantiation |
2933 friend class Isolate; | 2933 friend class Isolate; |
2934 // Inline implementation of the caching. | 2934 // Inline implementation of the caching. |
2935 friend class TranscendentalCacheStub; | 2935 friend class TranscendentalCacheStub; |
2936 // Allow access to the caches_ array as an ExternalReference. | 2936 // Allow access to the caches_ array as an ExternalReference. |
2937 friend class ExternalReference; | 2937 friend class ExternalReference; |
2938 | 2938 |
| 2939 Isolate* isolate_; |
2939 SubCache* caches_[kNumberOfCaches]; | 2940 SubCache* caches_[kNumberOfCaches]; |
2940 DISALLOW_COPY_AND_ASSIGN(TranscendentalCache); | 2941 DISALLOW_COPY_AND_ASSIGN(TranscendentalCache); |
2941 }; | 2942 }; |
2942 | 2943 |
2943 | 2944 |
2944 // Abstract base class for checking whether a weak object should be retained. | 2945 // Abstract base class for checking whether a weak object should be retained. |
2945 class WeakObjectRetainer { | 2946 class WeakObjectRetainer { |
2946 public: | 2947 public: |
2947 virtual ~WeakObjectRetainer() {} | 2948 virtual ~WeakObjectRetainer() {} |
2948 | 2949 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3048 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3049 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
3049 | 3050 |
3050 private: | 3051 private: |
3051 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3052 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
3052 }; | 3053 }; |
3053 #endif // DEBUG | 3054 #endif // DEBUG |
3054 | 3055 |
3055 } } // namespace v8::internal | 3056 } } // namespace v8::internal |
3056 | 3057 |
3057 #endif // V8_HEAP_H_ | 3058 #endif // V8_HEAP_H_ |
OLD | NEW |