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

Unified Diff: sdk/lib/typed_data/dart2js/typed_data_dart2js.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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
===================================================================
--- sdk/lib/typed_data/dart2js/typed_data_dart2js.dart (revision 30471)
+++ sdk/lib/typed_data/dart2js/typed_data_dart2js.dart (working copy)
@@ -42,18 +42,6 @@
final int lengthInBytes;
}
-// TODO(12929): Remove this constant once V8 optimizes length access of
-// typed arrays. Firefox does not like accessing a named property of a
-// typed array, so we only use the new [:$dartCachedLength:] property in V8 and
-// Chrome.
-const fetchLength = const JS_CONST(r'''
- ((typeof version == "function" && typeof os == "object" && "system" in os)
- || (typeof navigator == "object"
- && navigator.userAgent.indexOf('Chrome') != -1))
- ? function(x) { return x.$dartCachedLength || x.length; }
- : function(x) { return x.length; };
-''');
-
/**
* A typed view of a sequence of bytes.
*/
@@ -519,7 +507,7 @@
static const int BYTES_PER_ELEMENT = 4;
- int get length => JS("int", '#(#)', fetchLength, this);
+ int get length => JS("int", '#.length', this);
num operator[](int index) {
_checkIndex(index, length);
@@ -597,7 +585,7 @@
static const int BYTES_PER_ELEMENT = 8;
- int get length => JS("int", '#(#)', fetchLength, this);
+ int get length => JS("int", '#.length', this);
num operator[](int index) {
_checkIndex(index, length);
@@ -676,7 +664,7 @@
static const int BYTES_PER_ELEMENT = 2;
- int get length => JS("int", '#(#)', fetchLength, this);
+ int get length => JS("int", '#.length', this);
int operator[](int index) {
_checkIndex(index, length);
@@ -751,7 +739,7 @@
static const int BYTES_PER_ELEMENT = 4;
- int get length => JS("int", '#(#)', fetchLength, this);
+ int get length => JS("int", '#.length', this);
int operator[](int index) {
_checkIndex(index, length);
@@ -823,7 +811,7 @@
static const int BYTES_PER_ELEMENT = 1;
- int get length => JS("int", '#(#)', fetchLength, this);
+ int get length => JS("int", '#.length', this);
int operator[](int index) {
_checkIndex(index, length);
@@ -899,7 +887,7 @@
static const int BYTES_PER_ELEMENT = 2;
- int get length => JS("int", '#(#)', fetchLength, this);
+ int get length => JS("int", '#.length', this);
int operator[](int index) {
_checkIndex(index, length);
@@ -975,7 +963,7 @@
static const int BYTES_PER_ELEMENT = 4;
- int get length => JS("int", '#(#)', fetchLength, this);
+ int get length => JS("int", '#.length', this);
int operator[](int index) {
_checkIndex(index, length);
@@ -1048,7 +1036,7 @@
static const int BYTES_PER_ELEMENT = 1;
- int get length => JS("int", '#(#)', fetchLength, this);
+ int get length => JS("int", '#.length', this);
int operator[](int index) {
_checkIndex(index, length);
@@ -1127,7 +1115,7 @@
static const int BYTES_PER_ELEMENT = 1;
- int get length => JS("int", '#(#)', fetchLength, this);
+ int get length => JS("int", '#.length', this);
int operator[](int index) {
_checkIndex(index, length);
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698