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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 14253008: Optimize length access on all JSIndexable things. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix test. Created 7 years, 8 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/interceptors.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
index de43ed6a51b660f4c0164575d27f069e13e4a1d5..ce24d01a7258989997626ad3831062e093a305b4 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -656,8 +656,7 @@ class JavaScriptBackend extends Backend {
ClassElement jsFixedArrayClass;
ClassElement jsExtendableArrayClass;
- Element jsArrayLength;
- Element jsStringLength;
+ Element jsIndexableLength;
Element jsArrayRemoveLast;
Element jsArrayAdd;
Element jsStringSplit;
@@ -910,25 +909,21 @@ class JavaScriptBackend extends Backend {
jsExtendableArrayClass.ensureResolved(compiler);
}
- jsArrayClass.ensureResolved(compiler);
- jsArrayLength = compiler.lookupElementIn(
- jsArrayClass, const SourceString('length'));
- if (jsArrayLength != null && jsArrayLength.isAbstractField()) {
- AbstractFieldElement element = jsArrayLength;
- jsArrayLength = element.getter;
+ jsIndexableClass.ensureResolved(compiler);
+ jsIndexableLength = compiler.lookupElementIn(
+ jsIndexableClass, const SourceString('length'));
+ if (jsIndexableLength != null && jsIndexableLength.isAbstractField()) {
+ AbstractFieldElement element = jsIndexableLength;
+ jsIndexableLength = element.getter;
}
+
+ jsArrayClass.ensureResolved(compiler);
jsArrayRemoveLast = compiler.lookupElementIn(
jsArrayClass, const SourceString('removeLast'));
jsArrayAdd = compiler.lookupElementIn(
jsArrayClass, const SourceString('add'));
jsStringClass.ensureResolved(compiler);
- jsStringLength = compiler.lookupElementIn(
- jsStringClass, const SourceString('length'));
- if (jsStringLength != null && jsStringLength.isAbstractField()) {
- AbstractFieldElement element = jsStringLength;
- jsStringLength = element.getter;
- }
jsStringSplit = compiler.lookupElementIn(
jsStringClass, const SourceString('split'));
jsStringConcat = compiler.lookupElementIn(
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/interceptors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698