| OLD | NEW |
| 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/assembler.h" | |
| 8 #include "src/counters.h" | 7 #include "src/counters.h" |
| 9 #include "src/factory.h" | 8 #include "src/factory.h" |
| 9 #include "src/globals.h" |
| 10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 | 15 |
| 16 // The number of generations for each sub cache. | 16 // The number of generations for each sub cache. |
| 17 static const int kRegExpGenerations = 2; | 17 static const int kRegExpGenerations = 2; |
| 18 | 18 |
| 19 // Initial size of each compilation cache table allocated. | 19 // Initial size of each compilation cache table allocated. |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 MaybeHandle<SharedFunctionInfo> CompilationCache::LookupEval( | 301 MaybeHandle<SharedFunctionInfo> CompilationCache::LookupEval( |
| 302 Handle<String> source, Handle<SharedFunctionInfo> outer_info, | 302 Handle<String> source, Handle<SharedFunctionInfo> outer_info, |
| 303 Handle<Context> context, LanguageMode language_mode, int scope_position) { | 303 Handle<Context> context, LanguageMode language_mode, int scope_position) { |
| 304 if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>(); | 304 if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>(); |
| 305 | 305 |
| 306 MaybeHandle<SharedFunctionInfo> result; | 306 MaybeHandle<SharedFunctionInfo> result; |
| 307 if (context->IsNativeContext()) { | 307 if (context->IsNativeContext()) { |
| 308 result = | 308 result = |
| 309 eval_global_.Lookup(source, outer_info, language_mode, scope_position); | 309 eval_global_.Lookup(source, outer_info, language_mode, scope_position); |
| 310 } else { | 310 } else { |
| 311 DCHECK(scope_position != RelocInfo::kNoPosition); | 311 DCHECK(scope_position != kNoSourcePosition); |
| 312 result = eval_contextual_.Lookup(source, outer_info, language_mode, | 312 result = eval_contextual_.Lookup(source, outer_info, language_mode, |
| 313 scope_position); | 313 scope_position); |
| 314 } | 314 } |
| 315 return result; | 315 return result; |
| 316 } | 316 } |
| 317 | 317 |
| 318 | 318 |
| 319 MaybeHandle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, | 319 MaybeHandle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, |
| 320 JSRegExp::Flags flags) { | 320 JSRegExp::Flags flags) { |
| 321 if (!IsEnabled()) return MaybeHandle<FixedArray>(); | 321 if (!IsEnabled()) return MaybeHandle<FixedArray>(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 338 Handle<SharedFunctionInfo> outer_info, | 338 Handle<SharedFunctionInfo> outer_info, |
| 339 Handle<Context> context, | 339 Handle<Context> context, |
| 340 Handle<SharedFunctionInfo> function_info, | 340 Handle<SharedFunctionInfo> function_info, |
| 341 int scope_position) { | 341 int scope_position) { |
| 342 if (!IsEnabled()) return; | 342 if (!IsEnabled()) return; |
| 343 | 343 |
| 344 HandleScope scope(isolate()); | 344 HandleScope scope(isolate()); |
| 345 if (context->IsNativeContext()) { | 345 if (context->IsNativeContext()) { |
| 346 eval_global_.Put(source, outer_info, function_info, scope_position); | 346 eval_global_.Put(source, outer_info, function_info, scope_position); |
| 347 } else { | 347 } else { |
| 348 DCHECK(scope_position != RelocInfo::kNoPosition); | 348 DCHECK(scope_position != kNoSourcePosition); |
| 349 eval_contextual_.Put(source, outer_info, function_info, scope_position); | 349 eval_contextual_.Put(source, outer_info, function_info, scope_position); |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 | 352 |
| 353 | 353 |
| 354 | 354 |
| 355 void CompilationCache::PutRegExp(Handle<String> source, | 355 void CompilationCache::PutRegExp(Handle<String> source, |
| 356 JSRegExp::Flags flags, | 356 JSRegExp::Flags flags, |
| 357 Handle<FixedArray> data) { | 357 Handle<FixedArray> data) { |
| 358 if (!IsEnabled()) { | 358 if (!IsEnabled()) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 397 |
| 398 | 398 |
| 399 void CompilationCache::Disable() { | 399 void CompilationCache::Disable() { |
| 400 enabled_ = false; | 400 enabled_ = false; |
| 401 Clear(); | 401 Clear(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 | 404 |
| 405 } // namespace internal | 405 } // namespace internal |
| 406 } // namespace v8 | 406 } // namespace v8 |
| OLD | NEW |