Пример #1
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();
      }
Пример #2
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();
      }
      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);
        }
      }
Пример #4
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();
      }