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

Side by Side Diff: src/compilation-cache.cc

Issue 2801073006: Decouple root visitors from object visitors. (Closed)
Patch Set: rebase Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/compilation-cache.h ('k') | src/debug/debug.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compilation-cache.h" 5 #include "src/compilation-cache.h"
6 6
7 #include "src/counters.h" 7 #include "src/counters.h"
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
11 #include "src/objects/compilation-cache-inl.h" 11 #include "src/objects/compilation-cache-inl.h"
12 #include "src/visitors.h"
12 13
13 namespace v8 { 14 namespace v8 {
14 namespace internal { 15 namespace internal {
15 16
16 17
17 // The number of generations for each sub cache. 18 // The number of generations for each sub cache.
18 static const int kRegExpGenerations = 2; 19 static const int kRegExpGenerations = 2;
19 20
20 // Initial size of each compilation cache table allocated. 21 // Initial size of each compilation cache table allocated.
21 static const int kInitialCacheSize = 64; 22 static const int kInitialCacheSize = 64;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 75
75 void CompilationSubCache::IterateFunctions(ObjectVisitor* v) { 76 void CompilationSubCache::IterateFunctions(ObjectVisitor* v) {
76 Object* undefined = isolate()->heap()->undefined_value(); 77 Object* undefined = isolate()->heap()->undefined_value();
77 for (int i = 0; i < generations_; i++) { 78 for (int i = 0; i < generations_; i++) {
78 if (tables_[i] != undefined) { 79 if (tables_[i] != undefined) {
79 reinterpret_cast<CompilationCacheTable*>(tables_[i])->IterateElements(v); 80 reinterpret_cast<CompilationCacheTable*>(tables_[i])->IterateElements(v);
80 } 81 }
81 } 82 }
82 } 83 }
83 84
84 85 void CompilationSubCache::Iterate(RootVisitor* v) {
85 void CompilationSubCache::Iterate(ObjectVisitor* v) { 86 v->VisitRootPointers(Root::kCompilationCache, &tables_[0],
86 v->VisitPointers(&tables_[0], &tables_[generations_]); 87 &tables_[generations_]);
87 } 88 }
88 89
89 90
90 void CompilationSubCache::Clear() { 91 void CompilationSubCache::Clear() {
91 MemsetPointer(tables_, isolate()->heap()->undefined_value(), generations_); 92 MemsetPointer(tables_, isolate()->heap()->undefined_value(), generations_);
92 } 93 }
93 94
94 95
95 void CompilationSubCache::Remove(Handle<SharedFunctionInfo> function_info) { 96 void CompilationSubCache::Remove(Handle<SharedFunctionInfo> function_info) {
96 // Probe the script generation tables. Make sure not to leak handles 97 // Probe the script generation tables. Make sure not to leak handles
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 reg_exp_.Put(source, flags, data); 360 reg_exp_.Put(source, flags, data);
360 } 361 }
361 362
362 363
363 void CompilationCache::Clear() { 364 void CompilationCache::Clear() {
364 for (int i = 0; i < kSubCacheCount; i++) { 365 for (int i = 0; i < kSubCacheCount; i++) {
365 subcaches_[i]->Clear(); 366 subcaches_[i]->Clear();
366 } 367 }
367 } 368 }
368 369
369 370 void CompilationCache::Iterate(RootVisitor* v) {
370 void CompilationCache::Iterate(ObjectVisitor* v) {
371 for (int i = 0; i < kSubCacheCount; i++) { 371 for (int i = 0; i < kSubCacheCount; i++) {
372 subcaches_[i]->Iterate(v); 372 subcaches_[i]->Iterate(v);
373 } 373 }
374 } 374 }
375 375
376 376
377 void CompilationCache::IterateFunctions(ObjectVisitor* v) { 377 void CompilationCache::IterateFunctions(ObjectVisitor* v) {
378 for (int i = 0; i < kSubCacheCount; i++) { 378 for (int i = 0; i < kSubCacheCount; i++) {
379 subcaches_[i]->IterateFunctions(v); 379 subcaches_[i]->IterateFunctions(v);
380 } 380 }
(...skipping 13 matching lines...) Expand all
394 394
395 395
396 void CompilationCache::Disable() { 396 void CompilationCache::Disable() {
397 enabled_ = false; 397 enabled_ = false;
398 Clear(); 398 Clear();
399 } 399 }
400 400
401 401
402 } // namespace internal 402 } // namespace internal
403 } // namespace v8 403 } // namespace v8
OLDNEW
« no previous file with comments | « src/compilation-cache.h ('k') | src/debug/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698