| 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 19 matching lines...) Expand all Loading... |
| 30 #include "compilation-cache.h" | 30 #include "compilation-cache.h" |
| 31 | 31 |
| 32 namespace v8 { | 32 namespace v8 { |
| 33 namespace internal { | 33 namespace internal { |
| 34 | 34 |
| 35 | 35 |
| 36 // The number of sub caches covering the different types to cache. | 36 // The number of sub caches covering the different types to cache. |
| 37 static const int kSubCacheCount = 4; | 37 static const int kSubCacheCount = 4; |
| 38 | 38 |
| 39 // The number of generations for each sub cache. | 39 // The number of generations for each sub cache. |
| 40 #if defined(ANDROID) | |
| 41 static const int kScriptGenerations = 1; | |
| 42 static const int kEvalGlobalGenerations = 1; | |
| 43 static const int kEvalContextualGenerations = 1; | |
| 44 static const int kRegExpGenerations = 1; | |
| 45 #else | |
| 46 // The number of ScriptGenerations is carefully chosen based on histograms. | 40 // The number of ScriptGenerations is carefully chosen based on histograms. |
| 47 // See issue 458: http://code.google.com/p/v8/issues/detail?id=458 | 41 // See issue 458: http://code.google.com/p/v8/issues/detail?id=458 |
| 48 static const int kScriptGenerations = 5; | 42 static const int kScriptGenerations = 5; |
| 49 static const int kEvalGlobalGenerations = 2; | 43 static const int kEvalGlobalGenerations = 2; |
| 50 static const int kEvalContextualGenerations = 2; | 44 static const int kEvalContextualGenerations = 2; |
| 51 static const int kRegExpGenerations = 2; | 45 static const int kRegExpGenerations = 2; |
| 52 #endif | |
| 53 | 46 |
| 54 // Initial size of each compilation cache table allocated. | 47 // Initial size of each compilation cache table allocated. |
| 55 static const int kInitialCacheSize = 64; | 48 static const int kInitialCacheSize = 64; |
| 56 | 49 |
| 57 // The compilation cache consists of several generational sub-caches which uses | 50 // The compilation cache consists of several generational sub-caches which uses |
| 58 // this class as a base class. A sub-cache contains a compilation cache tables | 51 // this class as a base class. A sub-cache contains a compilation cache tables |
| 59 // for each generation of the sub-cache. Since the same source code string has | 52 // for each generation of the sub-cache. Since the same source code string has |
| 60 // different compiled code for scripts and evals, we use separate sub-caches | 53 // different compiled code for scripts and evals, we use separate sub-caches |
| 61 // for different compilation modes, to avoid retrieving the wrong result. | 54 // for different compilation modes, to avoid retrieving the wrong result. |
| 62 class CompilationSubCache { | 55 class CompilationSubCache { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 } | 474 } |
| 482 | 475 |
| 483 | 476 |
| 484 void CompilationCache::Disable() { | 477 void CompilationCache::Disable() { |
| 485 enabled = false; | 478 enabled = false; |
| 486 Clear(); | 479 Clear(); |
| 487 } | 480 } |
| 488 | 481 |
| 489 | 482 |
| 490 } } // namespace v8::internal | 483 } } // namespace v8::internal |
| OLD | NEW |