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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart

Issue 78573003: Remove hack for length access of typed arrays. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/codegen.dart (revision 30471)
+++ sdk/lib/_internal/compiler/implementation/ssa/codegen.dart (working copy)
@@ -1660,30 +1660,7 @@
// 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.
- if (backend.isTypedArray(node.receiver.instructionType)) {
- // TODO(12929): Remove this custom code for typed arrays once V8
- // optimizes their length access.
- // Do a call to `fetchLength` instead of accessing `length`
- // directly. Because `fetchLength` is a constant we use its
- // constant value instead.
- if (node.usedBy.isEmpty) {
- // The length access has not been removed because it is
- // acting as a null check. For a faster null check, we use
- // toString.
- push(new js.PropertyAccess.field(pop(), 'toString'), node);
- } else {
- Element element = compiler.findRequiredElement(
- compiler.typedDataLibrary, 'fetchLength');
- Constant constant =
- compiler.constantHandler.getConstantForVariable(element);
- assert(invariant(element, constant != null,
- message: 'No constant computed for $element'));
- var jsConstant = backend.emitter.constantReference(constant);
- push(new js.Call(jsConstant, [pop()]), node);
- }
- } else {
- push(new js.PropertyAccess.field(pop(), 'length'), node);
- }
+ push(new js.PropertyAccess.field(pop(), 'length'), node);
} else {
String name = backend.namer.instanceFieldPropertyName(element);
push(new js.PropertyAccess.field(pop(), name), node);
« no previous file with comments | « no previous file | sdk/lib/typed_data/dart2js/typed_data_dart2js.dart » ('j') | sdk/lib/typed_data/dart2js/typed_data_dart2js.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698