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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 2346543002: kernel -> ssa: implement literal lists (Closed)
Patch Set: dartfmt Created 4 years, 3 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
9 import '../common/tasks.dart' show CompilerTask; 9 import '../common/tasks.dart' show CompilerTask;
10 import '../compiler.dart'; 10 import '../compiler.dart';
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 astAdapter.getConstantForSymbol(symbolLiteral), compiler)); 272 astAdapter.getConstantForSymbol(symbolLiteral), compiler));
273 registry?.registerConstSymbol(symbolLiteral.value); 273 registry?.registerConstSymbol(symbolLiteral.value);
274 } 274 }
275 275
276 @override 276 @override
277 void visitNullLiteral(ir.NullLiteral nullLiteral) { 277 void visitNullLiteral(ir.NullLiteral nullLiteral) {
278 stack.add(graph.addConstantNull(compiler)); 278 stack.add(graph.addConstantNull(compiler));
279 } 279 }
280 280
281 @override 281 @override
282 void visitListLiteral(ir.ListLiteral listLiteral) {
283 HInstruction listInstruction;
284 if (listLiteral.isConst) {
285 listInstruction =
286 graph.addConstant(astAdapter.getConstantFor(listLiteral), compiler);
287 } else {
288 List<HInstruction> elements = <HInstruction>[];
289 for (ir.Expression element in listLiteral.expressions) {
290 element.accept(this);
291 elements.add(pop());
292 }
293 listInstruction = new HLiteralList(elements, backend.extendableArrayType);
294 add(listInstruction);
295 // TODO(het): set runtime type info
296 }
297
298 // TODO(het): Set the instruction type to the list type given by inference
299 stack.add(listInstruction);
300 }
301
302 @override
282 void visitStaticGet(ir.StaticGet staticGet) { 303 void visitStaticGet(ir.StaticGet staticGet) {
283 var staticTarget = staticGet.target; 304 var staticTarget = staticGet.target;
284 Element element = astAdapter.getElement(staticTarget).declaration; 305 Element element = astAdapter.getElement(staticTarget).declaration;
285 if (staticTarget is ir.Procedure && 306 if (staticTarget is ir.Procedure &&
286 staticTarget.kind == ir.ProcedureKind.Getter) { 307 staticTarget.kind == ir.ProcedureKind.Getter) {
287 // Invoke the getter 308 // Invoke the getter
288 _pushStaticInvocation( 309 _pushStaticInvocation(
289 target, const <HInstruction>[], astAdapter.returnTypeOf(target)); 310 target, const <HInstruction>[], astAdapter.returnTypeOf(target));
290 } else { 311 } else {
291 push(new HStatic(element, astAdapter.inferredTypeOf(staticTarget))); 312 push(new HStatic(element, astAdapter.inferredTypeOf(staticTarget)));
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 void visitThisExpression(ir.ThisExpression thisExpression) { 532 void visitThisExpression(ir.ThisExpression thisExpression) {
512 stack.add(localsHandler.readThis()); 533 stack.add(localsHandler.readThis());
513 } 534 }
514 535
515 @override 536 @override
516 void visitNot(ir.Not not) { 537 void visitNot(ir.Not not) {
517 not.operand.accept(this); 538 not.operand.accept(this);
518 push(new HNot(popBoolified(), backend.boolType)); 539 push(new HNot(popBoolified(), backend.boolType));
519 } 540 }
520 } 541 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/kernel_visitor.dart ('k') | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698