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

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

Issue 23766002: Work around runtime engine deficiencies. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/codegen.dart (revision 26873)
+++ sdk/lib/_internal/compiler/implementation/ssa/codegen.dart (working copy)
@@ -1664,7 +1664,21 @@
// 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'), node);
+ if (backend.isTypedArray(
+ node.receiver.instructionType.computeMask(compiler))) {
+ // 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.
+ Element element = compiler.findRequiredElement(
+ compiler.typedDataLibrary, const SourceString('fetchLength'));
+ Constant constant = compiler.constantHandler.compileConstant(element);
+ var jsConstant = backend.emitter.constantReference(constant);
+ push(new js.Call(jsConstant, [pop()]), node);
+ } else {
+ push(new js.PropertyAccess.field(pop(), 'length'), node);
+ }
} else {
String name = _fieldPropertyName(element);
push(new js.PropertyAccess.field(pop(), name), node);
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart ('k') | sdk/lib/_internal/lib/foreign_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698