| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 static const int kEvalGlobalGenerations = 1; | 42 static const int kEvalGlobalGenerations = 1; |
| 43 static const int kEvalContextualGenerations = 1; | 43 static const int kEvalContextualGenerations = 1; |
| 44 static const int kRegExpGenerations = 1; | 44 static const int kRegExpGenerations = 1; |
| 45 #else | 45 #else |
| 46 static const int kScriptGenerations = 5; | 46 static const int kScriptGenerations = 5; |
| 47 static const int kEvalGlobalGenerations = 2; | 47 static const int kEvalGlobalGenerations = 2; |
| 48 static const int kEvalContextualGenerations = 2; | 48 static const int kEvalContextualGenerations = 2; |
| 49 static const int kRegExpGenerations = 2; | 49 static const int kRegExpGenerations = 2; |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 // Initial of each compilation cache table allocated. | 52 // Initial size of each compilation cache table allocated. |
| 53 static const int kInitialCacheSize = 64; | 53 static const int kInitialCacheSize = 64; |
| 54 | 54 |
| 55 // The compilation cache consists of several generational sub-caches which uses | 55 // The compilation cache consists of several generational sub-caches which uses |
| 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. Since 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, we use separate sub-caches |
| 59 // sub-caches to avoid getting the wrong kind of result when looking up. | 59 // for different compilation modes, to avoid retrieving the wrong result. |
| 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_); } | 66 ~CompilationSubCache() { DeleteArray(tables_); } |
| 67 | 67 |
| 68 // Get the compilation cache tables for a specific generation. | 68 // Get the compilation cache tables for a specific generation. |
| 69 Handle<CompilationCacheTable> GetTable(int generation); | 69 Handle<CompilationCacheTable> GetTable(int generation); |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 } | 479 } |
| 480 | 480 |
| 481 | 481 |
| 482 void CompilationCache::Disable() { | 482 void CompilationCache::Disable() { |
| 483 enabled = false; | 483 enabled = false; |
| 484 Clear(); | 484 Clear(); |
| 485 } | 485 } |
| 486 | 486 |
| 487 | 487 |
| 488 } } // namespace v8::internal | 488 } } // namespace v8::internal |
| OLD | NEW |