| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 function->PrintName(); | 27 function->PrintName(); |
| 28 PrintF("]\n"); | 28 PrintF("]\n"); |
| 29 } | 29 } |
| 30 #endif | 30 #endif |
| 31 StackLimitCheck check(isolate); | 31 StackLimitCheck check(isolate); |
| 32 if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow(); | 32 if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow(); |
| 33 | 33 |
| 34 // Compile the target function. | 34 // Compile the target function. |
| 35 DCHECK(function->shared()->allows_lazy_compilation()); | 35 DCHECK(function->shared()->allows_lazy_compilation()); |
| 36 | 36 |
| 37 // There is one special case where we have optimized code but we | |
| 38 // couldn't find a literals array for the native context. That's with | |
| 39 // FLAG_turbo_cache_shared_code. | |
| 40 if (FLAG_turbo_cache_shared_code) { | |
| 41 SharedFunctionInfo* shared = function->shared(); | |
| 42 CodeAndLiterals result; | |
| 43 result = shared->SearchOptimizedCodeMap(*isolate->native_context(), | |
| 44 BailoutId::None()); | |
| 45 if (result.code != nullptr) { | |
| 46 function->ReplaceCode(result.code); | |
| 47 JSFunction::EnsureLiterals(function); | |
| 48 return result.code; | |
| 49 } | |
| 50 } | |
| 51 | |
| 52 Handle<Code> code; | 37 Handle<Code> code; |
| 53 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, code, | 38 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, code, |
| 54 Compiler::GetLazyCode(function)); | 39 Compiler::GetLazyCode(function)); |
| 55 DCHECK(code->IsJavaScriptCode()); | 40 DCHECK(code->IsJavaScriptCode()); |
| 56 | 41 |
| 57 function->ReplaceCode(*code); | 42 function->ReplaceCode(*code); |
| 58 JSFunction::EnsureLiterals(function); | |
| 59 return *code; | 43 return *code; |
| 60 } | 44 } |
| 61 | 45 |
| 62 | 46 |
| 63 namespace { | 47 namespace { |
| 64 | 48 |
| 65 Object* CompileOptimized(Isolate* isolate, Handle<JSFunction> function, | 49 Object* CompileOptimized(Isolate* isolate, Handle<JSFunction> function, |
| 66 Compiler::ConcurrencyMode mode) { | 50 Compiler::ConcurrencyMode mode) { |
| 67 StackLimitCheck check(isolate); | 51 StackLimitCheck check(isolate); |
| 68 if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow(); | 52 if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow(); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 DCHECK(is_valid_language_mode(args.smi_at(3))); | 425 DCHECK(is_valid_language_mode(args.smi_at(3))); |
| 442 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); | 426 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); |
| 443 DCHECK(args[4]->IsSmi()); | 427 DCHECK(args[4]->IsSmi()); |
| 444 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 428 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
| 445 isolate); | 429 isolate); |
| 446 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 430 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
| 447 language_mode, args.smi_at(4)); | 431 language_mode, args.smi_at(4)); |
| 448 } | 432 } |
| 449 } // namespace internal | 433 } // namespace internal |
| 450 } // namespace v8 | 434 } // namespace v8 |
| OLD | NEW |