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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart

Issue 1223813006: dart2js cps: Direct access on JS arrays. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update unit tests and remove unused functions Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 dart2js.ir_nodes_sexpr; 5 library dart2js.ir_nodes_sexpr;
6 6
7 import '../constants/values.dart'; 7 import '../constants/values.dart';
8 import '../util/util.dart'; 8 import '../util/util.dart';
9 import 'cps_ir_nodes.dart'; 9 import 'cps_ir_nodes.dart';
10 10
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 return '(ApplyBuiltinOperator $operator ($args))'; 333 return '(ApplyBuiltinOperator $operator ($args))';
334 } 334 }
335 335
336 @override 336 @override
337 String visitForeignCode(ForeignCode node) { 337 String visitForeignCode(ForeignCode node) {
338 String arguments = node.arguments.map(access).join(' '); 338 String arguments = node.arguments.map(access).join(' ');
339 String continuation = node.continuation == null ? '' 339 String continuation = node.continuation == null ? ''
340 : ' ${access(node.continuation)}'; 340 : ' ${access(node.continuation)}';
341 return '(JS ${node.type} ${node.codeTemplate} ($arguments)$continuation)'; 341 return '(JS ${node.type} ${node.codeTemplate} ($arguments)$continuation)';
342 } 342 }
343
344 @override
345 String visitGetLength(GetLength node) {
346 String object = access(node.object);
347 return '(GetLength $object)';
348 }
349
350 @override
351 String visitGetIndex(GetIndex node) {
352 String object = access(node.object);
353 String index = access(node.index);
354 return '(GetIndex $object $index)';
355 }
356
357 @override
358 String visitSetIndex(SetIndex node) {
359 String object = access(node.object);
360 String index = access(node.index);
361 String value = access(node.value);
362 return '(SetIndex $object $index $value)';
363 }
343 } 364 }
344 365
345 class ConstantStringifier extends ConstantValueVisitor<String, Null> { 366 class ConstantStringifier extends ConstantValueVisitor<String, Null> {
346 // Some of these methods are unimplemented because we haven't had a need 367 // Some of these methods are unimplemented because we haven't had a need
347 // to print such constants. When printing is implemented, the corresponding 368 // to print such constants. When printing is implemented, the corresponding
348 // parsing support should be added to SExpressionUnstringifier.parseConstant 369 // parsing support should be added to SExpressionUnstringifier.parseConstant
349 // in the dart2js tests (currently in the file 370 // in the dart2js tests (currently in the file
350 // tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart). 371 // tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart).
351 372
352 String _failWith(ConstantValue constant) { 373 String _failWith(ConstantValue constant) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 void setReturnContinuation(Continuation node) { 468 void setReturnContinuation(Continuation node) {
448 assert(!_names.containsKey(node) || _names[node] == 'return'); 469 assert(!_names.containsKey(node) || _names[node] == 'return');
449 _names[node] = 'return'; 470 _names[node] = 'return';
450 } 471 }
451 472
452 String getName(Node node) { 473 String getName(Node node) {
453 if (!_names.containsKey(node)) return 'MISSING_NAME'; 474 if (!_names.containsKey(node)) return 'MISSING_NAME';
454 return _names[node]; 475 return _names[node];
455 } 476 }
456 } 477 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698