Home | History | Annotate | Download | only in src

Lines Matching refs:Code

2 // Use of this source code is governed by a BSD-style license that can be
50 Code* Deoptimizer::FindDeoptimizingCode(Address addr) {
52 // Search all deoptimizing code in the native context of the function.
57 Code* code = Code::cast(element);
58 CHECK(code->kind() == Code::OPTIMIZED_FUNCTION);
59 if (code->contains(addr)) return code;
60 element = code->next_code_link();
67 // We rely on this function not causing a GC. It is called from generated code
151 // no longer refer to optimized code.
158 if (function->code()->kind() != Code::OPTIMIZED_FUNCTION ||
160 function->code()->kind() != Code::OPTIMIZED_FUNCTION)) {
161 // The function no longer refers to optimized code, or the visitor
162 // changed the code to which it refers to no longer be optimized code.
202 // Unlink functions referring to code marked for deoptimization, then move
203 // marked code from the optimized code list to the deoptimized code list,
204 // and patch code for lazy deopt.
208 // A "closure" that unlinks optimized code that is going to be
215 Code* code = function->code();
216 if (!code->marked_for_deoptimization()) return;
218 // Unlink this function and evict from optimized code map.
220 function->set_code(shared->code());
223 CodeTracer::Scope scope(code->GetHeap()->isolate()->GetCodeTracer());
232 // Unlink all functions that refer to marked code.
238 Code* topmost_optimized_code = NULL;
240 // Make sure all activations of optimized code can deopt at their current PC.
241 // The topmost optimized code has special handling because it cannot be
247 Code* code = it.frame()->LookupCode();
257 SafepointEntry safepoint = code->GetSafepointEntry(it.frame()->pc());
261 code->is_turbofanned() && function->shared()->asm_function();
264 bool builtin = code->kind() == Code::BUILTIN;
268 topmost_optimized_code = code;
275 // Move marked code from the optimized code list to the deoptimized
276 // code list, collecting them into a ZoneList.
278 ZoneList<Code*> codes(10, &zone);
280 // Walk over all optimized code objects in this native context.
281 Code* prev = NULL;
284 Code* code = Code::cast(element);
285 CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION);
286 Object* next = code->next_code_link();
288 if (code->marked_for_deoptimization()) {
289 // Put the code into the list for later patching.
290 codes.Add(code, &zone);
293 // Skip this code in the optimized code list.
300 // Move the code to the _deoptimized_ code list.
301 code->set_next_code_link(context->DeoptimizedCodeListHead());
302 context->SetDeoptimizedCodeListHead(code);
305 prev = code;
311 // which is used in code patching in EnsureCodeForDeoptimizationEntry.
321 // It is finally time to die, code object.
323 // Remove the code from optimized code map.
328 shared->EvictFromOptimizedCodeMap(codes[i], "deoptimized code");
334 // Tell collector to treat this code object in a special way and
348 PrintF(scope.file(), "[deoptimize all code in all contexts]\n");
351 // For all contexts, mark all code, then deoptimize.
369 PrintF(scope.file(), "[deoptimize marked code in all contexts]\n");
372 // For all contexts, deoptimize code already marked.
386 Code* code = Code::cast(element);
387 CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION);
388 code->set_marked_for_deoptimization(true);
389 element = code->next_code_link();
393 void Deoptimizer::DeoptimizeFunction(JSFunction* function, Code* code) {
399 if (code == nullptr) code = function->code();
400 if (code->kind() == Code::OPTIMIZED_FUNCTION) {
401 // Mark the code for deoptimization and unlink any functions that also
402 // refer to that code. The code cannot be shared across native contexts,
404 code->set_marked_for_deoptimization(true);
479 DCHECK(compiled_code_->kind() != Code::FUNCTION);
493 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
505 Code* Deoptimizer::FindOptimizedCode(JSFunction* function) {
506 Code* compiled_code = FindDeoptimizingCode(from_);
508 ? static_cast<Code*>(isolate_->FindCodeObject(from_))
518 "%s", Code::Kind2String(compiled_code_->kind()));
607 // Count all entries in the deoptimizing code list of every context.
613 Code* code = Code::cast(element);
614 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION);
616 element = code->next_code_link();
631 Code* non_optimized_code = function->shared()->code();
654 // We rely on this function not causing a GC. It is called from generated code
669 stack_fp_ = input_->GetRegister(fp_reg.code());
874 // function code and AST id of the bailout.
900 output_frame->SetRegister(fp_reg.code(), fp_value);
939 // the activation. This should only apply to Crankshaft code.
976 input_->GetRegister(FullCodeGenerator::result_register().code()));
984 Code* non_optimized_code = shared->code();
992 output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value);
1021 output_frame->SetRegister(context_reg.code(), context_value);
1027 Code* continuation = builtins->builtin(Builtins::kNotifyDeoptimized);
1120 // function code and AST id of the bailout.
1146 output_frame->SetRegister(fp_reg.code(), fp_value);
1247 input_->GetRegister(FullCodeGenerator::result_register().code());
1268 Code* dispatch_builtin =
1285 code(), constant_pool_value);
1295 output_frame->SetRegister(context_reg.code(), context_value);
1300 Code* continuation = builtins->builtin(Builtins::kNotifyDeoptimized);
1421 Code* adaptor_trampoline =
1509 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric);
1580 output_frame->SetRegister(fp_reg.code(), fp_value);
1635 value = input_->GetRegister(result_reg.code());
1664 output_frame->SetRegister(constant_pool_reg.code(), fp_value);
1674 output_frame->SetRegister(context_reg.code(), context_value);
1681 Code* continuation = builtins->builtin(Builtins::kNotifyLazyDeoptimized);
1726 // StackFrame::INTERNAL (FP, frame type, context, code object and constant
1767 output_frame->SetRegister(fp_reg.code(), fp_value);
1789 // Get Code object from accessor stub.
1794 Code* accessor_stub = isolate_->builtins()->builtin(name);
1797 DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n");
1821 value = input_->GetRegister(result_reg.code());
1850 output_frame->SetRegister(constant_pool_reg.code(), fp_value);
1860 output_frame->SetRegister(context_reg.code(), context_value);
1867 Code* continuation = builtins->builtin(Builtins::kNotifyLazyDeoptimized);
1963 output_frame->SetRegister(fp_reg.code(), frame_ptr);
2036 output_frame->SetRegister(context_reg.code(), value);
2057 // We know it's a smi because 1) the code stub guarantees the stack
2080 Code* trampoline = NULL;
2093 output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value);
2097 Code* notify_failure =
2200 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
2235 unsigned Deoptimizer::ComputeOutgoingArgumentSize(Code* code,
2238 DeoptimizationInputData::cast(code->deoptimization_data());
2248 // references. This is fine because the deoptimizer's code section
2417 buffer_->Add(reg.code());
2423 buffer_->Add(reg.code());
2429 buffer_->Add(reg.code());
2435 buffer_->Add(reg.code());
2440 buffer_->Add(reg.code());
2445 buffer_->Add(reg.code());
2715 // For full-code frames, we should not count the context.
2735 Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, Address pc) {
2736 CHECK(code->instruction_start() <= pc && pc <= code->instruction_end());
2744 for (RelocIterator it(code, mask); !it.done(); it.next()) {
2767 Code* code = shared->code();
2768 FixedArray* raw_data = code->deoptimization_data();
2773 return AbstractCode::cast(code)->SourcePosition(code_offset);
3825 isolate_->factory()->empty_string(), MaybeHandle<Code>(), false);