Exemple #1
0
            public override void Visit(WritePropertyExpression node)
            {
                PushLocation(node);

                var stackState = _localVars.GetTemporaryStackState();

                VisitNode(node.Container);
                AsDObject();
                var objType = _result.ValueType;
                var obj     = _localVars.PushTemporary(objType);

                _ilGen.Stloc(obj);

                node.AssignFieldId();


                var oldMap = _localVars.PushTemporary(Types.PropertyMap.TypeOf);

                _ilGen.Ldloc(obj);
                _ilGen.Call(Types.DObject.GetMap);
                _ilGen.Stloc(oldMap);

                _ilGen.Ldloc(obj);
                _ilGen.Ldc_I4(node.FieldId);
                VisitNode(node.Value);
                var valueType = _result.ValueType;

                _localVars.PopTemporariesAfter(stackState);
                var value = _localVars.PushTemporary(valueType);

                _ilGen.Stloc(value);
                _ilGen.Ldloc(value);
                _ilGen.Call(Types.DObject.SetFieldByFieldId(valueType));

                int profIndex = _currFuncMetadata.GetProfileIndex(node);

                _ilGen.Ldloc(obj);
                _ilGen.Ldloc(_profiler);
                _ilGen.Ldc_I4(profIndex);
                _ilGen.Ldc_I4(node.FieldId);
                _ilGen.Ldloc(oldMap);
                _ilGen.Call(Types.Operations.Internals.UpdateMapProfileForWrite);

                _ilGen.Ldloc(value);
                _result.ValueType = valueType;

                PopLocation();
            }
            public override void Visit(WritePropertyExpression node)
            {
                var nodeProfile = _currProfiler.GetNodeProfile(node);

                if (_currFuncMetadata.EnableInlineCache &&
                    nodeProfile != null &&
                    nodeProfile.Map != null &&
                    nodeProfile.PD != null &&
                    nodeProfile.PD.IsDataDescriptor &&
                    !nodeProfile.PD.IsInherited)
                {
                    ///Let's keep this code as close to base.Visit so that updates are easy,
                    ///even soon we can decide to put this code in a function
                    PushLocation(node);

                    var stackState = _localVars.GetTemporaryStackState();

                    VisitNode(node.Container);
                    AsDObject();
                    var objType = _result.ValueType;
                    var obj     = _localVars.PushTemporary(objType);
                    _ilGen.Stloc(obj);
                    _ilGen.Ldloc(obj);
                    node.AssignFieldId();
                    _ilGen.Ldc_I4(node.FieldId);
                    VisitNode(node.Value);
                    var valueType = _result.ValueType;

                    _localVars.PopTemporariesAfter(stackState);
                    var value = _localVars.PushTemporary(valueType);
                    _ilGen.Stloc(value);

                    _ilGen.Ldloc(value);
                    _ilGen.Ldc_I4(nodeProfile.Map.UniqueId);
                    _ilGen.Ldc_I4(nodeProfile.PD.Index);
                    _ilGen.Call(Types.Operations.Internals.SetFieldUsingIC(valueType));

                    _ilGen.Ldloc(value);
                    _result.ValueType = valueType;

                    PopLocation();
                }
                else
                {
                    base.Visit(node);
                }
            }
Exemple #3
0
 public override void Visit(WritePropertyExpression node)
 {
     Visit((WriteIndexerExpression)node);
 }
Exemple #4
0
 public override void Visit(WritePropertyExpression node)
 {
     unfinishedClone = new WritePropertyExpression(GetCloneOf(node.Container), GetCloneOf(node.Index), GetCloneOf(node.Value));
     Visit((Indexer)node); //we need to skip over WriteIndexerExpression
 }
Exemple #5
0
 public override void Visit(WritePropertyExpression node)
 {
     UpdateType(node, TypeCalculator.GetType(node));
 }
Exemple #6
0
 public override void Visit(WritePropertyExpression node)
 {
     AssignToImplicitReturn(node);
 }