| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
| 8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
| 9 #include "src/serialize.h" | 9 #include "src/serialize.h" |
| 10 | 10 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 | 324 |
| 325 | 325 |
| 326 MaybeHandle<SharedFunctionInfo> CompilationCache::LookupEval( | 326 MaybeHandle<SharedFunctionInfo> CompilationCache::LookupEval( |
| 327 Handle<String> source, | 327 Handle<String> source, |
| 328 Handle<Context> context, | 328 Handle<Context> context, |
| 329 StrictMode strict_mode, | 329 StrictMode strict_mode, |
| 330 int scope_position) { | 330 int scope_position) { |
| 331 if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>(); | 331 if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>(); |
| 332 | 332 |
| 333 MaybeHandle<SharedFunctionInfo> result; | 333 MaybeHandle<SharedFunctionInfo> result; |
| 334 if (context->IsNativeContext()) { | 334 if (context->IsNativeContext() || context->IsGlobalContext()) { |
| 335 result = eval_global_.Lookup( | 335 result = eval_global_.Lookup( |
| 336 source, context, strict_mode, scope_position); | 336 source, context, strict_mode, scope_position); |
| 337 } else { | 337 } else { |
| 338 ASSERT(scope_position != RelocInfo::kNoPosition); | 338 ASSERT(scope_position != RelocInfo::kNoPosition); |
| 339 result = eval_contextual_.Lookup( | 339 result = eval_contextual_.Lookup( |
| 340 source, context, strict_mode, scope_position); | 340 source, context, strict_mode, scope_position); |
| 341 } | 341 } |
| 342 return result; | 342 return result; |
| 343 } | 343 } |
| 344 | 344 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 360 } | 360 } |
| 361 | 361 |
| 362 | 362 |
| 363 void CompilationCache::PutEval(Handle<String> source, | 363 void CompilationCache::PutEval(Handle<String> source, |
| 364 Handle<Context> context, | 364 Handle<Context> context, |
| 365 Handle<SharedFunctionInfo> function_info, | 365 Handle<SharedFunctionInfo> function_info, |
| 366 int scope_position) { | 366 int scope_position) { |
| 367 if (!IsEnabled()) return; | 367 if (!IsEnabled()) return; |
| 368 | 368 |
| 369 HandleScope scope(isolate()); | 369 HandleScope scope(isolate()); |
| 370 if (context->IsNativeContext()) { | 370 if (context->IsNativeContext() || context->IsGlobalContext()) { |
| 371 eval_global_.Put(source, context, function_info, scope_position); | 371 eval_global_.Put(source, context, function_info, scope_position); |
| 372 } else { | 372 } else { |
| 373 ASSERT(scope_position != RelocInfo::kNoPosition); | 373 ASSERT(scope_position != RelocInfo::kNoPosition); |
| 374 eval_contextual_.Put(source, context, function_info, scope_position); | 374 eval_contextual_.Put(source, context, function_info, scope_position); |
| 375 } | 375 } |
| 376 } | 376 } |
| 377 | 377 |
| 378 | 378 |
| 379 | 379 |
| 380 void CompilationCache::PutRegExp(Handle<String> source, | 380 void CompilationCache::PutRegExp(Handle<String> source, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 } | 421 } |
| 422 | 422 |
| 423 | 423 |
| 424 void CompilationCache::Disable() { | 424 void CompilationCache::Disable() { |
| 425 enabled_ = false; | 425 enabled_ = false; |
| 426 Clear(); | 426 Clear(); |
| 427 } | 427 } |
| 428 | 428 |
| 429 | 429 |
| 430 } } // namespace v8::internal | 430 } } // namespace v8::internal |
| OLD | NEW |