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

Unified Diff: compiler/lib/implementation/array.js

Issue 9250005: Fix dartc in optimized mode (broken in r3358). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge. Created 8 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: compiler/lib/implementation/array.js
diff --git a/compiler/lib/implementation/array.js b/compiler/lib/implementation/array.js
index a6b1abe17ac15cfd3a6f7b81a6a94f9ef38b1046..667160715e0bbff19b8cac25645e8b31848dd8c7 100644
--- a/compiler/lib/implementation/array.js
+++ b/compiler/lib/implementation/array.js
@@ -8,12 +8,24 @@ function native_ListFactory__new(typeToken, length) {
Array.$lookupRTT(RTT.getTypeInfo(typeToken).typeArgs));
}
-function native_ListImplementation__indexOperator(index) {
- return this[index];
+function native_ListImplementation_INDEX(index) {
+ var i = index | 0;
+ if (i !== index) {
+ native__NumberJsUtil__throwIllegalArgumentException(index);
+ } else if (i < 0 || i >= this.length) {
+ native__ListJsUtil__throwIndexOutOfRangeException(index);
+ }
+ return this[i];
}
-function native_ListImplementation__indexAssignOperator(index, value) {
- this[index] = value;
+function native_ListImplementation_ASSIGN_INDEX(index, value) {
+ var i = index | 0;
+ if (i !== index) {
+ native__NumberJsUtil__throwIllegalArgumentException(index);
+ } else if (i < 0 || i >= this.length) {
+ native__ListJsUtil__throwIndexOutOfRangeException(index);
+ }
+ this[i] = value;
}
function native_ListImplementation_get$length() {
@@ -28,13 +40,6 @@ function native_ListImplementation__add(element) {
this.push(element);
}
-function $inlineArrayIndexCheck(array, index) {
- if (index >= 0 && index < array.length) {
- return index;
- }
- native__ListJsUtil__throwIndexOutOfRangeException(index);
-}
-
function native_ListImplementation__removeRange(start, length) {
this.splice(start, length);
}
@@ -46,3 +51,13 @@ function native_ListImplementation__insertRange(start, length, initialValue) {
}
this.splice.apply(this, array);
}
+
+function $inlineArrayIndexCheck(array, index) {
+ var i = index | 0;
+ if (i !== index) {
+ native__NumberJsUtil__throwIllegalArgumentException(index);
+ } else if (i < 0 || i >= array.length) {
+ native__ListJsUtil__throwIndexOutOfRangeException(index);
+ }
+ return i;
+}

Powered by Google App Engine
This is Rietveld 408576698