blob: 7402e6857d756cd04d1f53247eb27886a1b361a0 [file] [log] [blame]
Steve Blocka7e24c12009-10-30 11:49:00 +00001// Copyright 2008 the V8 project authors. All rights reserved.
2// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#include "v8.h"
29
30#include "compilation-cache.h"
Andrei Popescu31002712010-02-23 13:46:05 +000031#include "serialize.h"
Steve Blocka7e24c12009-10-30 11:49:00 +000032
33namespace v8 {
34namespace internal {
35
Steve Blocka7e24c12009-10-30 11:49:00 +000036// The number of sub caches covering the different types to cache.
37static const int kSubCacheCount = 4;
38
39// The number of generations for each sub cache.
Steve Block3ce2e202009-11-05 08:53:23 +000040// The number of ScriptGenerations is carefully chosen based on histograms.
41// See issue 458: http://code.google.com/p/v8/issues/detail?id=458
Steve Blocka7e24c12009-10-30 11:49:00 +000042static const int kScriptGenerations = 5;
43static const int kEvalGlobalGenerations = 2;
44static const int kEvalContextualGenerations = 2;
45static const int kRegExpGenerations = 2;
Steve Blocka7e24c12009-10-30 11:49:00 +000046
Steve Block3ce2e202009-11-05 08:53:23 +000047// Initial size of each compilation cache table allocated.
Steve Blocka7e24c12009-10-30 11:49:00 +000048static const int kInitialCacheSize = 64;
49
Steve Block6ded16b2010-05-10 14:33:55 +010050// Index for the first generation in the cache.
51static const int kFirstGeneration = 0;
52
Steve Blocka7e24c12009-10-30 11:49:00 +000053// The compilation cache consists of several generational sub-caches which uses
54// this class as a base class. A sub-cache contains a compilation cache tables
Steve Block3ce2e202009-11-05 08:53:23 +000055// for each generation of the sub-cache. Since the same source code string has
56// different compiled code for scripts and evals, we use separate sub-caches
57// for different compilation modes, to avoid retrieving the wrong result.
Steve Blocka7e24c12009-10-30 11:49:00 +000058class CompilationSubCache {
59 public:
60 explicit CompilationSubCache(int generations): generations_(generations) {
61 tables_ = NewArray<Object*>(generations);
62 }
63
64 ~CompilationSubCache() { DeleteArray(tables_); }
65
66 // Get the compilation cache tables for a specific generation.
67 Handle<CompilationCacheTable> GetTable(int generation);
68
Steve Block6ded16b2010-05-10 14:33:55 +010069 // Accessors for first generation.
70 Handle<CompilationCacheTable> GetFirstTable() {
71 return GetTable(kFirstGeneration);
72 }
73 void SetFirstTable(Handle<CompilationCacheTable> value) {
74 ASSERT(kFirstGeneration < generations_);
75 tables_[kFirstGeneration] = *value;
76 }
77
Steve Blocka7e24c12009-10-30 11:49:00 +000078 // Age the sub-cache by evicting the oldest generation and creating a new
79 // young generation.
80 void Age();
81
82 // GC support.
83 void Iterate(ObjectVisitor* v);
Iain Merrick75681382010-08-19 15:07:18 +010084 void IterateFunctions(ObjectVisitor* v);
Steve Blocka7e24c12009-10-30 11:49:00 +000085
86 // Clear this sub-cache evicting all its content.
87 void Clear();
88
89 // Number of generations in this sub-cache.
90 inline int generations() { return generations_; }
91
92 private:
93 int generations_; // Number of generations.
94 Object** tables_; // Compilation cache tables - one for each generation.
95
96 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationSubCache);
97};
98
99
100// Sub-cache for scripts.
101class CompilationCacheScript : public CompilationSubCache {
102 public:
103 explicit CompilationCacheScript(int generations)
104 : CompilationSubCache(generations) { }
105
Steve Block6ded16b2010-05-10 14:33:55 +0100106 Handle<SharedFunctionInfo> Lookup(Handle<String> source,
107 Handle<Object> name,
108 int line_offset,
109 int column_offset);
110 void Put(Handle<String> source, Handle<SharedFunctionInfo> function_info);
Steve Blocka7e24c12009-10-30 11:49:00 +0000111
112 private:
Steve Block6ded16b2010-05-10 14:33:55 +0100113 // Note: Returns a new hash table if operation results in expansion.
114 Handle<CompilationCacheTable> TablePut(
115 Handle<String> source, Handle<SharedFunctionInfo> function_info);
116
117 bool HasOrigin(Handle<SharedFunctionInfo> function_info,
Steve Blocka7e24c12009-10-30 11:49:00 +0000118 Handle<Object> name,
119 int line_offset,
120 int column_offset);
121
122 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript);
123};
124
125
126// Sub-cache for eval scripts.
127class CompilationCacheEval: public CompilationSubCache {
128 public:
129 explicit CompilationCacheEval(int generations)
130 : CompilationSubCache(generations) { }
131
Steve Block6ded16b2010-05-10 14:33:55 +0100132 Handle<SharedFunctionInfo> Lookup(Handle<String> source,
133 Handle<Context> context);
Steve Blocka7e24c12009-10-30 11:49:00 +0000134
135 void Put(Handle<String> source,
136 Handle<Context> context,
Steve Block6ded16b2010-05-10 14:33:55 +0100137 Handle<SharedFunctionInfo> function_info);
138
139 private:
140 // Note: Returns a new hash table if operation results in expansion.
141 Handle<CompilationCacheTable> TablePut(
142 Handle<String> source,
143 Handle<Context> context,
144 Handle<SharedFunctionInfo> function_info);
Steve Blocka7e24c12009-10-30 11:49:00 +0000145
146 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheEval);
147};
148
149
150// Sub-cache for regular expressions.
151class CompilationCacheRegExp: public CompilationSubCache {
152 public:
153 explicit CompilationCacheRegExp(int generations)
154 : CompilationSubCache(generations) { }
155
156 Handle<FixedArray> Lookup(Handle<String> source, JSRegExp::Flags flags);
157
158 void Put(Handle<String> source,
159 JSRegExp::Flags flags,
160 Handle<FixedArray> data);
Steve Block6ded16b2010-05-10 14:33:55 +0100161 private:
162 // Note: Returns a new hash table if operation results in expansion.
163 Handle<CompilationCacheTable> TablePut(Handle<String> source,
164 JSRegExp::Flags flags,
165 Handle<FixedArray> data);
Steve Blocka7e24c12009-10-30 11:49:00 +0000166
167 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheRegExp);
168};
169
170
171// Statically allocate all the sub-caches.
172static CompilationCacheScript script(kScriptGenerations);
173static CompilationCacheEval eval_global(kEvalGlobalGenerations);
174static CompilationCacheEval eval_contextual(kEvalContextualGenerations);
175static CompilationCacheRegExp reg_exp(kRegExpGenerations);
176static CompilationSubCache* subcaches[kSubCacheCount] =
177 {&script, &eval_global, &eval_contextual, &reg_exp};
178
179
180// Current enable state of the compilation cache.
181static bool enabled = true;
182static inline bool IsEnabled() {
183 return FLAG_compilation_cache && enabled;
184}
185
186
187static Handle<CompilationCacheTable> AllocateTable(int size) {
188 CALL_HEAP_FUNCTION(CompilationCacheTable::Allocate(size),
189 CompilationCacheTable);
190}
191
192
193Handle<CompilationCacheTable> CompilationSubCache::GetTable(int generation) {
194 ASSERT(generation < generations_);
195 Handle<CompilationCacheTable> result;
196 if (tables_[generation]->IsUndefined()) {
197 result = AllocateTable(kInitialCacheSize);
198 tables_[generation] = *result;
199 } else {
200 CompilationCacheTable* table =
201 CompilationCacheTable::cast(tables_[generation]);
202 result = Handle<CompilationCacheTable>(table);
203 }
204 return result;
205}
206
207
208void CompilationSubCache::Age() {
209 // Age the generations implicitly killing off the oldest.
210 for (int i = generations_ - 1; i > 0; i--) {
211 tables_[i] = tables_[i - 1];
212 }
213
214 // Set the first generation as unborn.
215 tables_[0] = Heap::undefined_value();
216}
217
218
Iain Merrick75681382010-08-19 15:07:18 +0100219void CompilationSubCache::IterateFunctions(ObjectVisitor* v) {
220 Object* undefined = Heap::raw_unchecked_undefined_value();
221 for (int i = 0; i < generations_; i++) {
222 if (tables_[i] != undefined) {
223 reinterpret_cast<CompilationCacheTable*>(tables_[i])->IterateElements(v);
224 }
225 }
226}
227
228
Steve Blocka7e24c12009-10-30 11:49:00 +0000229void CompilationSubCache::Iterate(ObjectVisitor* v) {
230 v->VisitPointers(&tables_[0], &tables_[generations_]);
231}
232
233
234void CompilationSubCache::Clear() {
Steve Block6ded16b2010-05-10 14:33:55 +0100235 MemsetPointer(tables_, Heap::undefined_value(), generations_);
Steve Blocka7e24c12009-10-30 11:49:00 +0000236}
237
238
239// We only re-use a cached function for some script source code if the
240// script originates from the same place. This is to avoid issues
241// when reporting errors, etc.
Steve Block6ded16b2010-05-10 14:33:55 +0100242bool CompilationCacheScript::HasOrigin(
243 Handle<SharedFunctionInfo> function_info,
244 Handle<Object> name,
245 int line_offset,
246 int column_offset) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000247 Handle<Script> script =
Steve Block6ded16b2010-05-10 14:33:55 +0100248 Handle<Script>(Script::cast(function_info->script()));
Steve Blocka7e24c12009-10-30 11:49:00 +0000249 // If the script name isn't set, the boilerplate script should have
250 // an undefined name to have the same origin.
251 if (name.is_null()) {
252 return script->name()->IsUndefined();
253 }
254 // Do the fast bailout checks first.
255 if (line_offset != script->line_offset()->value()) return false;
256 if (column_offset != script->column_offset()->value()) return false;
257 // Check that both names are strings. If not, no match.
258 if (!name->IsString() || !script->name()->IsString()) return false;
259 // Compare the two name strings for equality.
260 return String::cast(*name)->Equals(String::cast(script->name()));
261}
262
263
264// TODO(245): Need to allow identical code from different contexts to
265// be cached in the same script generation. Currently the first use
266// will be cached, but subsequent code from different source / line
267// won't.
Steve Block6ded16b2010-05-10 14:33:55 +0100268Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(Handle<String> source,
269 Handle<Object> name,
270 int line_offset,
271 int column_offset) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000272 Object* result = NULL;
273 int generation;
274
275 // Probe the script generation tables. Make sure not to leak handles
276 // into the caller's handle scope.
277 { HandleScope scope;
278 for (generation = 0; generation < generations(); generation++) {
279 Handle<CompilationCacheTable> table = GetTable(generation);
280 Handle<Object> probe(table->Lookup(*source));
Steve Block6ded16b2010-05-10 14:33:55 +0100281 if (probe->IsSharedFunctionInfo()) {
282 Handle<SharedFunctionInfo> function_info =
283 Handle<SharedFunctionInfo>::cast(probe);
284 // Break when we've found a suitable shared function info that
Steve Blocka7e24c12009-10-30 11:49:00 +0000285 // matches the origin.
Steve Block6ded16b2010-05-10 14:33:55 +0100286 if (HasOrigin(function_info, name, line_offset, column_offset)) {
287 result = *function_info;
Steve Blocka7e24c12009-10-30 11:49:00 +0000288 break;
289 }
290 }
291 }
292 }
293
294 static void* script_histogram = StatsTable::CreateHistogram(
295 "V8.ScriptCache",
296 0,
297 kScriptGenerations,
298 kScriptGenerations + 1);
299
300 if (script_histogram != NULL) {
301 // The level NUMBER_OF_SCRIPT_GENERATIONS is equivalent to a cache miss.
302 StatsTable::AddHistogramSample(script_histogram, generation);
303 }
304
305 // Once outside the manacles of the handle scope, we need to recheck
306 // to see if we actually found a cached script. If so, we return a
307 // handle created in the caller's handle scope.
308 if (result != NULL) {
Steve Block6ded16b2010-05-10 14:33:55 +0100309 Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(result));
310 ASSERT(HasOrigin(shared, name, line_offset, column_offset));
Steve Blocka7e24c12009-10-30 11:49:00 +0000311 // If the script was found in a later generation, we promote it to
312 // the first generation to let it survive longer in the cache.
Steve Block6ded16b2010-05-10 14:33:55 +0100313 if (generation != 0) Put(source, shared);
Steve Blocka7e24c12009-10-30 11:49:00 +0000314 Counters::compilation_cache_hits.Increment();
Steve Block6ded16b2010-05-10 14:33:55 +0100315 return shared;
Steve Blocka7e24c12009-10-30 11:49:00 +0000316 } else {
317 Counters::compilation_cache_misses.Increment();
Steve Block6ded16b2010-05-10 14:33:55 +0100318 return Handle<SharedFunctionInfo>::null();
Steve Blocka7e24c12009-10-30 11:49:00 +0000319 }
320}
321
322
Steve Block6ded16b2010-05-10 14:33:55 +0100323Handle<CompilationCacheTable> CompilationCacheScript::TablePut(
324 Handle<String> source,
325 Handle<SharedFunctionInfo> function_info) {
326 CALL_HEAP_FUNCTION(GetFirstTable()->Put(*source, *function_info),
327 CompilationCacheTable);
Steve Blocka7e24c12009-10-30 11:49:00 +0000328}
329
330
Steve Block6ded16b2010-05-10 14:33:55 +0100331void CompilationCacheScript::Put(Handle<String> source,
332 Handle<SharedFunctionInfo> function_info) {
333 HandleScope scope;
334 SetFirstTable(TablePut(source, function_info));
335}
336
337
338Handle<SharedFunctionInfo> CompilationCacheEval::Lookup(
339 Handle<String> source, Handle<Context> context) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000340 // Make sure not to leak the table into the surrounding handle
341 // scope. Otherwise, we risk keeping old tables around even after
342 // having cleared the cache.
343 Object* result = NULL;
344 int generation;
345 { HandleScope scope;
346 for (generation = 0; generation < generations(); generation++) {
347 Handle<CompilationCacheTable> table = GetTable(generation);
348 result = table->LookupEval(*source, *context);
Steve Block6ded16b2010-05-10 14:33:55 +0100349 if (result->IsSharedFunctionInfo()) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000350 break;
351 }
352 }
353 }
Steve Block6ded16b2010-05-10 14:33:55 +0100354 if (result->IsSharedFunctionInfo()) {
355 Handle<SharedFunctionInfo>
356 function_info(SharedFunctionInfo::cast(result));
Steve Blocka7e24c12009-10-30 11:49:00 +0000357 if (generation != 0) {
Steve Block6ded16b2010-05-10 14:33:55 +0100358 Put(source, context, function_info);
Steve Blocka7e24c12009-10-30 11:49:00 +0000359 }
360 Counters::compilation_cache_hits.Increment();
Steve Block6ded16b2010-05-10 14:33:55 +0100361 return function_info;
Steve Blocka7e24c12009-10-30 11:49:00 +0000362 } else {
363 Counters::compilation_cache_misses.Increment();
Steve Block6ded16b2010-05-10 14:33:55 +0100364 return Handle<SharedFunctionInfo>::null();
Steve Blocka7e24c12009-10-30 11:49:00 +0000365 }
366}
367
368
Steve Block6ded16b2010-05-10 14:33:55 +0100369Handle<CompilationCacheTable> CompilationCacheEval::TablePut(
370 Handle<String> source,
371 Handle<Context> context,
372 Handle<SharedFunctionInfo> function_info) {
373 CALL_HEAP_FUNCTION(GetFirstTable()->PutEval(*source,
374 *context,
375 *function_info),
376 CompilationCacheTable);
377}
378
379
Steve Blocka7e24c12009-10-30 11:49:00 +0000380void CompilationCacheEval::Put(Handle<String> source,
381 Handle<Context> context,
Steve Block6ded16b2010-05-10 14:33:55 +0100382 Handle<SharedFunctionInfo> function_info) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000383 HandleScope scope;
Steve Block6ded16b2010-05-10 14:33:55 +0100384 SetFirstTable(TablePut(source, context, function_info));
Steve Blocka7e24c12009-10-30 11:49:00 +0000385}
386
387
388Handle<FixedArray> CompilationCacheRegExp::Lookup(Handle<String> source,
389 JSRegExp::Flags flags) {
390 // Make sure not to leak the table into the surrounding handle
391 // scope. Otherwise, we risk keeping old tables around even after
392 // having cleared the cache.
393 Object* result = NULL;
394 int generation;
395 { HandleScope scope;
396 for (generation = 0; generation < generations(); generation++) {
397 Handle<CompilationCacheTable> table = GetTable(generation);
398 result = table->LookupRegExp(*source, flags);
399 if (result->IsFixedArray()) {
400 break;
401 }
402 }
403 }
404 if (result->IsFixedArray()) {
405 Handle<FixedArray> data(FixedArray::cast(result));
406 if (generation != 0) {
407 Put(source, flags, data);
408 }
409 Counters::compilation_cache_hits.Increment();
410 return data;
411 } else {
412 Counters::compilation_cache_misses.Increment();
413 return Handle<FixedArray>::null();
414 }
415}
416
417
Steve Block6ded16b2010-05-10 14:33:55 +0100418Handle<CompilationCacheTable> CompilationCacheRegExp::TablePut(
419 Handle<String> source,
420 JSRegExp::Flags flags,
421 Handle<FixedArray> data) {
422 CALL_HEAP_FUNCTION(GetFirstTable()->PutRegExp(*source, flags, *data),
423 CompilationCacheTable);
424}
425
426
Steve Blocka7e24c12009-10-30 11:49:00 +0000427void CompilationCacheRegExp::Put(Handle<String> source,
428 JSRegExp::Flags flags,
429 Handle<FixedArray> data) {
430 HandleScope scope;
Steve Block6ded16b2010-05-10 14:33:55 +0100431 SetFirstTable(TablePut(source, flags, data));
Steve Blocka7e24c12009-10-30 11:49:00 +0000432}
433
434
Steve Block6ded16b2010-05-10 14:33:55 +0100435Handle<SharedFunctionInfo> CompilationCache::LookupScript(Handle<String> source,
436 Handle<Object> name,
437 int line_offset,
438 int column_offset) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000439 if (!IsEnabled()) {
Steve Block6ded16b2010-05-10 14:33:55 +0100440 return Handle<SharedFunctionInfo>::null();
Steve Blocka7e24c12009-10-30 11:49:00 +0000441 }
442
443 return script.Lookup(source, name, line_offset, column_offset);
444}
445
446
Steve Block6ded16b2010-05-10 14:33:55 +0100447Handle<SharedFunctionInfo> CompilationCache::LookupEval(Handle<String> source,
448 Handle<Context> context,
449 bool is_global) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000450 if (!IsEnabled()) {
Steve Block6ded16b2010-05-10 14:33:55 +0100451 return Handle<SharedFunctionInfo>::null();
Steve Blocka7e24c12009-10-30 11:49:00 +0000452 }
453
Steve Block6ded16b2010-05-10 14:33:55 +0100454 Handle<SharedFunctionInfo> result;
Steve Blocka7e24c12009-10-30 11:49:00 +0000455 if (is_global) {
456 result = eval_global.Lookup(source, context);
457 } else {
458 result = eval_contextual.Lookup(source, context);
459 }
460 return result;
461}
462
463
464Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source,
465 JSRegExp::Flags flags) {
466 if (!IsEnabled()) {
467 return Handle<FixedArray>::null();
468 }
469
470 return reg_exp.Lookup(source, flags);
471}
472
473
474void CompilationCache::PutScript(Handle<String> source,
Steve Block6ded16b2010-05-10 14:33:55 +0100475 Handle<SharedFunctionInfo> function_info) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000476 if (!IsEnabled()) {
477 return;
478 }
479
Steve Block6ded16b2010-05-10 14:33:55 +0100480 script.Put(source, function_info);
Steve Blocka7e24c12009-10-30 11:49:00 +0000481}
482
483
484void CompilationCache::PutEval(Handle<String> source,
485 Handle<Context> context,
486 bool is_global,
Steve Block6ded16b2010-05-10 14:33:55 +0100487 Handle<SharedFunctionInfo> function_info) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000488 if (!IsEnabled()) {
489 return;
490 }
491
492 HandleScope scope;
Steve Blocka7e24c12009-10-30 11:49:00 +0000493 if (is_global) {
Steve Block6ded16b2010-05-10 14:33:55 +0100494 eval_global.Put(source, context, function_info);
Steve Blocka7e24c12009-10-30 11:49:00 +0000495 } else {
Steve Block6ded16b2010-05-10 14:33:55 +0100496 eval_contextual.Put(source, context, function_info);
Steve Blocka7e24c12009-10-30 11:49:00 +0000497 }
498}
499
500
501
502void CompilationCache::PutRegExp(Handle<String> source,
503 JSRegExp::Flags flags,
504 Handle<FixedArray> data) {
505 if (!IsEnabled()) {
506 return;
507 }
508
509 reg_exp.Put(source, flags, data);
510}
511
512
513void CompilationCache::Clear() {
514 for (int i = 0; i < kSubCacheCount; i++) {
515 subcaches[i]->Clear();
516 }
517}
518
Steve Blocka7e24c12009-10-30 11:49:00 +0000519void CompilationCache::Iterate(ObjectVisitor* v) {
520 for (int i = 0; i < kSubCacheCount; i++) {
521 subcaches[i]->Iterate(v);
522 }
523}
524
525
Iain Merrick75681382010-08-19 15:07:18 +0100526void CompilationCache::IterateFunctions(ObjectVisitor* v) {
527 for (int i = 0; i < kSubCacheCount; i++) {
528 subcaches[i]->IterateFunctions(v);
529 }
530}
531
532
Steve Blocka7e24c12009-10-30 11:49:00 +0000533void CompilationCache::MarkCompactPrologue() {
534 for (int i = 0; i < kSubCacheCount; i++) {
535 subcaches[i]->Age();
536 }
537}
538
539
540void CompilationCache::Enable() {
541 enabled = true;
542}
543
544
545void CompilationCache::Disable() {
546 enabled = false;
547 Clear();
548}
549
550
551} } // namespace v8::internal