Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Unified Diff: src/compilation-cache.h

Issue 6688065: Clean up Isolate usages in compilation cache. (Closed)
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compilation-cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compilation-cache.h
diff --git a/src/compilation-cache.h b/src/compilation-cache.h
index 770d878b5b3428049cdb676a9cfb5be0e537e273..887d4e84e98b9c8d8ccedc5167310a3b373b8a97 100644
--- a/src/compilation-cache.h
+++ b/src/compilation-cache.h
@@ -40,7 +40,9 @@ class HashMap;
// for different compilation modes, to avoid retrieving the wrong result.
class CompilationSubCache {
public:
- explicit CompilationSubCache(int generations): generations_(generations) {
+ CompilationSubCache(Isolate* isolate, int generations)
+ : isolate_(isolate),
+ generations_(generations) {
tables_ = NewArray<Object*>(generations);
}
@@ -78,7 +80,11 @@ class CompilationSubCache {
// Number of generations in this sub-cache.
inline int generations() { return generations_; }
+ protected:
+ Isolate* isolate() { return isolate_; }
+
private:
+ Isolate* isolate_;
int generations_; // Number of generations.
Object** tables_; // Compilation cache tables - one for each generation.
@@ -89,7 +95,7 @@ class CompilationSubCache {
// Sub-cache for scripts.
class CompilationCacheScript : public CompilationSubCache {
public:
- explicit CompilationCacheScript(int generations);
+ CompilationCacheScript(Isolate* isolate, int generations);
Handle<SharedFunctionInfo> Lookup(Handle<String> source,
Handle<Object> name,
@@ -120,8 +126,8 @@ class CompilationCacheScript : public CompilationSubCache {
// Sub-cache for eval scripts.
class CompilationCacheEval: public CompilationSubCache {
public:
- explicit CompilationCacheEval(int generations)
- : CompilationSubCache(generations) { }
+ CompilationCacheEval(Isolate* isolate, int generations)
+ : CompilationSubCache(isolate, generations) { }
Handle<SharedFunctionInfo> Lookup(Handle<String> source,
Handle<Context> context,
@@ -150,8 +156,8 @@ class CompilationCacheEval: public CompilationSubCache {
// Sub-cache for regular expressions.
class CompilationCacheRegExp: public CompilationSubCache {
public:
- explicit CompilationCacheRegExp(int generations)
- : CompilationSubCache(generations) { }
+ CompilationCacheRegExp(Isolate* isolate, int generations)
+ : CompilationSubCache(isolate, generations) { }
Handle<FixedArray> Lookup(Handle<String> source, JSRegExp::Flags flags);
@@ -245,7 +251,7 @@ class CompilationCache {
void Enable();
void Disable();
private:
- CompilationCache();
+ explicit CompilationCache(Isolate* isolate);
~CompilationCache();
HashMap* EagerOptimizingSet();
@@ -253,6 +259,12 @@ class CompilationCache {
// The number of sub caches covering the different types to cache.
static const int kSubCacheCount = 4;
+ bool IsEnabled() { return FLAG_compilation_cache && enabled_; }
+
+ Isolate* isolate() { return isolate_; }
+
+ Isolate* isolate_;
+
CompilationCacheScript script_;
CompilationCacheEval eval_global_;
CompilationCacheEval eval_contextual_;
@@ -264,8 +276,6 @@ class CompilationCache {
HashMap* eager_optimizing_set_;
- bool IsEnabled() { return FLAG_compilation_cache && enabled_; }
-
friend class Isolate;
DISALLOW_COPY_AND_ASSIGN(CompilationCache);
« no previous file with comments | « no previous file | src/compilation-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698