void CodeGenWorkItem::OnRemoveFromJitQueue(NativeCodeGenerator* generator) { // This is called from within the lock this->isInJitQueue = false; this->entryPointInfo->SetCodeGenPending(); functionBody->GetScriptContext()->GetThreadContext()->UnregisterCodeGenRecyclableData(this->recyclableData); this->recyclableData = nullptr; if(IS_JS_ETW(EventEnabledJSCRIPT_FUNCTION_JIT_DEQUEUED())) { WCHAR displayNameBuffer[256]; WCHAR* displayName = displayNameBuffer; size_t sizeInChars = this->GetDisplayName(displayName, 256); if(sizeInChars > 256) { displayName = HeapNewArray(WCHAR, sizeInChars); this->GetDisplayName(displayName, 256); } JS_ETW(EventWriteJSCRIPT_FUNCTION_JIT_DEQUEUED( this->GetFunctionNumber(), displayName, this->GetScriptContext(), this->GetInterpretedCount())); if(displayName != displayNameBuffer) { HeapDeleteArray(sizeInChars, displayName); } } if(this->Type() == JsLoopBodyWorkItemType) { // Go ahead and delete it and let it re-queue if more interpreting of the loop happens auto loopBodyWorkItem = static_cast<JsLoopBodyCodeGen*>(this); loopBodyWorkItem->loopHeader->ResetInterpreterCount(); loopBodyWorkItem->GetEntryPoint()->Reset(); HeapDelete(loopBodyWorkItem); } else { Assert(GetJitMode() == ExecutionMode::FullJit); // simple JIT work items are not removed from the queue GetFunctionBody()->OnFullJitDequeued(static_cast<Js::FunctionEntryPointInfo *>(GetEntryPoint())); // Add it back to the list of available functions to be jitted generator->AddWorkItem(this); } }
std::string Demacrofier::DemacrofyFunctionLikePostponed(const PPMacro *m_ptr)const { std::stringstream demacrofied_line; std::string type_str = "auto"; // no need to get rid of these variables by putting the function calls // at the usage, compilers are pretty good at doing this std::string fun_closure = GetFunctionClosure(m_ptr); std::string fun_args = GetFunctionArgs(m_ptr); std::string fun_body = GetFunctionBody(m_ptr); demacrofied_line << type_str << " " << m_ptr->get_identifier().get_value() << " = [" << fun_closure << "](" << fun_args << ") { return " << fun_body << "; };\n"; return demacrofied_line.str(); }
std::string Demacrofier::DemacrofyObjectLikePostponed(const PPMacro *m_ptr)const { // [closure] ()-> void {fun_body;} std::stringstream demacrofied_line; std::string type_str = "auto"; // no need to get rid of these variables by putting the function calls // at the usage, compilers are pretty good at doing this std::string fun_closure = GetFunctionClosure(m_ptr); //std::string fun_args = GetFunctionArgs(m_ptr); std::string fun_body = GetFunctionBody(m_ptr); demacrofied_line << type_str << " " << m_ptr->get_identifier().get_value() << " = [" << fun_closure << "]()->void { " << fun_body // if it already has a semicolon or not // if(!(m_ptr->get_replacement_list().get_replacement_list_token_type()).statement_type) // demacrofied_line << ";"; << " ; };\n"; return demacrofied_line.str(); }