Exemplo n.º 1
0
            public void Execute(CodeGenerationInfo cgInfo)
            {
                Debug.WriteLine("Begun TI for function {0}", cgInfo.FuncMetadata.Declaration);
                _cgInfo = cgInfo;
                _worklist.Clear();
                ++_passNumber;

                InitializeSymbolTypes();

                _typeCalculator = new TypeCalculator();
                _typeCalculator.Execute(cgInfo);

                while (_worklist.Count > 0)
                {
                    var exp = _worklist.Dequeue();
                    VisitNode(exp);
                }

                ///It may happen that even after TI, still some symbol.ValueType==Unknown
                ///In these cases, we just assign a default type to them and see if any types change
                foreach (var symbol in _cgInfo.FuncMetadata.Scope.Symbols)
                {
                    if (GetType(symbol) == mdr.ValueTypes.Unknown)
                    {
                        SetType(symbol, mdr.ValueTypes.DValueRef);
                    }
                }
                while (_worklist.Count > 0)
                {
                    var exp = _worklist.Dequeue();
                    VisitNode(exp);
                }
                Debug.WriteLine("Ended TI for function {0}", cgInfo.FuncMetadata.Declaration);
            }
Exemplo n.º 2
0
 public void Execute(CodeGenerationInfo cgInfo)
 {
   _currFuncMetadata = cgInfo.FuncMetadata;
   _currFuncCode = cgInfo.FuncCode;
   _ilGen = cgInfo.IlGen;
   Execute();
 }
Exemplo n.º 3
0
 public void Execute(CodeGenerationInfo cgInfo)
 {
     _currFuncMetadata = cgInfo.FuncMetadata;
     _currFuncCode     = cgInfo.FuncCode;
     _ilGen            = cgInfo.IlGen;
     Execute();
 }
Exemplo n.º 4
0
            public void Execute(CodeGenerationInfo cgInfo)
            {
                _functionsBeingInlined.Clear();
                _functionsBeingInlined.AddLast(cgInfo.FuncMetadata);

                InlineScope(cgInfo.FuncMetadata.Scope, cgInfo.FuncCode.Profiler);

                _functionsBeingInlined.RemoveLast();
                Debug.Assert(_functionsBeingInlined.Count == 0, "Invalid situation");
            }
Exemplo n.º 5
0
      public void Execute(CodeGenerationInfo cgInfo)
      {
        _functionsBeingInlined.Clear();
        _functionsBeingInlined.AddLast(cgInfo.FuncMetadata);

        InlineScope(cgInfo.FuncMetadata.Scope, cgInfo.FuncCode.Profiler);

        _functionsBeingInlined.RemoveLast();
        Debug.Assert(_functionsBeingInlined.Count == 0, "Invalid situation");
      }
Exemplo n.º 6
0
        public void Execute(CodeGenerationInfo cgInfo)
        {
            if (JSRuntime.Instance.Configuration.ProfileStats)
            {
                JSRuntime.Instance.Counters.GetCounter(Name).Count++;
            }

            var timer =
                JSRuntime.Instance.Configuration.ProfileFunctionTime
          ? JSRuntime.StartTimer(TimerCondition(), Name + cgInfo.FuncMetadata.Declaration)
          : JSRuntime.StartTimer(TimerCondition(), Name);

            try
            {
                var alg = Allocate();
                alg.Execute(cgInfo);
                Release(alg);
            }
            finally
            {
                JSRuntime.StopTimer(timer);
            }
        }
Exemplo n.º 7
0
 public static void Execute(CodeGenerationInfo cgInfo) { _pool.Execute(cgInfo); }
Exemplo n.º 8
0
    public void Execute(CodeGenerationInfo cgInfo)
    {
      _cgInfo = cgInfo;
      _currProfile = _cgInfo.FuncCode.Profiler;
      GuardedCastProfile = new Dictionary<GuardedCast, Profiler>();
      VisitedWriteTemporaries = new HashSet<WriteTemporaryExpression>();

      VisitNode(cgInfo.FuncMetadata.FunctionIR.Statement);
    }
Exemplo n.º 9
0
 public void Execute(CodeGenerationInfo cgInfo) { throw new NotImplementedException(); }
Exemplo n.º 10
0
 public void Execute(CodeGenerationInfo cgInfo)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 11
0
 public static void Execute(CodeGenerationInfo cgInfo)
 {
     _pool.Execute(cgInfo);
 }
Exemplo n.º 12
0
    void GenerateCode(JSFunctionCode funcCode, ILGen.BaseILGenerator ilGen, bool enableSpeculation)
    {
      var cgInfo = new CodeGenerationInfo(this, funcCode, ilGen);

      ///This is where we are giong to make different decistions aboud different Phases and passes

      if (JSRuntime.Instance.Configuration.EnableLightCompiler)
      {
        CodeGeneratorLight.Execute(cgInfo);
      }
      else
      {
        if (JSRuntime.Instance.Configuration.EnableFunctionInlining)
          FunctionInliner.Execute(cgInfo);
        if (EnableTypeInference)
          TypeInferer.Execute(cgInfo);

        if (enableSpeculation && !IsBlackListed)
        {
          CodeGen.CodeGeneratorWithInlineCache.Execute(this);
          try {
              CodeGeneratorWithSpecialization.Execute(cgInfo);
          }
          catch(JSDeoptFailedException e) {
              IsBlackListed = true;
	            ilGen = CreateStub(funcCode, false);
	            cgInfo = new CodeGenerationInfo(this, funcCode, ilGen);
              funcCode.Profiler = null;
              if (EnableTypeInference)
                  TypeInferer.Execute(cgInfo);
	      CodeGenerator.Execute(cgInfo);
          }
        }
        else
        {
          if (this.EnableProfiling && !IsBlackListed)
            CodeGeneratorWithProfiling.Execute(cgInfo);
          else
            CodeGenerator.Execute(cgInfo);
        }
        var method = ilGen.EndJittedMethod(this, funcCode);
        if (enableSpeculation && !IsBlackListed)
          funcCode.SpecializedMethod = method;
        else
          funcCode.GenericMethod = method;
      }
    }