Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: pkg/compiler/lib/src/ssa/codegen.dart

Issue 2673513003: dart2js: Introduce HGetLength to replace strange use of HFieldGet (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/ssa/codegen.dart
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index 27fc2e879e9cda61e0f55d0e6d80615f142c566d..56740243115ac3700f782ec851a3090814d57a4c 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -1936,21 +1936,14 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
visitFieldGet(HFieldGet node) {
use(node.receiver);
- MemberEntity element = node.element;
if (node.isNullCheck) {
// We access a JavaScript member we know all objects besides
// null and undefined have: V8 does not like accessing a member
// that does not exist.
push(new js.PropertyAccess.field(pop(), 'toString')
.withSourceInformation(node.sourceInformation));
- } else if (element == helpers.jsIndexableLength) {
- // We're accessing a native JavaScript property called 'length'
- // on a JS String or a JS array. Therefore, the name of that
- // property should not be mangled.
- push(new js.PropertyAccess.field(pop(), 'length')
- .withSourceInformation(node.sourceInformation));
} else {
- FieldEntity field = element;
+ FieldEntity field = node.element;
js.Name name = backend.namer.instanceFieldPropertyName(field);
push(new js.PropertyAccess(pop(), name)
.withSourceInformation(node.sourceInformation));
@@ -1959,7 +1952,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
visitFieldSet(HFieldSet node) {
- MemberEntity element = node.element;
+ FieldEntity element = node.element;
registry.registerStaticUse(new StaticUse.fieldSet(element));
js.Name name = backend.namer.instanceFieldPropertyName(element);
use(node.receiver);
@@ -1969,6 +1962,12 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
.withSourceInformation(node.sourceInformation));
}
+ visitGetLength(HGetLength node) {
+ use(node.receiver);
+ push(new js.PropertyAccess.field(pop(), 'length')
+ .withSourceInformation(node.sourceInformation));
+ }
+
visitReadModifyWrite(HReadModifyWrite node) {
FieldEntity element = node.element;
registry.registerStaticUse(new StaticUse.fieldGet(element));

Powered by Google App Engine
This is Rietveld 408576698