Ejemplo 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);
        }
Ejemplo 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();
      }
Ejemplo n.º 3
0
 public override void Visit(ReadPropertyExpression node) { Visit((ReadIndexerExpression)node); }
Ejemplo n.º 4
0
 public override void Visit(ReadPropertyExpression node) { base.Visit(node); node.ValueType = GetType(node); }
Ejemplo 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);
        }
      }
Ejemplo n.º 7
0
      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();
      }
Ejemplo n.º 8
0
 public override void Visit(ReadPropertyExpression node)
 {
     Visit((ReadIndexerExpression)node);
 }
Ejemplo 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;
    }
Ejemplo n.º 10
0
 public abstract void Visit(ReadPropertyExpression node);
Ejemplo 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();
      }
Ejemplo n.º 12
0
 public override void Visit(ReadPropertyExpression node)
 {
   throw new NotImplementedException();
 }
Ejemplo n.º 13
0
 public override void Visit(ReadPropertyExpression node) { AssignToImplicitReturn(node); }