| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import '../common.dart'; | 6 import '../common.dart'; |
| 7 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 7 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
| 8 import '../common/tasks.dart' show CompilerTask; | 8 import '../common/tasks.dart' show CompilerTask; |
| 9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
| 10 import '../constants/constant_system.dart'; | 10 import '../constants/constant_system.dart'; |
| (...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1929 backend.namer.aliasedSuperMemberPropertyName(superElement), | 1929 backend.namer.aliasedSuperMemberPropertyName(superElement), |
| 1930 visitArguments(node.inputs, start: 1) | 1930 visitArguments(node.inputs, start: 1) |
| 1931 ]) // Skip receiver argument. | 1931 ]) // Skip receiver argument. |
| 1932 .withSourceInformation(node.sourceInformation)); | 1932 .withSourceInformation(node.sourceInformation)); |
| 1933 } | 1933 } |
| 1934 } | 1934 } |
| 1935 } | 1935 } |
| 1936 | 1936 |
| 1937 visitFieldGet(HFieldGet node) { | 1937 visitFieldGet(HFieldGet node) { |
| 1938 use(node.receiver); | 1938 use(node.receiver); |
| 1939 MemberEntity element = node.element; | |
| 1940 if (node.isNullCheck) { | 1939 if (node.isNullCheck) { |
| 1941 // We access a JavaScript member we know all objects besides | 1940 // We access a JavaScript member we know all objects besides |
| 1942 // null and undefined have: V8 does not like accessing a member | 1941 // null and undefined have: V8 does not like accessing a member |
| 1943 // that does not exist. | 1942 // that does not exist. |
| 1944 push(new js.PropertyAccess.field(pop(), 'toString') | 1943 push(new js.PropertyAccess.field(pop(), 'toString') |
| 1945 .withSourceInformation(node.sourceInformation)); | 1944 .withSourceInformation(node.sourceInformation)); |
| 1946 } else if (element == helpers.jsIndexableLength) { | |
| 1947 // We're accessing a native JavaScript property called 'length' | |
| 1948 // on a JS String or a JS array. Therefore, the name of that | |
| 1949 // property should not be mangled. | |
| 1950 push(new js.PropertyAccess.field(pop(), 'length') | |
| 1951 .withSourceInformation(node.sourceInformation)); | |
| 1952 } else { | 1945 } else { |
| 1953 FieldEntity field = element; | 1946 FieldEntity field = node.element; |
| 1954 js.Name name = backend.namer.instanceFieldPropertyName(field); | 1947 js.Name name = backend.namer.instanceFieldPropertyName(field); |
| 1955 push(new js.PropertyAccess(pop(), name) | 1948 push(new js.PropertyAccess(pop(), name) |
| 1956 .withSourceInformation(node.sourceInformation)); | 1949 .withSourceInformation(node.sourceInformation)); |
| 1957 registry.registerStaticUse(new StaticUse.fieldGet(field)); | 1950 registry.registerStaticUse(new StaticUse.fieldGet(field)); |
| 1958 } | 1951 } |
| 1959 } | 1952 } |
| 1960 | 1953 |
| 1961 visitFieldSet(HFieldSet node) { | 1954 visitFieldSet(HFieldSet node) { |
| 1962 MemberEntity element = node.element; | 1955 FieldEntity element = node.element; |
| 1963 registry.registerStaticUse(new StaticUse.fieldSet(element)); | 1956 registry.registerStaticUse(new StaticUse.fieldSet(element)); |
| 1964 js.Name name = backend.namer.instanceFieldPropertyName(element); | 1957 js.Name name = backend.namer.instanceFieldPropertyName(element); |
| 1965 use(node.receiver); | 1958 use(node.receiver); |
| 1966 js.Expression receiver = pop(); | 1959 js.Expression receiver = pop(); |
| 1967 use(node.value); | 1960 use(node.value); |
| 1968 push(new js.Assignment(new js.PropertyAccess(receiver, name), pop()) | 1961 push(new js.Assignment(new js.PropertyAccess(receiver, name), pop()) |
| 1969 .withSourceInformation(node.sourceInformation)); | 1962 .withSourceInformation(node.sourceInformation)); |
| 1970 } | 1963 } |
| 1971 | 1964 |
| 1965 visitGetLength(HGetLength node) { |
| 1966 use(node.receiver); |
| 1967 push(new js.PropertyAccess.field(pop(), 'length') |
| 1968 .withSourceInformation(node.sourceInformation)); |
| 1969 } |
| 1970 |
| 1972 visitReadModifyWrite(HReadModifyWrite node) { | 1971 visitReadModifyWrite(HReadModifyWrite node) { |
| 1973 FieldEntity element = node.element; | 1972 FieldEntity element = node.element; |
| 1974 registry.registerStaticUse(new StaticUse.fieldGet(element)); | 1973 registry.registerStaticUse(new StaticUse.fieldGet(element)); |
| 1975 registry.registerStaticUse(new StaticUse.fieldSet(element)); | 1974 registry.registerStaticUse(new StaticUse.fieldSet(element)); |
| 1976 js.Name name = backend.namer.instanceFieldPropertyName(element); | 1975 js.Name name = backend.namer.instanceFieldPropertyName(element); |
| 1977 use(node.receiver); | 1976 use(node.receiver); |
| 1978 js.Expression fieldReference = new js.PropertyAccess(pop(), name); | 1977 js.Expression fieldReference = new js.PropertyAccess(pop(), name); |
| 1979 if (node.isPreOp) { | 1978 if (node.isPreOp) { |
| 1980 push(new js.Prefix(node.jsOp, fieldReference) | 1979 push(new js.Prefix(node.jsOp, fieldReference) |
| 1981 .withSourceInformation(node.sourceInformation)); | 1980 .withSourceInformation(node.sourceInformation)); |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3115 registry.registerStaticUse(new StaticUse.staticInvoke( | 3114 registry.registerStaticUse(new StaticUse.staticInvoke( |
| 3116 helper, new CallStructure.unnamed(argumentCount))); | 3115 helper, new CallStructure.unnamed(argumentCount))); |
| 3117 return backend.emitter.staticFunctionAccess(helper); | 3116 return backend.emitter.staticFunctionAccess(helper); |
| 3118 } | 3117 } |
| 3119 | 3118 |
| 3120 @override | 3119 @override |
| 3121 void visitRef(HRef node) { | 3120 void visitRef(HRef node) { |
| 3122 visit(node.value); | 3121 visit(node.value); |
| 3123 } | 3122 } |
| 3124 } | 3123 } |
| OLD | NEW |