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

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

Issue 2585223002: Access ConstantSystem through ClosedWorld. (Closed)
Patch Set: Created 4 years 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 '../closure.dart'; 5 import '../closure.dart';
6 import '../common.dart'; 6 import '../common.dart';
7 import '../common/codegen.dart' show CodegenRegistry; 7 import '../common/codegen.dart' show CodegenRegistry;
8 import '../compiler.dart'; 8 import '../compiler.dart';
9 import '../constants/constant_system.dart';
9 import '../dart_types.dart'; 10 import '../dart_types.dart';
10 import '../elements/elements.dart'; 11 import '../elements/elements.dart';
11 import '../io/source_information.dart'; 12 import '../io/source_information.dart';
12 import '../js_backend/js_backend.dart'; 13 import '../js_backend/js_backend.dart';
13 import '../resolution/tree_elements.dart'; 14 import '../resolution/tree_elements.dart';
14 import '../tree/tree.dart' as ast; 15 import '../tree/tree.dart' as ast;
15 import '../types/types.dart'; 16 import '../types/types.dart';
16 import '../universe/call_structure.dart' show CallStructure; 17 import '../universe/call_structure.dart' show CallStructure;
17 import '../universe/use.dart' show TypeUse; 18 import '../universe/use.dart' show TypeUse;
18 import '../world.dart' show ClosedWorld; 19 import '../world.dart' show ClosedWorld;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return stack.removeLast(); 76 return stack.removeLast();
76 } 77 }
77 78
78 /// Pops the most recent instruction from the stack and 'boolifies' it. 79 /// Pops the most recent instruction from the stack and 'boolifies' it.
79 /// 80 ///
80 /// Boolification is checking if the value is '=== true'. 81 /// Boolification is checking if the value is '=== true'.
81 HInstruction popBoolified(); 82 HInstruction popBoolified();
82 83
83 /// Pushes a boolean checking [expression] against null. 84 /// Pushes a boolean checking [expression] against null.
84 pushCheckNull(HInstruction expression) { 85 pushCheckNull(HInstruction expression) {
85 push(new HIdentity(expression, graph.addConstantNull(compiler), null, 86 push(new HIdentity(expression, graph.addConstantNull(closedWorld), null,
86 closedWorld.commonMasks.boolType)); 87 closedWorld.commonMasks.boolType));
87 } 88 }
88 89
89 void dup() { 90 void dup() {
90 stack.add(stack.last); 91 stack.add(stack.last);
91 } 92 }
92 93
93 HBasicBlock _current; 94 HBasicBlock _current;
94 95
95 /// The current block to add instructions to. Might be null, if we are 96 /// The current block to add instructions to. Might be null, if we are
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 286
286 for (DartType parameter in type.optionalParameterTypes) { 287 for (DartType parameter in type.optionalParameterTypes) {
287 parameter.accept(this, builder); 288 parameter.accept(this, builder);
288 inputs.add(builder.pop()); 289 inputs.add(builder.pop());
289 } 290 }
290 291
291 List<DartType> namedParameterTypes = type.namedParameterTypes; 292 List<DartType> namedParameterTypes = type.namedParameterTypes;
292 List<String> names = type.namedParameters; 293 List<String> names = type.namedParameters;
293 for (int index = 0; index < names.length; index++) { 294 for (int index = 0; index < names.length; index++) {
294 ast.DartString dartString = new ast.DartString.literal(names[index]); 295 ast.DartString dartString = new ast.DartString.literal(names[index]);
295 inputs.add(builder.graph.addConstantString(dartString, builder.compiler)); 296 inputs.add(
297 builder.graph.addConstantString(dartString, builder.closedWorld));
296 namedParameterTypes[index].accept(this, builder); 298 namedParameterTypes[index].accept(this, builder);
297 inputs.add(builder.pop()); 299 inputs.add(builder.pop());
298 } 300 }
299 301
300 ClassElement cls = builder.backend.helpers.RuntimeFunctionType; 302 ClassElement cls = builder.backend.helpers.RuntimeFunctionType;
301 builder.push( 303 builder.push(
302 new HFunctionType(inputs, type, new TypeMask.exact(cls, closedWorld))); 304 new HFunctionType(inputs, type, new TypeMask.exact(cls, closedWorld)));
303 } 305 }
304 306
305 void visitMalformedType(MalformedType type, GraphBuilder builder) { 307 void visitMalformedType(MalformedType type, GraphBuilder builder) {
(...skipping 25 matching lines...) Expand all
331 if (unaliased is TypedefType) throw 'unable to unalias $type'; 333 if (unaliased is TypedefType) throw 'unable to unalias $type';
332 unaliased.accept(this, builder); 334 unaliased.accept(this, builder);
333 } 335 }
334 336
335 void visitDynamicType(DynamicType type, GraphBuilder builder) { 337 void visitDynamicType(DynamicType type, GraphBuilder builder) {
336 JavaScriptBackend backend = builder.compiler.backend; 338 JavaScriptBackend backend = builder.compiler.backend;
337 ClassElement cls = backend.helpers.DynamicRuntimeType; 339 ClassElement cls = backend.helpers.DynamicRuntimeType;
338 builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld))); 340 builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld)));
339 } 341 }
340 } 342 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698