Esempio n. 1
0
        private ReadIndexerExpression MakeReadIndexerExpression(Expression container, Expression index)
        {
            StringLiteral         constIndex = index as StringLiteral;
            int                   integerIndex;
            ReadIndexerExpression n;

            //We need to make sure that the string is not an integer, because in the case of Arrays integer strings are equivalent to integers!!
            if (constIndex != null && !int.TryParse(constIndex.Value, out integerIndex))
            {
                n = new ReadPropertyExpression(MakeToObject((Expression)container), constIndex);
            }
            else
            {
                n = new ReadIndexerExpression(MakeToObject((Expression)container), (Expression)index);
            }
            return(n);
        }
Esempio n. 2
0
      public override void Visit(ReadPropertyExpression node)
      {
        PushLocation(node);

        var value = _localVars.PushTemporary(Types.DValue.TypeOf);
        var stackState = _localVars.GetTemporaryStackState();

        VisitNode(node.Container);
        AsDObject();
        node.AssignFieldId();
        _ilGen.Ldc_I4(node.FieldId);
        _ilGen.Ldloca(value);
        _ilGen.Call(Types.DObject.GetFieldByFieldId_Int32_DValueRef);

        _localVars.PopTemporariesAfter(stackState);

        _ilGen.Ldloca(value);
        _result.ValueType = mdr.ValueTypes.DValueRef;

        PopLocation();
      }
Esempio n. 3
0
 public override void Visit(ReadPropertyExpression node) { Visit((ReadIndexerExpression)node); }
Esempio n. 4
0
 public override void Visit(ReadPropertyExpression node) { base.Visit(node); node.ValueType = GetType(node); }
Esempio n. 5
0
 internal static mdr.ValueTypes GetType(ReadPropertyExpression expression) { return mdr.ValueTypes.DValueRef; }
      public override void Visit(ReadPropertyExpression node)
      {
        var nodeProfile = _currProfiler.GetNodeProfile(node);
        if (_currFuncMetadata.EnableInlineCache
          && nodeProfile != null
          && nodeProfile.Map != null
          && nodeProfile.PD != null
          && nodeProfile.PD.IsDataDescriptor
          && !nodeProfile.PD.IsInherited)
        {
          PushLocation(node);

          var value = _localVars.PushTemporary(Types.DValue.TypeOf);
          var stackState = _localVars.GetTemporaryStackState();

          VisitNode(node.Container);
          AsDObject();
          node.AssignFieldId();
          _ilGen.Ldc_I4(node.FieldId);
          _ilGen.Ldloca(value);

          _ilGen.Ldc_I4(nodeProfile.Map.UniqueId);
          _ilGen.Ldc_I4(nodeProfile.PD.Index);
          _ilGen.Call(Types.Operations.Internals.GetFieldUsingIC);

          _ilGen.Ldloca(value);
          _result.ValueType = mdr.ValueTypes.DValueRef;

          PopLocation();
        }
        else if (_currFuncMetadata.EnableInlineCache
          && nodeProfile != null
          && nodeProfile.Map != null
          && nodeProfile.PD != null
          && nodeProfile.PD.IsDataDescriptor
          && nodeProfile.PD.IsInherited)
        {
          int inheritCacheIndex = JSRuntime.UpdateInheritPropertyObjectCache(nodeProfile.PD);
          if (inheritCacheIndex != -1)
          {
            PushLocation(node);
            var value = _localVars.PushTemporary(Types.DValue.TypeOf);
            VisitNode(node.Container);
            AsDObject();
            node.AssignFieldId();
            _ilGen.Ldc_I4(node.FieldId);

            _ilGen.Ldloca(value);
            _ilGen.Ldc_I4(nodeProfile.Map.UniqueId);
            _ilGen.Ldc_I4(nodeProfile.PD.Index);
            _ilGen.Ldc_I4(inheritCacheIndex);
            _ilGen.Call(Types.Operations.Internals.GetInheritFieldUsingIC);
            _ilGen.Ldloca(value);
            _result.ValueType = mdr.ValueTypes.DValueRef;
            PopLocation();
          }
          else
          {
            base.Visit(node);
          }
        }
        else
        {
//          if (nodeProfile == null)
//            nodeProfile.PD.HasAttributes(mdr.PropertyDescriptor.Attributes.NotConfigurable))
//            Trace.WriteLine("Missing profile data {0} {1} {2}!", node, node.ProfileIndex, _currFuncMetadata);

          base.Visit(node);
        }
      }
      public override void Visit(ReadPropertyExpression node)
      {
        PushLocation(node);

        VisitNode(node.Container);
        node.AssignFieldId();

        _stackModel.Pop(1);

        BeginICMethod(node);
        _ilGen.Ldarg_CallFrame();
        _ilGen.Ldc_I4(_stackModel.StackPointer);
        _ilGen.Ldc_I4(node.FieldId);
        _ilGen.Call(Types.Operations.ICMethods.ReadProperty);
        EndICMethod();

        _stackModel.Push(1);

        PopLocation();
      }
Esempio n. 8
0
 public override void Visit(ReadPropertyExpression node)
 {
     Visit((ReadIndexerExpression)node);
 }
Esempio n. 9
0
    private ReadIndexerExpression MakeReadIndexerExpression(Expression container, Expression index)
    {
      StringLiteral constIndex = index as StringLiteral;
      int integerIndex;
      ReadIndexerExpression n;

      //We need to make sure that the string is not an integer, because in the case of Arrays integer strings are equivalent to integers!!
      if (constIndex != null && !int.TryParse(constIndex.Value, out integerIndex))
        n = new ReadPropertyExpression(MakeToObject((Expression)container), constIndex);
      else
        n = new ReadIndexerExpression(MakeToObject((Expression)container), (Expression)index);
      return n;
    }
Esempio n. 10
0
 public abstract void Visit(ReadPropertyExpression node);
Esempio n. 11
0
      public override void Visit(ReadPropertyExpression node)
      {
        PushLocation(node);

        VisitNode(node.Container);

        node.AssignFieldId();
        _ilGen.Ldc_I4(node.FieldId);

        var popOperandCount = 1;// node.UserIsFunction ? 0 : 1; //Leave object for This if user is function
        _ilGen.Ldc_I4(popOperandCount);
        Call(Types.Operations.Stack.LoadFieldByFieldId, popOperandCount, 1);

        PopLocation();
      }
Esempio n. 12
0
 public override void Visit(ReadPropertyExpression node)
 {
   throw new NotImplementedException();
 }
Esempio n. 13
0
 public override void Visit(ReadPropertyExpression node) { AssignToImplicitReturn(node); }