OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // this class as a base class. A sub-cache contains a compilation cache tables | 56 // this class as a base class. A sub-cache contains a compilation cache tables |
57 // for each generation of the sub-cache. As the same source code string has | 57 // for each generation of the sub-cache. As the same source code string has |
58 // different compiled code for scripts and evals. Internally, we use separate | 58 // different compiled code for scripts and evals. Internally, we use separate |
59 // sub-caches to avoid getting the wrong kind of result when looking up. | 59 // sub-caches to avoid getting the wrong kind of result when looking up. |
60 class CompilationSubCache { | 60 class CompilationSubCache { |
61 public: | 61 public: |
62 explicit CompilationSubCache(int generations): generations_(generations) { | 62 explicit CompilationSubCache(int generations): generations_(generations) { |
63 tables_ = NewArray<Object*>(generations); | 63 tables_ = NewArray<Object*>(generations); |
64 } | 64 } |
65 | 65 |
| 66 ~CompilationSubCache() { DeleteArray(tables_); } |
| 67 |
66 // Get the compilation cache tables for a specific generation. | 68 // Get the compilation cache tables for a specific generation. |
67 Handle<CompilationCacheTable> GetTable(int generation); | 69 Handle<CompilationCacheTable> GetTable(int generation); |
68 | 70 |
69 // Age the sub-cache by evicting the oldest generation and creating a new | 71 // Age the sub-cache by evicting the oldest generation and creating a new |
70 // young generation. | 72 // young generation. |
71 void Age(); | 73 void Age(); |
72 | 74 |
73 // GC support. | 75 // GC support. |
74 void Iterate(ObjectVisitor* v); | 76 void Iterate(ObjectVisitor* v); |
75 | 77 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 } | 480 } |
479 | 481 |
480 | 482 |
481 void CompilationCache::Disable() { | 483 void CompilationCache::Disable() { |
482 enabled = false; | 484 enabled = false; |
483 Clear(); | 485 Clear(); |
484 } | 486 } |
485 | 487 |
486 | 488 |
487 } } // namespace v8::internal | 489 } } // namespace v8::internal |
OLD | NEW |