Lines Matching refs:Code
2 // Use of this source code is governed by a BSD-style license that can be
37 #include "src/snapshot/code-serializer.h"
166 code_size = info()->code()->SizeIncludingMetadata();
217 Handle<Code> code) {
218 Handle<WeakCell> cell = Code::WeakCellFor(code);
232 void CompilationJob::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) {
234 Isolate* const isolate = code->GetIsolate();
235 DCHECK(code->is_optimized_code());
242 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
245 code->IsWeakObjectInOptimizedCode(it.rinfo()->target_cell())) {
248 code->IsWeakObjectInOptimizedCode(
264 Map::AddDependentCode(map, DependentCode::kWeakCodeGroup, code);
267 AddWeakObjectToCodeDependency(isolate, object, code);
269 code->set_can_have_weak_objects(true);
279 // Log the code generation. If source information is available include
289 : Handle<AbstractCode>::cast(info->code());
314 // when the function is not compiled (i.e. no code was serialized).
338 // 1. "use asm" code.
354 // Code which can't be supported by the old pipeline should use Ignition.
359 // underlying code to be based on the bytecode array.
365 // Skip Ignition for asm wasm code.
370 // When requesting debug code as a replacement for existing code, we provide
371 // the same kind as the existing code (to prevent implicit tier-change).
376 // Code destined for TurboFan should be compiled with Ignition first.
430 // TODO(mstarzinger): Compiling for debug code might be used to reveal inner
436 DCHECK(!info->code().is_null());
437 shared->ReplaceCode(*info->code());
459 DCHECK(!info->code().is_null());
461 info->code()->MarkToBeExecutedOnce(info->isolate());
555 // Otherwise generate unoptimized code now.
606 // Disable concurrent inner compilation for asm-wasm code.
647 MUST_USE_RESULT MaybeHandle<Code> GetUnoptimizedCode(
658 return MaybeHandle<Code>();
674 // Compile either unoptimized code or bytecode for the interpreter.
676 return MaybeHandle<Code>();
682 return info->code();
685 MUST_USE_RESULT MaybeHandle<Code> GetCodeFromOptimizedCodeMap(
692 Code* code = shared->SearchOptimizedCodeMap(
694 if (code != nullptr) {
695 // Caching of optimized code enabled and optimized code found.
696 DCHECK(!code->marked_for_deoptimization());
698 return Handle<Code>(code);
700 return MaybeHandle<Code>();
704 Handle<Code> code = info->code();
705 if (code->kind() != Code::OPTIMIZED_FUNCTION) return; // Nothing to do.
717 // Cache optimized context-specific code.
721 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code,
809 MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
823 Handle<Code> cached_code;
830 PrintF("[found optimized code for ");
843 shared->code()->set_profiler_ticks(0);
867 return MaybeHandle<Code>();
875 return MaybeHandle<Code>();
884 if (info->is_osr() && !ignition_osr) return MaybeHandle<Code>();
891 // and the various graph builders hard-code a certain semantic:
921 if (GetOptimizedCodeNow(job.get())) return info->code();
925 return MaybeHandle<Code>();
942 shared->code()->set_profiler_ticks(0);
952 // 3) The code may have already been invalidated due to dependency change.
953 // 4) Code generation may have failed.
971 info->closure()->ReplaceCode(*info->code());
982 info->closure()->ReplaceCode(shared->code());
986 MaybeHandle<Code> GetBaselineCode(Handle<JSFunction> function) {
1003 // Nothing left to do if the function already has baseline code.
1004 if (function->shared()->code()->kind() == Code::FUNCTION) {
1005 return Handle<Code>(function->shared()->code());
1008 // We do not switch to baseline code when the debugger might have created a
1011 return MaybeHandle<Code>();
1014 // Don't generate full-codegen code for functions it can't support.
1016 return MaybeHandle<Code>();
1022 os << "[switching method " << Brief(*function) << " to baseline code]"
1027 if (!parsing::ParseFunction(info.parse_info())) return MaybeHandle<Code>();
1031 // Compile baseline code using the full code generator.
1035 return MaybeHandle<Code>();
1047 return info.code();
1050 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
1060 Handle<Code> cached_code;
1064 PrintF("[found optimized code for ");
1081 // doesn't handle top-level code. We aren't supporting
1083 // tier followed by full-code).
1093 Handle<Code> code;
1096 .ToHandle(&code)) {
1097 return code;
1107 return Handle<Code>(function->shared()->code());
1111 Handle<Code> entry = isolate->builtins()->InterpreterEntryTrampoline();
1119 Handle<Code> result;
1121 isolate, result, GetUnoptimizedCode(&info, Compiler::CONCURRENT), Code);
1124 Handle<Code> opt_code;
1188 // Compile the code.
1247 Handle<Code> code;
1255 code = handle(shared->code(), isolate);
1258 if (!GetLazyCode(function).ToHandle(&code)) {
1266 // Install code on closure.
1267 function->ReplaceCode(*code);
1282 Handle<Code> code;
1283 if (!GetBaselineCode(function).ToHandle(&code)) {
1284 // Baseline generation failed, get unoptimized code.
1286 code = handle(function->shared()->code());
1290 // Install code on closure.
1291 function->ReplaceCode(*code);
1308 Handle<Code> code;
1309 if (!GetOptimizedCode(function, mode).ToHandle(&code)) {
1310 // Optimization failed, get unoptimized code. Unoptimized code must exist
1314 codecode(), isolate);
1317 // Install code on closure.
1318 function->ReplaceCode(*code);
1377 // free as much as possible, since some code expects the old shared function
1401 // TODO(turbofan): In the future, unoptimized code with deopt support could
1419 // Don't generate full-codegen code for functions it can't support.
1427 // If the current code has reloc info for serialization, also include
1428 // reloc info for serialization for the new code, so that deopt support
1430 if (shared->code()->kind() == Code::FUNCTION &&
1431 shared->code()->has_reloc_info_for_serialization()) {
1454 shared->EnableDeoptimizationSupport(*unoptimized.code());
1456 // The existing unoptimized code was replaced with the new one.
1596 // No callback set and code generation disallowed.
1599 // Callback set. Let it decide if code generation is allowed.
1622 // Check if native context allows code generation from
1680 // Then check cached code provided by embedder.
1719 // No cache entry found, or embedder wants a code cache. Compile the script.
1829 // Precondition: code has been parsed and scopes have been analyzed.
1869 Handle<Code> code = Handle<Code>(fun->shared()->code());
1870 Handle<Code> construct_stub = Handle<Code>(fun->shared()->construct_stub());
1872 name, FunctionKind::kNormalFunction, code,
1886 MaybeHandle<Code> Compiler::GetOptimizedCodeForOSR(Handle<JSFunction> function,
1928 Code* code = shared->SearchOptimizedCodeMap(
1930 if (code != nullptr) {
1931 // Caching of optimized code enabled and optimized code found.
1932 DCHECK(!code->marked_for_deoptimization());
1934 function->ReplaceCode(code);