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

Side by Side Diff: src/runtime/runtime-compiler.cc

Issue 1642613002: Reland of Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: %SetCode failed to install literals in cache. Created 4 years, 11 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/runtime/runtime.h ('k') | src/runtime/runtime-function.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 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
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 11 matching lines...) Expand all
64 if (code->kind() != Code::FUNCTION && 80 if (code->kind() != Code::FUNCTION &&
65 code->kind() != Code::OPTIMIZED_FUNCTION) { 81 code->kind() != Code::OPTIMIZED_FUNCTION) {
66 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 82 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
67 isolate, code, Compiler::GetUnoptimizedCode(function)); 83 isolate, code, Compiler::GetUnoptimizedCode(function));
68 } 84 }
69 function->ReplaceCode(*code); 85 function->ReplaceCode(*code);
70 } 86 }
71 87
72 DCHECK(function->code()->kind() == Code::FUNCTION || 88 DCHECK(function->code()->kind() == Code::FUNCTION ||
73 function->code()->kind() == Code::OPTIMIZED_FUNCTION || 89 function->code()->kind() == Code::OPTIMIZED_FUNCTION ||
90 function->code()->is_interpreter_entry_trampoline() ||
74 function->IsInOptimizationQueue()); 91 function->IsInOptimizationQueue());
75 return function->code(); 92 return function->code();
76 } 93 }
77 94
78 } // namespace 95 } // namespace
79 96
80 97
81 RUNTIME_FUNCTION(Runtime_CompileOptimized_Concurrent) { 98 RUNTIME_FUNCTION(Runtime_CompileOptimized_Concurrent) {
82 HandleScope scope(isolate); 99 HandleScope scope(isolate);
83 DCHECK(args.length() == 1); 100 DCHECK(args.length() == 1);
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 DCHECK(is_valid_language_mode(args.smi_at(3))); 440 DCHECK(is_valid_language_mode(args.smi_at(3)));
424 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); 441 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3));
425 DCHECK(args[4]->IsSmi()); 442 DCHECK(args[4]->IsSmi());
426 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), 443 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(),
427 isolate); 444 isolate);
428 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, 445 return CompileGlobalEval(isolate, args.at<String>(1), outer_info,
429 language_mode, args.smi_at(4)); 446 language_mode, args.smi_at(4));
430 } 447 }
431 } // namespace internal 448 } // namespace internal
432 } // namespace v8 449 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698