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

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

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 unified diff | Download patch
« no previous file with comments | « src/compilation-cache.h ('k') | src/isolate.cc » ('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 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 28 matching lines...) Expand all
39 // See issue 458: http://code.google.com/p/v8/issues/detail?id=458 39 // See issue 458: http://code.google.com/p/v8/issues/detail?id=458
40 static const int kScriptGenerations = 5; 40 static const int kScriptGenerations = 5;
41 static const int kEvalGlobalGenerations = 2; 41 static const int kEvalGlobalGenerations = 2;
42 static const int kEvalContextualGenerations = 2; 42 static const int kEvalContextualGenerations = 2;
43 static const int kRegExpGenerations = 2; 43 static const int kRegExpGenerations = 2;
44 44
45 // Initial size of each compilation cache table allocated. 45 // Initial size of each compilation cache table allocated.
46 static const int kInitialCacheSize = 64; 46 static const int kInitialCacheSize = 64;
47 47
48 48
49 CompilationCache::CompilationCache() 49 CompilationCache::CompilationCache(Isolate* isolate)
50 : script_(kScriptGenerations), 50 : isolate_(isolate),
51 eval_global_(kEvalGlobalGenerations), 51 script_(isolate, kScriptGenerations),
52 eval_contextual_(kEvalContextualGenerations), 52 eval_global_(isolate, kEvalGlobalGenerations),
53 reg_exp_(kRegExpGenerations), 53 eval_contextual_(isolate, kEvalContextualGenerations),
54 reg_exp_(isolate, kRegExpGenerations),
54 enabled_(true), 55 enabled_(true),
55 eager_optimizing_set_(NULL) { 56 eager_optimizing_set_(NULL) {
56 CompilationSubCache* subcaches[kSubCacheCount] = 57 CompilationSubCache* subcaches[kSubCacheCount] =
57 {&script_, &eval_global_, &eval_contextual_, &reg_exp_}; 58 {&script_, &eval_global_, &eval_contextual_, &reg_exp_};
58 for (int i = 0; i < kSubCacheCount; ++i) { 59 for (int i = 0; i < kSubCacheCount; ++i) {
59 subcaches_[i] = subcaches[i]; 60 subcaches_[i] = subcaches[i];
60 } 61 }
61 } 62 }
62 63
63 64
64 CompilationCache::~CompilationCache() { 65 CompilationCache::~CompilationCache() {
65 delete eager_optimizing_set_; 66 delete eager_optimizing_set_;
66 eager_optimizing_set_ = NULL; 67 eager_optimizing_set_ = NULL;
67 } 68 }
68 69
69 70
70 static Handle<CompilationCacheTable> AllocateTable(int size) { 71 static Handle<CompilationCacheTable> AllocateTable(Isolate* isolate, int size) {
71 Isolate* isolate = Isolate::Current();
72 CALL_HEAP_FUNCTION(isolate, 72 CALL_HEAP_FUNCTION(isolate,
73 CompilationCacheTable::Allocate(size), 73 CompilationCacheTable::Allocate(size),
74 CompilationCacheTable); 74 CompilationCacheTable);
75 } 75 }
76 76
77 77
78 Handle<CompilationCacheTable> CompilationSubCache::GetTable(int generation) { 78 Handle<CompilationCacheTable> CompilationSubCache::GetTable(int generation) {
79 ASSERT(generation < generations_); 79 ASSERT(generation < generations_);
80 Handle<CompilationCacheTable> result; 80 Handle<CompilationCacheTable> result;
81 if (tables_[generation]->IsUndefined()) { 81 if (tables_[generation]->IsUndefined()) {
82 result = AllocateTable(kInitialCacheSize); 82 result = AllocateTable(isolate(), kInitialCacheSize);
83 tables_[generation] = *result; 83 tables_[generation] = *result;
84 } else { 84 } else {
85 CompilationCacheTable* table = 85 CompilationCacheTable* table =
86 CompilationCacheTable::cast(tables_[generation]); 86 CompilationCacheTable::cast(tables_[generation]);
87 result = Handle<CompilationCacheTable>(table); 87 result = Handle<CompilationCacheTable>(table, isolate());
88 } 88 }
89 return result; 89 return result;
90 } 90 }
91 91
92 void CompilationSubCache::Age() { 92 void CompilationSubCache::Age() {
93 // Age the generations implicitly killing off the oldest. 93 // Age the generations implicitly killing off the oldest.
94 for (int i = generations_ - 1; i > 0; i--) { 94 for (int i = generations_ - 1; i > 0; i--) {
95 tables_[i] = tables_[i - 1]; 95 tables_[i] = tables_[i - 1];
96 } 96 }
97 97
98 // Set the first generation as unborn. 98 // Set the first generation as unborn.
99 tables_[0] = HEAP->undefined_value(); 99 tables_[0] = isolate()->heap()->undefined_value();
100 } 100 }
101 101
102 102
103 void CompilationSubCache::IterateFunctions(ObjectVisitor* v) { 103 void CompilationSubCache::IterateFunctions(ObjectVisitor* v) {
104 Object* undefined = HEAP->raw_unchecked_undefined_value(); 104 Object* undefined = isolate()->heap()->raw_unchecked_undefined_value();
105 for (int i = 0; i < generations_; i++) { 105 for (int i = 0; i < generations_; i++) {
106 if (tables_[i] != undefined) { 106 if (tables_[i] != undefined) {
107 reinterpret_cast<CompilationCacheTable*>(tables_[i])->IterateElements(v); 107 reinterpret_cast<CompilationCacheTable*>(tables_[i])->IterateElements(v);
108 } 108 }
109 } 109 }
110 } 110 }
111 111
112 112
113 void CompilationSubCache::Iterate(ObjectVisitor* v) { 113 void CompilationSubCache::Iterate(ObjectVisitor* v) {
114 v->VisitPointers(&tables_[0], &tables_[generations_]); 114 v->VisitPointers(&tables_[0], &tables_[generations_]);
115 } 115 }
116 116
117 117
118 void CompilationSubCache::Clear() { 118 void CompilationSubCache::Clear() {
119 MemsetPointer(tables_, HEAP->undefined_value(), generations_); 119 MemsetPointer(tables_, isolate()->heap()->undefined_value(), generations_);
120 } 120 }
121 121
122 122
123 void CompilationSubCache::Remove(Handle<SharedFunctionInfo> function_info) { 123 void CompilationSubCache::Remove(Handle<SharedFunctionInfo> function_info) {
124 // Probe the script generation tables. Make sure not to leak handles 124 // Probe the script generation tables. Make sure not to leak handles
125 // into the caller's handle scope. 125 // into the caller's handle scope.
126 { HandleScope scope; 126 { HandleScope scope(isolate());
127 for (int generation = 0; generation < generations(); generation++) { 127 for (int generation = 0; generation < generations(); generation++) {
128 Handle<CompilationCacheTable> table = GetTable(generation); 128 Handle<CompilationCacheTable> table = GetTable(generation);
129 table->Remove(*function_info); 129 table->Remove(*function_info);
130 } 130 }
131 } 131 }
132 } 132 }
133 133
134 134
135 CompilationCacheScript::CompilationCacheScript(int generations) 135 CompilationCacheScript::CompilationCacheScript(Isolate* isolate,
136 : CompilationSubCache(generations), 136 int generations)
137 script_histogram_(NULL), 137 : CompilationSubCache(isolate, generations),
138 script_histogram_initialized_(false) { 138 script_histogram_(NULL),
139 } 139 script_histogram_initialized_(false) { }
140 140
141 141
142 // We only re-use a cached function for some script source code if the 142 // We only re-use a cached function for some script source code if the
143 // script originates from the same place. This is to avoid issues 143 // script originates from the same place. This is to avoid issues
144 // when reporting errors, etc. 144 // when reporting errors, etc.
145 bool CompilationCacheScript::HasOrigin( 145 bool CompilationCacheScript::HasOrigin(
146 Handle<SharedFunctionInfo> function_info, 146 Handle<SharedFunctionInfo> function_info,
147 Handle<Object> name, 147 Handle<Object> name,
148 int line_offset, 148 int line_offset,
149 int column_offset) { 149 int column_offset) {
150 Handle<Script> script = 150 Handle<Script> script =
151 Handle<Script>(Script::cast(function_info->script())); 151 Handle<Script>(Script::cast(function_info->script()), isolate());
152 // If the script name isn't set, the boilerplate script should have 152 // If the script name isn't set, the boilerplate script should have
153 // an undefined name to have the same origin. 153 // an undefined name to have the same origin.
154 if (name.is_null()) { 154 if (name.is_null()) {
155 return script->name()->IsUndefined(); 155 return script->name()->IsUndefined();
156 } 156 }
157 // Do the fast bailout checks first. 157 // Do the fast bailout checks first.
158 if (line_offset != script->line_offset()->value()) return false; 158 if (line_offset != script->line_offset()->value()) return false;
159 if (column_offset != script->column_offset()->value()) return false; 159 if (column_offset != script->column_offset()->value()) return false;
160 // Check that both names are strings. If not, no match. 160 // Check that both names are strings. If not, no match.
161 if (!name->IsString() || !script->name()->IsString()) return false; 161 if (!name->IsString() || !script->name()->IsString()) return false;
162 // Compare the two name strings for equality. 162 // Compare the two name strings for equality.
163 return String::cast(*name)->Equals(String::cast(script->name())); 163 return String::cast(*name)->Equals(String::cast(script->name()));
164 } 164 }
165 165
166 166
167 // TODO(245): Need to allow identical code from different contexts to 167 // TODO(245): Need to allow identical code from different contexts to
168 // be cached in the same script generation. Currently the first use 168 // be cached in the same script generation. Currently the first use
169 // will be cached, but subsequent code from different source / line 169 // will be cached, but subsequent code from different source / line
170 // won't. 170 // won't.
171 Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(Handle<String> source, 171 Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(Handle<String> source,
172 Handle<Object> name, 172 Handle<Object> name,
173 int line_offset, 173 int line_offset,
174 int column_offset) { 174 int column_offset) {
175 Object* result = NULL; 175 Object* result = NULL;
176 int generation; 176 int generation;
177 177
178 // Probe the script generation tables. Make sure not to leak handles 178 // Probe the script generation tables. Make sure not to leak handles
179 // into the caller's handle scope. 179 // into the caller's handle scope.
180 { HandleScope scope; 180 { HandleScope scope(isolate());
181 for (generation = 0; generation < generations(); generation++) { 181 for (generation = 0; generation < generations(); generation++) {
182 Handle<CompilationCacheTable> table = GetTable(generation); 182 Handle<CompilationCacheTable> table = GetTable(generation);
183 Handle<Object> probe(table->Lookup(*source)); 183 Handle<Object> probe(table->Lookup(*source), isolate());
184 if (probe->IsSharedFunctionInfo()) { 184 if (probe->IsSharedFunctionInfo()) {
185 Handle<SharedFunctionInfo> function_info = 185 Handle<SharedFunctionInfo> function_info =
186 Handle<SharedFunctionInfo>::cast(probe); 186 Handle<SharedFunctionInfo>::cast(probe);
187 // Break when we've found a suitable shared function info that 187 // Break when we've found a suitable shared function info that
188 // matches the origin. 188 // matches the origin.
189 if (HasOrigin(function_info, name, line_offset, column_offset)) { 189 if (HasOrigin(function_info, name, line_offset, column_offset)) {
190 result = *function_info; 190 result = *function_info;
191 break; 191 break;
192 } 192 }
193 } 193 }
194 } 194 }
195 } 195 }
196 196
197 Isolate* isolate = Isolate::Current();
198 if (!script_histogram_initialized_) { 197 if (!script_histogram_initialized_) {
199 script_histogram_ = isolate->stats_table()->CreateHistogram( 198 script_histogram_ = isolate()->stats_table()->CreateHistogram(
200 "V8.ScriptCache", 199 "V8.ScriptCache",
201 0, 200 0,
202 kScriptGenerations, 201 kScriptGenerations,
203 kScriptGenerations + 1); 202 kScriptGenerations + 1);
204 script_histogram_initialized_ = true; 203 script_histogram_initialized_ = true;
205 } 204 }
206 205
207 if (script_histogram_ != NULL) { 206 if (script_histogram_ != NULL) {
208 // The level NUMBER_OF_SCRIPT_GENERATIONS is equivalent to a cache miss. 207 // The level NUMBER_OF_SCRIPT_GENERATIONS is equivalent to a cache miss.
209 isolate->stats_table()->AddHistogramSample(script_histogram_, generation); 208 isolate()->stats_table()->AddHistogramSample(script_histogram_, generation);
210 } 209 }
211 210
212 // Once outside the manacles of the handle scope, we need to recheck 211 // Once outside the manacles of the handle scope, we need to recheck
213 // to see if we actually found a cached script. If so, we return a 212 // to see if we actually found a cached script. If so, we return a
214 // handle created in the caller's handle scope. 213 // handle created in the caller's handle scope.
215 if (result != NULL) { 214 if (result != NULL) {
216 Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(result)); 215 Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(result),
216 isolate());
217 ASSERT(HasOrigin(shared, name, line_offset, column_offset)); 217 ASSERT(HasOrigin(shared, name, line_offset, column_offset));
218 // If the script was found in a later generation, we promote it to 218 // If the script was found in a later generation, we promote it to
219 // the first generation to let it survive longer in the cache. 219 // the first generation to let it survive longer in the cache.
220 if (generation != 0) Put(source, shared); 220 if (generation != 0) Put(source, shared);
221 isolate->counters()->compilation_cache_hits()->Increment(); 221 isolate()->counters()->compilation_cache_hits()->Increment();
222 return shared; 222 return shared;
223 } else { 223 } else {
224 isolate->counters()->compilation_cache_misses()->Increment(); 224 isolate()->counters()->compilation_cache_misses()->Increment();
225 return Handle<SharedFunctionInfo>::null(); 225 return Handle<SharedFunctionInfo>::null();
226 } 226 }
227 } 227 }
228 228
229 229
230 MaybeObject* CompilationCacheScript::TryTablePut( 230 MaybeObject* CompilationCacheScript::TryTablePut(
231 Handle<String> source, 231 Handle<String> source,
232 Handle<SharedFunctionInfo> function_info) { 232 Handle<SharedFunctionInfo> function_info) {
233 Handle<CompilationCacheTable> table = GetFirstTable(); 233 Handle<CompilationCacheTable> table = GetFirstTable();
234 return table->Put(*source, *function_info); 234 return table->Put(*source, *function_info);
235 } 235 }
236 236
237 237
238 Handle<CompilationCacheTable> CompilationCacheScript::TablePut( 238 Handle<CompilationCacheTable> CompilationCacheScript::TablePut(
239 Handle<String> source, 239 Handle<String> source,
240 Handle<SharedFunctionInfo> function_info) { 240 Handle<SharedFunctionInfo> function_info) {
241 Isolate* isolate = Isolate::Current(); 241 CALL_HEAP_FUNCTION(isolate(),
242 CALL_HEAP_FUNCTION(isolate,
243 TryTablePut(source, function_info), 242 TryTablePut(source, function_info),
244 CompilationCacheTable); 243 CompilationCacheTable);
245 } 244 }
246 245
247 246
248 void CompilationCacheScript::Put(Handle<String> source, 247 void CompilationCacheScript::Put(Handle<String> source,
249 Handle<SharedFunctionInfo> function_info) { 248 Handle<SharedFunctionInfo> function_info) {
250 HandleScope scope; 249 HandleScope scope(isolate());
251 SetFirstTable(TablePut(source, function_info)); 250 SetFirstTable(TablePut(source, function_info));
252 } 251 }
253 252
254 253
255 Handle<SharedFunctionInfo> CompilationCacheEval::Lookup( 254 Handle<SharedFunctionInfo> CompilationCacheEval::Lookup(
256 Handle<String> source, 255 Handle<String> source,
257 Handle<Context> context, 256 Handle<Context> context,
258 StrictModeFlag strict_mode) { 257 StrictModeFlag strict_mode) {
259 // Make sure not to leak the table into the surrounding handle 258 // Make sure not to leak the table into the surrounding handle
260 // scope. Otherwise, we risk keeping old tables around even after 259 // scope. Otherwise, we risk keeping old tables around even after
261 // having cleared the cache. 260 // having cleared the cache.
262 Object* result = NULL; 261 Object* result = NULL;
263 int generation; 262 int generation;
264 { HandleScope scope; 263 { HandleScope scope(isolate());
265 for (generation = 0; generation < generations(); generation++) { 264 for (generation = 0; generation < generations(); generation++) {
266 Handle<CompilationCacheTable> table = GetTable(generation); 265 Handle<CompilationCacheTable> table = GetTable(generation);
267 result = table->LookupEval(*source, *context, strict_mode); 266 result = table->LookupEval(*source, *context, strict_mode);
268 if (result->IsSharedFunctionInfo()) { 267 if (result->IsSharedFunctionInfo()) {
269 break; 268 break;
270 } 269 }
271 } 270 }
272 } 271 }
273 if (result->IsSharedFunctionInfo()) { 272 if (result->IsSharedFunctionInfo()) {
274 Handle<SharedFunctionInfo> 273 Handle<SharedFunctionInfo>
275 function_info(SharedFunctionInfo::cast(result)); 274 function_info(SharedFunctionInfo::cast(result), isolate());
276 if (generation != 0) { 275 if (generation != 0) {
277 Put(source, context, function_info); 276 Put(source, context, function_info);
278 } 277 }
279 COUNTERS->compilation_cache_hits()->Increment(); 278 isolate()->counters()->compilation_cache_hits()->Increment();
280 return function_info; 279 return function_info;
281 } else { 280 } else {
282 COUNTERS->compilation_cache_misses()->Increment(); 281 isolate()->counters()->compilation_cache_misses()->Increment();
283 return Handle<SharedFunctionInfo>::null(); 282 return Handle<SharedFunctionInfo>::null();
284 } 283 }
285 } 284 }
286 285
287 286
288 MaybeObject* CompilationCacheEval::TryTablePut( 287 MaybeObject* CompilationCacheEval::TryTablePut(
289 Handle<String> source, 288 Handle<String> source,
290 Handle<Context> context, 289 Handle<Context> context,
291 Handle<SharedFunctionInfo> function_info) { 290 Handle<SharedFunctionInfo> function_info) {
292 Handle<CompilationCacheTable> table = GetFirstTable(); 291 Handle<CompilationCacheTable> table = GetFirstTable();
293 return table->PutEval(*source, *context, *function_info); 292 return table->PutEval(*source, *context, *function_info);
294 } 293 }
295 294
296 295
297 Handle<CompilationCacheTable> CompilationCacheEval::TablePut( 296 Handle<CompilationCacheTable> CompilationCacheEval::TablePut(
298 Handle<String> source, 297 Handle<String> source,
299 Handle<Context> context, 298 Handle<Context> context,
300 Handle<SharedFunctionInfo> function_info) { 299 Handle<SharedFunctionInfo> function_info) {
301 Isolate* isolate = Isolate::Current(); 300 CALL_HEAP_FUNCTION(isolate(),
302 CALL_HEAP_FUNCTION(isolate,
303 TryTablePut(source, context, function_info), 301 TryTablePut(source, context, function_info),
304 CompilationCacheTable); 302 CompilationCacheTable);
305 } 303 }
306 304
307 305
308 void CompilationCacheEval::Put(Handle<String> source, 306 void CompilationCacheEval::Put(Handle<String> source,
309 Handle<Context> context, 307 Handle<Context> context,
310 Handle<SharedFunctionInfo> function_info) { 308 Handle<SharedFunctionInfo> function_info) {
311 HandleScope scope; 309 HandleScope scope(isolate());
312 SetFirstTable(TablePut(source, context, function_info)); 310 SetFirstTable(TablePut(source, context, function_info));
313 } 311 }
314 312
315 313
316 Handle<FixedArray> CompilationCacheRegExp::Lookup(Handle<String> source, 314 Handle<FixedArray> CompilationCacheRegExp::Lookup(Handle<String> source,
317 JSRegExp::Flags flags) { 315 JSRegExp::Flags flags) {
318 // Make sure not to leak the table into the surrounding handle 316 // Make sure not to leak the table into the surrounding handle
319 // scope. Otherwise, we risk keeping old tables around even after 317 // scope. Otherwise, we risk keeping old tables around even after
320 // having cleared the cache. 318 // having cleared the cache.
321 Object* result = NULL; 319 Object* result = NULL;
322 int generation; 320 int generation;
323 { HandleScope scope; 321 { HandleScope scope(isolate());
324 for (generation = 0; generation < generations(); generation++) { 322 for (generation = 0; generation < generations(); generation++) {
325 Handle<CompilationCacheTable> table = GetTable(generation); 323 Handle<CompilationCacheTable> table = GetTable(generation);
326 result = table->LookupRegExp(*source, flags); 324 result = table->LookupRegExp(*source, flags);
327 if (result->IsFixedArray()) { 325 if (result->IsFixedArray()) {
328 break; 326 break;
329 } 327 }
330 } 328 }
331 } 329 }
332 if (result->IsFixedArray()) { 330 if (result->IsFixedArray()) {
333 Handle<FixedArray> data(FixedArray::cast(result)); 331 Handle<FixedArray> data(FixedArray::cast(result), isolate());
334 if (generation != 0) { 332 if (generation != 0) {
335 Put(source, flags, data); 333 Put(source, flags, data);
336 } 334 }
337 COUNTERS->compilation_cache_hits()->Increment(); 335 isolate()->counters()->compilation_cache_hits()->Increment();
338 return data; 336 return data;
339 } else { 337 } else {
340 COUNTERS->compilation_cache_misses()->Increment(); 338 isolate()->counters()->compilation_cache_misses()->Increment();
341 return Handle<FixedArray>::null(); 339 return Handle<FixedArray>::null();
342 } 340 }
343 } 341 }
344 342
345 343
346 MaybeObject* CompilationCacheRegExp::TryTablePut( 344 MaybeObject* CompilationCacheRegExp::TryTablePut(
347 Handle<String> source, 345 Handle<String> source,
348 JSRegExp::Flags flags, 346 JSRegExp::Flags flags,
349 Handle<FixedArray> data) { 347 Handle<FixedArray> data) {
350 Handle<CompilationCacheTable> table = GetFirstTable(); 348 Handle<CompilationCacheTable> table = GetFirstTable();
351 return table->PutRegExp(*source, flags, *data); 349 return table->PutRegExp(*source, flags, *data);
352 } 350 }
353 351
354 352
355 Handle<CompilationCacheTable> CompilationCacheRegExp::TablePut( 353 Handle<CompilationCacheTable> CompilationCacheRegExp::TablePut(
356 Handle<String> source, 354 Handle<String> source,
357 JSRegExp::Flags flags, 355 JSRegExp::Flags flags,
358 Handle<FixedArray> data) { 356 Handle<FixedArray> data) {
359 Isolate* isolate = Isolate::Current(); 357 CALL_HEAP_FUNCTION(isolate(),
360 CALL_HEAP_FUNCTION(isolate,
361 TryTablePut(source, flags, data), 358 TryTablePut(source, flags, data),
362 CompilationCacheTable); 359 CompilationCacheTable);
363 } 360 }
364 361
365 362
366 void CompilationCacheRegExp::Put(Handle<String> source, 363 void CompilationCacheRegExp::Put(Handle<String> source,
367 JSRegExp::Flags flags, 364 JSRegExp::Flags flags,
368 Handle<FixedArray> data) { 365 Handle<FixedArray> data) {
369 HandleScope scope; 366 HandleScope scope(isolate());
370 SetFirstTable(TablePut(source, flags, data)); 367 SetFirstTable(TablePut(source, flags, data));
371 } 368 }
372 369
373 370
374 void CompilationCache::Remove(Handle<SharedFunctionInfo> function_info) { 371 void CompilationCache::Remove(Handle<SharedFunctionInfo> function_info) {
375 if (!IsEnabled()) return; 372 if (!IsEnabled()) return;
376 373
377 eval_global_.Remove(function_info); 374 eval_global_.Remove(function_info);
378 eval_contextual_.Remove(function_info); 375 eval_contextual_.Remove(function_info);
379 script_.Remove(function_info); 376 script_.Remove(function_info);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 429
433 430
434 void CompilationCache::PutEval(Handle<String> source, 431 void CompilationCache::PutEval(Handle<String> source,
435 Handle<Context> context, 432 Handle<Context> context,
436 bool is_global, 433 bool is_global,
437 Handle<SharedFunctionInfo> function_info) { 434 Handle<SharedFunctionInfo> function_info) {
438 if (!IsEnabled()) { 435 if (!IsEnabled()) {
439 return; 436 return;
440 } 437 }
441 438
442 HandleScope scope; 439 HandleScope scope(isolate());
443 if (is_global) { 440 if (is_global) {
444 eval_global_.Put(source, context, function_info); 441 eval_global_.Put(source, context, function_info);
445 } else { 442 } else {
446 eval_contextual_.Put(source, context, function_info); 443 eval_contextual_.Put(source, context, function_info);
447 } 444 }
448 } 445 }
449 446
450 447
451 448
452 void CompilationCache::PutRegExp(Handle<String> source, 449 void CompilationCache::PutRegExp(Handle<String> source,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 } 531 }
535 532
536 533
537 void CompilationCache::Disable() { 534 void CompilationCache::Disable() {
538 enabled_ = false; 535 enabled_ = false;
539 Clear(); 536 Clear();
540 } 537 }
541 538
542 539
543 } } // namespace v8::internal 540 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compilation-cache.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698