Skip to content

Commit

Permalink
fixes #215, removes special case for length
Browse files Browse the repository at this point in the history
R=vsm@google.com

Review URL: https://codereview.chromium.org/1178523004.
  • Loading branch information
John Messerly committed Jun 10, 2015
1 parent c7b3846 commit d52346c
Show file tree
Hide file tree
Showing 13 changed files with 355 additions and 356 deletions.
150 changes: 75 additions & 75 deletions pkg/dev_compiler/lib/runtime/dart/_interceptors.js

Large diffs are not rendered by default.

106 changes: 53 additions & 53 deletions pkg/dev_compiler/lib/runtime/dart/_internal.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions pkg/dev_compiler/lib/runtime/dart/_isolate_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ dart.library('dart/_isolate_helper', null, /* Imports */[
}
serializeArray(x) {
let serialized = [];
serialized.length = x.length;
for (let i = 0; dart.notNull(i) < dart.notNull(x.length); i = dart.notNull(i) + 1) {
serialized[dartx.length] = x[dartx.length];
for (let i = 0; dart.notNull(i) < dart.notNull(x[dartx.length]); i = dart.notNull(i) + 1) {
serialized[dartx.set](i, this.serialize(x[dartx.get](i)));
}
return serialized;
}
serializeArrayInPlace(x) {
for (let i = 0; dart.notNull(i) < dart.notNull(x.length); i = dart.notNull(i) + 1) {
for (let i = 0; dart.notNull(i) < dart.notNull(x[dartx.length]); i = dart.notNull(i) + 1) {
x[dartx.set](i, this.serialize(x[dartx.get](i)));
}
return x;
Expand All @@ -128,8 +128,8 @@ dart.library('dart/_isolate_helper', null, /* Imports */[
}
let keys = dart.as(Object.keys(x), core.List);
let values = [];
values.length = keys.length;
for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notNull(i) + 1) {
values[dartx.length] = keys[dartx.length];
for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) {
values[dartx.set](i, this.serialize(x[keys[dartx.get](i)]));
}
return ['js-object', keys, values];
Expand Down Expand Up @@ -282,7 +282,7 @@ dart.library('dart/_isolate_helper', null, /* Imports */[
return result;
}
deserializeArrayInPlace(x) {
for (let i = 0; dart.notNull(i) < dart.notNull(x.length); i = dart.notNull(i) + 1) {
for (let i = 0; dart.notNull(i) < dart.notNull(x[dartx.length]); i = dart.notNull(i) + 1) {
x[dartx.set](i, this.deserialize(x[dartx.get](i)));
}
return x;
Expand Down Expand Up @@ -318,7 +318,7 @@ dart.library('dart/_isolate_helper', null, /* Imports */[
let result = dart.map();
this.deserializedObjects[dartx.add](result);
keys = keys[dartx.map](dart.bind(this, 'deserialize'))[dartx.toList]();
for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notNull(i) + 1) {
for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) {
result.set(keys[dartx.get](i), this.deserialize(values[dartx.get](i)));
}
return result;
Expand Down Expand Up @@ -355,7 +355,7 @@ dart.library('dart/_isolate_helper', null, /* Imports */[
let values = dart.as(dart.dindex(x, 2), core.List);
let o = {};
this.deserializedObjects[dartx.add](o);
for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notNull(i) + 1) {
for (let i = 0; dart.notNull(i) < dart.notNull(keys[dartx.length]); i = dart.notNull(i) + 1) {
o[keys[dartx.get](i)] = this.deserialize(values[dartx.get](i));
}
return o;
Expand Down
28 changes: 14 additions & 14 deletions pkg/dev_compiler/lib/runtime/dart/_js_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ dart.library('dart/_js_helper', null, /* Imports */[
start = 0;
checkString(string);
checkInt(start);
if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.length)) {
throw new core.RangeError.range(start, 0, string.length);
if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[dartx.length])) {
throw new core.RangeError.range(start, 0, string[dartx.length]);
}
return new _AllMatchesIterable(this, string, start);
}
Expand All @@ -167,16 +167,16 @@ dart.library('dart/_js_helper', null, /* Imports */[
let match = dart.as(regexp.exec(string), core.List);
if (match == null)
return null;
if (match[dartx.get](dart.notNull(match.length) - 1) != null)
if (match[dartx.get](dart.notNull(match[dartx.length]) - 1) != null)
return null;
match.length = dart.notNull(match.length) - 1;
match[dartx.length] = dart.notNull(match[dartx.length]) - 1;
return new _MatchImplementation(this, dart.as(match, core.List$(core.String)));
}
matchAsPrefix(string, start) {
if (start === void 0)
start = 0;
if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.length)) {
throw new core.RangeError.range(start, 0, string.length);
if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[dartx.length])) {
throw new core.RangeError.range(start, 0, string[dartx.length]);
}
return this[_execAnchored](string, start);
}
Expand Down Expand Up @@ -218,7 +218,7 @@ dart.library('dart/_js_helper', null, /* Imports */[
return this[_match].index;
}
get end() {
return dart.notNull(this.start) + dart.notNull(this[_match][dartx.get](0).length);
return dart.notNull(this.start) + dart.notNull(this[_match][dartx.get](0)[dartx.length]);
}
group(index) {
return this[_match][dartx.get](index);
Expand All @@ -227,7 +227,7 @@ dart.library('dart/_js_helper', null, /* Imports */[
return this.group(index);
}
get groupCount() {
return dart.notNull(this[_match].length) - 1;
return dart.notNull(this[_match][dartx.length]) - 1;
}
groups(groups) {
let out = dart.list([], core.String);
Expand Down Expand Up @@ -280,7 +280,7 @@ dart.library('dart/_js_helper', null, /* Imports */[
moveNext() {
if (this[_string] == null)
return false;
if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string].length)) {
if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string][dartx.length])) {
let match = this[_regExp][_execGlobal](this[_string], this[_nextIndex]);
if (match != null) {
this[_current] = match;
Expand Down Expand Up @@ -313,7 +313,7 @@ dart.library('dart/_js_helper', null, /* Imports */[
this.pattern = pattern;
}
get end() {
return dart.notNull(this.start) + dart.notNull(this.pattern.length);
return dart.notNull(this.start) + dart.notNull(this.pattern[dartx.length]);
}
get(g) {
return this.group(g);
Expand Down Expand Up @@ -346,8 +346,8 @@ dart.library('dart/_js_helper', null, /* Imports */[
});
function allMatchesInStringUnchecked(needle, haystack, startIndex) {
let result = core.List$(core.Match).new();
let length = haystack.length;
let patternLength = needle.length;
let length = haystack[dartx.length];
let patternLength = needle[dartx.length];
while (true) {
let position = haystack[dartx.indexOf](needle, startIndex);
if (position == -1) {
Expand Down Expand Up @@ -599,7 +599,7 @@ dart.library('dart/_js_helper', null, /* Imports */[
maxCharCode = 97 + dart.notNull(radix) - 10 - 1;
}
let digitsPart = dart.as(dart.dindex(match, digitsIndex), core.String);
for (let i = 0; dart.notNull(i) < dart.notNull(digitsPart.length); i = dart.notNull(i) + 1) {
for (let i = 0; dart.notNull(i) < dart.notNull(digitsPart[dartx.length]); i = dart.notNull(i) + 1) {
let characterCode = dart.notNull(digitsPart[dartx.codeUnitAt](0)) | 32;
if (dart.notNull(digitsPart[dartx.codeUnitAt](i)) > dart.notNull(maxCharCode)) {
return handleError(source);
Expand Down Expand Up @@ -672,7 +672,7 @@ dart.library('dart/_js_helper', null, /* Imports */[
static _fromCharCodeApply(array) {
let result = "";
let kMaxApply = 500;
let end = array.length;
let end = array[dartx.length];
for (let i = 0; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + dart.notNull(kMaxApply)) {
let subarray = null;
if (dart.notNull(end) <= dart.notNull(kMaxApply)) {
Expand Down
16 changes: 8 additions & 8 deletions pkg/dev_compiler/lib/runtime/dart/_native_typed_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ dart.library('dart/_native_typed_data', null, /* Imports */[
this[_storage] = storage;
}
_slowFromList(list) {
this[_storage] = NativeFloat32List.new(dart.notNull(list.length) * 4);
for (let i = 0; dart.notNull(i) < dart.notNull(list.length); i = dart.notNull(i) + 1) {
this[_storage] = NativeFloat32List.new(dart.notNull(list[dartx.length]) * 4);
for (let i = 0; dart.notNull(i) < dart.notNull(list[dartx.length]); i = dart.notNull(i) + 1) {
let e = list[dartx.get](i);
this[_storage].set(dart.notNull(i) * 4 + 0, e.x);
this[_storage].set(dart.notNull(i) * 4 + 1, e.y);
Expand Down Expand Up @@ -266,8 +266,8 @@ dart.library('dart/_native_typed_data', null, /* Imports */[
this[_storage] = storage;
}
_slowFromList(list) {
this[_storage] = NativeInt32List.new(dart.notNull(list.length) * 4);
for (let i = 0; dart.notNull(i) < dart.notNull(list.length); i = dart.notNull(i) + 1) {
this[_storage] = NativeInt32List.new(dart.notNull(list[dartx.length]) * 4);
for (let i = 0; dart.notNull(i) < dart.notNull(list[dartx.length]); i = dart.notNull(i) + 1) {
let e = list[dartx.get](i);
this[_storage].set(dart.notNull(i) * 4 + 0, e.x);
this[_storage].set(dart.notNull(i) * 4 + 1, e.y);
Expand Down Expand Up @@ -374,8 +374,8 @@ dart.library('dart/_native_typed_data', null, /* Imports */[
this[_storage] = storage;
}
_slowFromList(list) {
this[_storage] = NativeFloat64List.new(dart.notNull(list.length) * 2);
for (let i = 0; dart.notNull(i) < dart.notNull(list.length); i = dart.notNull(i) + 1) {
this[_storage] = NativeFloat64List.new(dart.notNull(list[dartx.length]) * 2);
for (let i = 0; dart.notNull(i) < dart.notNull(list[dartx.length]); i = dart.notNull(i) + 1) {
let e = list[dartx.get](i);
this[_storage].set(dart.notNull(i) * 2 + 0, e.x);
this[_storage].set(dart.notNull(i) * 2 + 1, e.y);
Expand Down Expand Up @@ -533,8 +533,8 @@ dart.library('dart/_native_typed_data', null, /* Imports */[
function _ensureNativeList(list) {
if (dart.is(list, _interceptors.JSIndexable))
return list;
let result = core.List.new(list.length);
for (let i = 0; dart.notNull(i) < dart.notNull(list.length); i = dart.notNull(i) + 1) {
let result = core.List.new(list[dartx.length]);
for (let i = 0; dart.notNull(i) < dart.notNull(list[dartx.length]); i = dart.notNull(i) + 1) {
result[dartx.set](i, list[dartx.get](i));
}
return result;
Expand Down
Loading

0 comments on commit d52346c

Please sign in to comment.