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

Side by Side Diff: dart/frog/leg/lib/js_helper.dart

Issue 9423040: Fix crash in SSA builder for receiver-less calls. Not sure this is correct. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/frog/leg/ssa/builder.dart » ('j') | dart/frog/leg/ssa/builder.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library('js_helper'); 5 #library('js_helper');
6 6
7 #import('coreimpl.dart'); 7 #import('coreimpl.dart');
8 8
9 #source('date_helper.dart'); 9 #source('date_helper.dart');
10 10
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 builtin$addAll$1(receiver, collection) { 545 builtin$addAll$1(receiver, collection) {
546 checkNull(receiver); 546 checkNull(receiver);
547 if (!isJSArray(receiver)) return UNINTERCEPTED(receiver.addAll(collection)); 547 if (!isJSArray(receiver)) return UNINTERCEPTED(receiver.addAll(collection));
548 548
549 var iterator = collection.iterator(); 549 var iterator = collection.iterator();
550 while (iterator.hasNext()) { 550 while (iterator.hasNext()) {
551 receiver.add(iterator.next()); 551 receiver.add(iterator.next());
552 } 552 }
553 } 553 }
554 554
555 // TODO(ahe): Investigate why this method causes a compiler crash. 555 builtin$addLast$1(receiver, value) {
556 XXX_builtin$addLast$1(receiver, value) {
557 checkNull(receiver); 556 checkNull(receiver);
558 if (!isJSArray(receiver)) return UNINTERCEPTED(receiver.addLast(value)); 557 if (!isJSArray(receiver)) return UNINTERCEPTED(receiver.addLast(value));
559 558
560 throw @'builtin$addLast$1 is not implemented'; 559 JS("Object", @"$0.push($1)", receiver, value);
561 } 560 }
562 561
563 builtin$clear$0(receiver) { 562 builtin$clear$0(receiver) {
564 checkNull(receiver); 563 checkNull(receiver);
565 if (!isJSArray(receiver)) return UNINTERCEPTED(receiver.clear()); 564 if (!isJSArray(receiver)) return UNINTERCEPTED(receiver.clear());
566 receiver.length = 0; 565 receiver.length = 0;
567 } 566 }
568 567
569 // TODO(ahe): Investigate why this method causes a compiler crash. 568 builtin$forEach$1(receiver, f) {
570 XXX_builtin$forEach$1(receiver, f) {
571 checkNull(receiver); 569 checkNull(receiver);
572 if (!isJSArray(receiver)) return UNINTERCEPTED(receiver.forEach(f)); 570 if (!isJSArray(receiver)) return UNINTERCEPTED(receiver.forEach(f));
573 571
574 throw @'builtin$forEach$1 is not implemented'; 572 var length = JS("num", @"$0.length", receiver);
573 for (var i = 0; i < length; i++) {
574 f(JS("Object", @"$0[$1]", receiver, i));
575 }
575 } 576 }
576 577
577 builtin$getRange$2(receiver, start, length) { 578 builtin$getRange$2(receiver, start, length) {
578 checkNull(receiver); 579 checkNull(receiver);
579 if (!isJSArray(receiver)) { 580 if (!isJSArray(receiver)) {
580 return UNINTERCEPTED(receiver.getRange(start, length)); 581 return UNINTERCEPTED(receiver.getRange(start, length));
581 } 582 }
582 if (0 === length) return []; 583 if (0 === length) return [];
583 checkNull(start); // TODO(ahe): This is not specified but co19 tests it. 584 checkNull(start); // TODO(ahe): This is not specified but co19 tests it.
584 checkNull(length); // TODO(ahe): This is not specified but co19 tests it. 585 checkNull(length); // TODO(ahe): This is not specified but co19 tests it.
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 builtin$hashCode$0(receiver) { 1135 builtin$hashCode$0(receiver) {
1135 if (receiver is num) return receiver & 0x1FFFFFFF; 1136 if (receiver is num) return receiver & 0x1FFFFFFF;
1136 if (receiver is String) { 1137 if (receiver is String) {
1137 throw 'String.hashCode is not implemented'; 1138 throw 'String.hashCode is not implemented';
1138 } 1139 }
1139 if (isJSArray(receiver)) { 1140 if (isJSArray(receiver)) {
1140 throw 'List.hashCode is not implemented'; 1141 throw 'List.hashCode is not implemented';
1141 } 1142 }
1142 return UNINTERCEPTED(receiver.hashCode()); 1143 return UNINTERCEPTED(receiver.hashCode());
1143 } 1144 }
OLDNEW
« no previous file with comments | « no previous file | dart/frog/leg/ssa/builder.dart » ('j') | dart/frog/leg/ssa/builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698