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 |
37 Handle<Code> code; | 52 Handle<Code> code; |
38 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, code, | 53 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, code, |
39 Compiler::GetLazyCode(function)); | 54 Compiler::GetLazyCode(function)); |
40 DCHECK(code->IsJavaScriptCode()); | 55 DCHECK(code->IsJavaScriptCode()); |
41 | 56 |
42 function->ReplaceCode(*code); | 57 function->ReplaceCode(*code); |
| 58 JSFunction::EnsureLiterals(function); |
43 return *code; | 59 return *code; |
44 } | 60 } |
45 | 61 |
46 | 62 |
47 namespace { | 63 namespace { |
48 | 64 |
49 Object* CompileOptimized(Isolate* isolate, Handle<JSFunction> function, | 65 Object* CompileOptimized(Isolate* isolate, Handle<JSFunction> function, |
50 Compiler::ConcurrencyMode mode) { | 66 Compiler::ConcurrencyMode mode) { |
51 StackLimitCheck check(isolate); | 67 StackLimitCheck check(isolate); |
52 if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow(); | 68 if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow(); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 DCHECK(is_valid_language_mode(args.smi_at(3))); | 441 DCHECK(is_valid_language_mode(args.smi_at(3))); |
426 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); | 442 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); |
427 DCHECK(args[4]->IsSmi()); | 443 DCHECK(args[4]->IsSmi()); |
428 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 444 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
429 isolate); | 445 isolate); |
430 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 446 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
431 language_mode, args.smi_at(4)); | 447 language_mode, args.smi_at(4)); |
432 } | 448 } |
433 } // namespace internal | 449 } // namespace internal |
434 } // namespace v8 | 450 } // namespace v8 |
OLD | NEW |